freeswitch_types/variables/
mod.rs1mod core;
5mod esl_array;
6mod sip_call_info;
7mod sip_geolocation;
8mod sip_history_info;
9mod sip_invite;
10mod sip_multipart;
11mod sofia;
12
13pub(crate) fn split_comma_entries(raw: &str) -> Vec<&str> {
15 let mut entries = Vec::new();
16 let mut depth = 0u32;
17 let mut start = 0;
18
19 for (i, ch) in raw.char_indices() {
20 match ch {
21 '<' => depth += 1,
22 '>' => depth = depth.saturating_sub(1),
23 ',' if depth == 0 => {
24 entries.push(&raw[start..i]);
25 start = i + 1;
26 }
27 _ => {}
28 }
29 }
30 if start < raw.len() {
31 entries.push(&raw[start..]);
32 }
33
34 entries
35}
36
37pub use self::core::{ChannelVariable, ParseChannelVariableError};
38pub use esl_array::EslArray;
39pub use sip_call_info::{SipCallInfo, SipCallInfoEntry, SipCallInfoError};
40pub use sip_geolocation::{SipGeolocation, SipGeolocationRef};
41pub use sip_history_info::{HistoryInfo, HistoryInfoEntry, HistoryInfoError, HistoryInfoReason};
42
43pub use sip_invite::{ParseSipInviteHeaderError, SipInviteHeader};
44pub use sip_multipart::{MultipartBody, MultipartItem};
45pub use sofia::{ParseSofiaVariableError, SofiaVariable};
46
47pub trait VariableName {
54 fn as_str(&self) -> &str;
56}
57
58impl VariableName for ChannelVariable {
59 fn as_str(&self) -> &str {
60 ChannelVariable::as_str(self)
61 }
62}
63
64impl VariableName for SofiaVariable {
65 fn as_str(&self) -> &str {
66 SofiaVariable::as_str(self)
67 }
68}
69
70impl VariableName for SipInviteHeader {
71 fn as_str(&self) -> &str {
72 SipInviteHeader::as_str(self)
73 }
74}