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`], [`SipCallInfo`], [`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
22pub mod channel;
23#[cfg(feature = "esl")]
24pub mod commands;
25#[cfg(feature = "esl")]
26pub mod event;
27pub mod headers;
28pub mod lookup;
29pub mod prelude;
30pub mod variables;
31
32/// Default FreeSWITCH ESL port for inbound connections.
33pub const DEFAULT_ESL_PORT: u16 = 8021;
34
35/// Default FreeSWITCH ESL password (`ClueCon`).
36pub const DEFAULT_ESL_PASSWORD: &str = "ClueCon";
37
38pub use channel::{
39    AnswerState, CallDirection, CallState, ChannelState, ChannelTimetable, HangupCause,
40    ParseAnswerStateError, ParseCallDirectionError, ParseCallStateError, ParseChannelStateError,
41    ParseHangupCauseError, ParseTimetableError, TimetablePrefix,
42};
43#[cfg(feature = "esl")]
44pub use commands::{
45    Application, BridgeDialString, DialString, DialplanType, Endpoint, GroupCallOrder, Originate,
46    OriginateError, OriginateTarget, ParseDialplanTypeError, ParseGroupCallOrderError, UuidAnswer,
47    UuidBridge, UuidDeflect, UuidGetVar, UuidHold, UuidKill, UuidSendDtmf, UuidSetVar,
48    UuidTransfer, Variables, VariablesType,
49};
50#[cfg(feature = "esl")]
51pub use event::{
52    EslEvent, EslEventPriority, EslEventType, EventFormat, EventSubscription,
53    EventSubscriptionError, ParseEventFormatError, ParseEventTypeError, ParsePriorityError,
54};
55pub use headers::{normalize_header_key, EventHeader, ParseEventHeaderError};
56pub use lookup::HeaderLookup;
57pub use sip_header::{
58    extract_header, HistoryInfo, HistoryInfoEntry, HistoryInfoError, HistoryInfoReason,
59    ParseSipHeaderAddrError, ParseSipHeaderError, SipCallInfo, SipCallInfoEntry, SipCallInfoError,
60    SipGeolocation, SipGeolocationRef, SipHeader, SipHeaderAddr, SipHeaderLookup,
61};
62pub use variables::{
63    ChannelVariable, CoreMediaVariable, EslArray, MultipartBody, MultipartItem,
64    ParseChannelVariableError, ParseCoreMediaVariableError, SipHeaderPrefix, SipPassthroughHeader,
65    VariableName,
66};