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