#[non_exhaustive]pub struct ChannelTimetable {
pub profile_created: Option<i64>,
pub created: Option<i64>,
pub answered: Option<i64>,
pub progress: Option<i64>,
pub progress_media: Option<i64>,
pub hungup: Option<i64>,
pub transferred: Option<i64>,
pub resurrected: Option<i64>,
pub bridged: Option<i64>,
pub last_hold: Option<i64>,
pub hold_accum: Option<i64>,
}Expand description
Channel timing data from FreeSWITCH’s switch_channel_timetable_t.
Timestamps are epoch microseconds (i64). A value of 0 means the
corresponding event never occurred (e.g., hungup == Some(0) means
the channel has not hung up yet). None means the header was absent
or unparseable.
Extracted from ESL event headers using a prefix (typically "Caller"
or "Other-Leg"). The wire header format is {prefix}-{suffix},
e.g. Caller-Channel-Created-Time.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.profile_created: Option<i64>When the caller profile was created.
created: Option<i64>When the channel was created.
answered: Option<i64>When the channel was answered.
progress: Option<i64>When early media (183) was received.
progress_media: Option<i64>When media-bearing early media arrived.
hungup: Option<i64>When the channel hung up.
transferred: Option<i64>When the channel was transferred.
resurrected: Option<i64>When the channel was resurrected.
bridged: Option<i64>When the channel was bridged.
last_hold: Option<i64>Timestamp of the last hold event.
hold_accum: Option<i64>Accumulated hold time in microseconds.
Implementations§
Source§impl ChannelTimetable
impl ChannelTimetable
Sourcepub fn from_lookup<'a>(
prefix: impl AsRef<str>,
lookup: impl Fn(&str) -> Option<&'a str>,
) -> Result<Option<Self>, ParseTimetableError>
pub fn from_lookup<'a>( prefix: impl AsRef<str>, lookup: impl Fn(&str) -> Option<&'a str>, ) -> Result<Option<Self>, ParseTimetableError>
Extract a timetable by looking up prefixed header names via a closure.
The closure receives full header names (e.g. "Caller-Channel-Created-Time")
and should return the raw value if present. Works with any key-value store:
HashMap<String, String>, EslEvent, BTreeMap, etc.
Returns Ok(None) if no timestamp headers with this prefix are present.
Returns Err if a header is present but contains an invalid (non-i64) value.
use std::collections::HashMap;
use freeswitch_types::{ChannelTimetable, TimetablePrefix};
let mut headers: HashMap<String, String> = HashMap::new();
headers.insert("Caller-Channel-Created-Time".into(), "1700000001000000".into());
// With enum:
let tt = ChannelTimetable::from_lookup(TimetablePrefix::Caller, |k| headers.get(k).map(|v: &String| v.as_str()));
assert!(tt.unwrap().unwrap().created.is_some());
// With raw string (e.g. for dynamic "Call-1" prefix):
let tt = ChannelTimetable::from_lookup("Caller", |k| headers.get(k).map(|v: &String| v.as_str()));
assert!(tt.unwrap().unwrap().created.is_some());Trait Implementations§
Source§impl Clone for ChannelTimetable
impl Clone for ChannelTimetable
Source§fn clone(&self) -> ChannelTimetable
fn clone(&self) -> ChannelTimetable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChannelTimetable
impl Debug for ChannelTimetable
Source§impl Default for ChannelTimetable
impl Default for ChannelTimetable
Source§fn default() -> ChannelTimetable
fn default() -> ChannelTimetable
Source§impl<'de> Deserialize<'de> for ChannelTimetable
impl<'de> Deserialize<'de> for ChannelTimetable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ChannelTimetable
impl PartialEq for ChannelTimetable
Source§impl Serialize for ChannelTimetable
impl Serialize for ChannelTimetable
impl Copy for ChannelTimetable
impl Eq for ChannelTimetable
impl StructuralPartialEq for ChannelTimetable
Auto Trait Implementations§
impl Freeze for ChannelTimetable
impl RefUnwindSafe for ChannelTimetable
impl Send for ChannelTimetable
impl Sync for ChannelTimetable
impl Unpin for ChannelTimetable
impl UnsafeUnpin for ChannelTimetable
impl UnwindSafe for ChannelTimetable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.