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;
38pub mod sofia;
39pub mod variables;
40#[doc(hidden)]
41pub mod wire_safety;
42
43/// Default FreeSWITCH ESL port for inbound connections.
44pub const DEFAULT_ESL_PORT: u16 = 8021;
45
46/// Default FreeSWITCH ESL password (`ClueCon`).
47pub const DEFAULT_ESL_PASSWORD: &str = "ClueCon";
48
49pub use channel::{
50    AnswerState, CallDirection, CallState, ChannelState, ChannelTimetable, HangupCause,
51    ParseAnswerStateError, ParseCallDirectionError, ParseCallStateError, ParseChannelStateError,
52    ParseHangupCauseError, ParseTimetableError, TimetablePrefix,
53};
54#[cfg(feature = "esl")]
55pub use commands::{
56    Application, BridgeDialString, DialString, DialplanType, Endpoint, GroupCallOrder, Originate,
57    OriginateError, OriginateTarget, ParseDialplanTypeError, ParseGroupCallOrderError, UuidAnswer,
58    UuidBridge, UuidDeflect, UuidGetVar, UuidHold, UuidKill, UuidSendDtmf, UuidSetVar,
59    UuidTransfer, Variables, VariablesType,
60};
61#[cfg(feature = "esl")]
62pub use event::{
63    EslEvent, EslEventPriority, EslEventType, EventFormat, EventSubscription,
64    EventSubscriptionError, ParseEventFormatError, ParseEventTypeError, ParsePriorityError,
65};
66pub use headers::{case_alias_key, normalize_header_key, EventHeader, ParseEventHeaderError};
67pub use lookup::HeaderLookup;
68#[cfg(feature = "esl")]
69pub use lossy_values::{LossyValue, LossyValues};
70pub use sip_header::{
71    extract_header, HistoryInfo, HistoryInfoEntry, HistoryInfoError, HistoryInfoReason,
72    ParseSipHeaderAddrError, ParseSipHeaderError, SipGeolocation, SipGeolocationRef, SipHeader,
73    SipHeaderAddr, SipHeaderLookup, UriInfo, UriInfoEntry, UriInfoError,
74};
75pub use sofia::{
76    GatewayPingStatus, GatewayRegState, ParseGatewayPingStatusError, ParseGatewayRegStateError,
77    ParseSipUserPingStatusError, ParseSofiaEventSubclassError, SipUserPingStatus, SofiaChannelName,
78    SofiaEventSubclass,
79};
80#[cfg(feature = "esl")]
81pub use variables::EslHeaders;
82pub use variables::{
83    ChannelVariable, CoreMediaVariable, EslArray, EslArrayError, MultipartBody, MultipartItem,
84    ParseChannelVariableError, ParseCoreMediaVariableError, RtpStatUnit, SipHeaderPrefix,
85    SipPassthroughHeader, VariableName, MAX_ARRAY_ITEMS,
86};