Skip to main content

freeswitch_types/
lib.rs

1//! FreeSWITCH protocol types: channel state, events, headers, commands, and variables.
2// The esl_event_types! macro uses TT-munching filter arms over ~90 variants,
3// requiring a higher recursion limit than the default 128.
4#![recursion_limit = "512"]
5//!
6//! This crate provides the domain types for FreeSWITCH's Event Socket Library (ESL)
7//! protocol without any async runtime dependency. Use it standalone for CDR parsing,
8//! config generation, command building, or channel variable validation.
9//!
10//! For async ESL transport (connecting to FreeSWITCH, sending commands, receiving events),
11//! see the [`freeswitch-esl-tokio`](https://docs.rs/freeswitch-esl-tokio) crate which
12//! re-exports everything from this crate.
13//!
14//! # SIP header types
15//!
16//! General-purpose SIP header parsing is provided by the
17//! [`sip-header`](https://docs.rs/sip-header) crate, re-exported here for convenience.
18//! Types like [`SipHeaderAddr`], [`UriInfo`], [`HistoryInfo`], and [`SipGeolocation`]
19//! are available from the crate root.
20
21pub use sip_header;
22pub use sip_header::define_header_enum;
23pub use sip_header::sip_uri;
24
25#[macro_use]
26mod macros;
27
28pub mod channel;
29#[cfg(feature = "esl")]
30pub mod commands;
31#[cfg(feature = "esl")]
32pub mod event;
33pub mod headers;
34pub mod lookup;
35#[cfg(feature = "esl")]
36pub mod lossy_values;
37pub mod prelude;
38#[cfg(feature = "sdp")]
39pub mod sdp;
40pub mod sofia;
41pub mod variables;
42#[doc(hidden)]
43pub mod wire_safety;
44
45/// Default FreeSWITCH ESL port for inbound connections.
46pub const DEFAULT_ESL_PORT: u16 = 8021;
47
48/// Default FreeSWITCH ESL password (`ClueCon`).
49pub const DEFAULT_ESL_PASSWORD: &str = "ClueCon";
50
51pub use channel::{
52    AnswerState, CallDirection, CallState, ChannelState, ChannelTimetable, HangupCause,
53    ParseAnswerStateError, ParseCallDirectionError, ParseCallStateError, ParseChannelStateError,
54    ParseHangupCauseError, ParseTimetableError, TimetablePrefix,
55};
56#[cfg(feature = "esl")]
57pub use commands::{
58    Application, BridgeDialString, DialString, DialplanType, Endpoint, GroupCallOrder, Originate,
59    OriginateError, OriginateTarget, ParseDialplanTypeError, ParseGroupCallOrderError, UuidAnswer,
60    UuidBridge, UuidDeflect, UuidGetVar, UuidHold, UuidKill, UuidSendDtmf, UuidSetVar,
61    UuidTransfer, Variables, VariablesType,
62};
63#[cfg(feature = "esl")]
64pub use event::{
65    EslEvent, EslEventPriority, EslEventType, EventFormat, EventSubscription,
66    EventSubscriptionError, ParseEventFormatError, ParseEventTypeError, ParsePriorityError,
67};
68pub use headers::{case_alias_key, normalize_header_key, EventHeader, ParseEventHeaderError};
69pub use lookup::HeaderLookup;
70#[cfg(feature = "esl")]
71pub use lossy_values::{LossyValue, LossyValues};
72pub use sip_header::{
73    extract_header, HistoryInfo, HistoryInfoEntry, HistoryInfoError, HistoryInfoReason,
74    ParseSipHeaderAddrError, ParseSipHeaderError, SipGeolocation, SipGeolocationRef, SipHeader,
75    SipHeaderAddr, SipHeaderLookup, UriInfo, UriInfoEntry, UriInfoError,
76};
77pub use sofia::{
78    GatewayPingStatus, GatewayRegState, ParseGatewayPingStatusError, ParseGatewayRegStateError,
79    ParseSipUserPingStatusError, ParseSofiaEventSubclassError, SipUserPingStatus, SofiaChannelName,
80    SofiaEventSubclass,
81};
82#[cfg(feature = "esl")]
83pub use variables::EslHeaders;
84pub use variables::{
85    ChannelVariable, CoreMediaVariable, EslArray, EslArrayError, MultipartBody, MultipartItem,
86    ParseChannelVariableError, ParseCoreMediaVariableError, RtpStatUnit, SipHeaderPrefix,
87    SipPassthroughHeader, VariableName, MAX_ARRAY_ITEMS,
88};