Skip to main content

freeswitch_types/
lib.rs

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