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