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//! # Upcoming changes in 0.20
12//!
13//! The general-purpose SIP header parsing functionality has been extracted to the
14//! standalone [`sip-header`](https://crates.io/crates/sip-header) crate. In version 0.20,
15//! module paths will change and some types will be re-exported rather than defined locally.
16//!
17//! To prepare for 0.20, use the crate-root re-exports rather than module paths:
18//!
19//! - `freeswitch_types::SipCallInfo` instead of `freeswitch_types::variables::SipCallInfo`
20//! - `freeswitch_types::SipHeaderAddr` instead of `freeswitch_types::sip_header_addr::SipHeaderAddr`
21//! - `freeswitch_types::HistoryInfo` instead of `freeswitch_types::variables::HistoryInfo`
22//! - `freeswitch_types::SipGeolocation` instead of `freeswitch_types::variables::SipGeolocation`
23//!
24//! Code importing these types from crate-root re-exports will continue to work across the
25//! 0.19 → 0.20 transition. Code importing from module paths may break when those modules
26//! are removed or reorganized.
27
28#[macro_use]
29mod macros;
30
31pub use sip_uri;
32
33pub mod channel;
34#[cfg(feature = "esl")]
35pub mod commands;
36pub mod conference_info;
37#[cfg(feature = "esl")]
38pub mod event;
39pub mod headers;
40pub mod lookup;
41pub mod prelude;
42pub mod sip_header;
43pub mod sip_header_addr;
44pub mod sip_message;
45pub mod variables;
46
47/// Default FreeSWITCH ESL port for inbound connections.
48pub const DEFAULT_ESL_PORT: u16 = 8021;
49
50/// Default FreeSWITCH ESL password (`ClueCon`).
51pub const DEFAULT_ESL_PASSWORD: &str = "ClueCon";
52
53pub use channel::{
54    AnswerState, CallDirection, CallState, ChannelState, ChannelTimetable, HangupCause,
55    ParseAnswerStateError, ParseCallDirectionError, ParseCallStateError, ParseChannelStateError,
56    ParseHangupCauseError, ParseTimetableError, TimetablePrefix,
57};
58#[cfg(feature = "esl")]
59pub use commands::{
60    Application, BridgeDialString, DialString, DialplanType, Endpoint, GroupCallOrder, Originate,
61    OriginateError, OriginateTarget, ParseDialplanTypeError, ParseGroupCallOrderError, UuidAnswer,
62    UuidBridge, UuidDeflect, UuidGetVar, UuidHold, UuidKill, UuidSendDtmf, UuidSetVar,
63    UuidTransfer, Variables, VariablesType,
64};
65#[cfg(feature = "esl")]
66pub use event::{
67    EslEvent, EslEventPriority, EslEventType, EventFormat, EventSubscription,
68    EventSubscriptionError, ParseEventFormatError, ParseEventTypeError, ParsePriorityError,
69};
70pub use headers::{normalize_header_key, EventHeader, ParseEventHeaderError};
71pub use lookup::HeaderLookup;
72pub use sip_header::{ParseSipHeaderError, SipHeader, SipHeaderLookup};
73pub use sip_header_addr::{ParseSipHeaderAddrError, SipHeaderAddr};
74pub use sip_message::extract_header;
75pub use variables::{
76    ChannelVariable, EslArray, HistoryInfo, HistoryInfoEntry, HistoryInfoError, HistoryInfoReason,
77    MultipartBody, MultipartItem, ParseChannelVariableError, SipCallInfo, SipCallInfoEntry,
78    SipCallInfoError, SipGeolocation, SipGeolocationRef, VariableName,
79};