Skip to main content

SessionState

Struct SessionState 

Source
#[non_exhaustive]
pub struct SessionState {
Show 20 fields pub channel_name: Option<String>, pub channel_state: Option<ChannelState>, pub call_state: Option<CallState>, pub initial_context: Option<String>, pub initial_destination: Option<String>, pub initial_caller_number: Option<String>, pub initial_caller_name: Option<String>, pub dialplan_context: Option<String>, pub dialplan_from: Option<String>, pub dialplan_to: Option<String>, pub call_direction: Option<CallDirection>, pub caller_id_number: Option<String>, pub caller_id_name: Option<String>, pub destination_number: Option<String>, pub hangup_cause: Option<HangupCause>, pub answered_at: Option<String>, pub other_leg_uuid: Option<String>, pub conference: Option<ConferenceMembership>, pub media: SessionMedia, pub variables: HashMap<String, String>, /* private fields */
}
Expand description

Mutable per-UUID state accumulator, updated as entries are processed.

Fields are None until the corresponding data is first seen in the stream. Variables accumulate from CHANNEL_DATA dumps, set()/export() executions, SET/EXPORT log lines, and inline variable_* lines.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§channel_name: Option<String>

None until a Channel-Name field is encountered.

§channel_state: Option<ChannelState>

None until a State Change line or a Channel-State field is seen.

§call_state: Option<CallState>

None until a Callstate Change line is seen. A distinct vocabulary from channel_state; neither displaces the other.

§initial_context: Option<String>

First dialplan context seen; set once and never overwritten.

§initial_destination: Option<String>

Destination of the first Processing line = the dialed number at ingress; set once and never overwritten (unlike last-wins dialplan_to).

§initial_caller_number: Option<String>

Number half of the first Processing line’s caller side, the caller profile’s caller_id_number at ingress. Set once, and first seen: a window starting mid-call pins whatever line arrived first in it.

§initial_caller_name: Option<String>

Name half of the first Processing line’s caller side. Set once on the same terms as initial_caller_number, and a rendering rather than the bytes — the line is session-bound, so the prefix stage paired off its apostrophes and consumed its backslashes.

§dialplan_context: Option<String>

Current dialplan context; updated on each transfer/continue.

§dialplan_from: Option<String>

Caller side of the last Processing line — a number, or a display name and number. None until one is seen.

§dialplan_to: Option<String>

Dialed destination of the last Processing line. None until one is seen.

§call_direction: Option<CallDirection>

Call direction from Call-Direction CHANNEL_DATA field; None until seen.

§caller_id_number: Option<String>

Caller ID number from Caller-Caller-ID-Number CHANNEL_DATA field; None until seen.

§caller_id_name: Option<String>

Caller ID name from Caller-Caller-ID-Name CHANNEL_DATA field; None until seen.

§destination_number: Option<String>

Destination number from Caller-Destination-Number CHANNEL_DATA field; None until seen.

§hangup_cause: Option<HangupCause>

Hangup cause extracted from ChannelLifecycle Hangup detail; None until hangup seen.

§answered_at: Option<String>

Timestamp when “has been answered” lifecycle event was seen; None until answered.

§other_leg_uuid: Option<String>

Other leg’s UUID; None until bridged. Set from Originate Resulted in Success on A-leg, and from New Channel on B-leg (back-pointing to A-leg via originate context).

§conference: Option<ConferenceMembership>

Conference this session is currently a member of; None once it leaves.

§media: SessionMedia

Codecs negotiated on this leg, by media type and direction.

§variables: HashMap<String, String>

All variables learned so far, with the variable_ prefix stripped from names.

Implementations§

Source§

impl SessionState

Source

pub fn variable<V: VariableName>(&self, var: V) -> Option<&str>

Value of a typed channel variable, or None if this session never saw it.

Accepts any of freeswitch-types’ variable-name enums, and spares the caller from knowing that variables keys are stored with the variable_ prefix stripped.

Source

pub fn caller_number(&self) -> Option<&str>

The caller’s number, from the most trustworthy source this session saw: the dump’s Caller-Caller-ID-Number, then sip_from_user, then the first Processing line’s number half.

Whether a leg dumps depends on the box’s dialplan and log verbosity, so the lower rungs are what answer for the legs that never do.

Not on SessionSnapshot, which carries no variables and so cannot walk the middle rung.

Source

pub fn callee_number(&self) -> Option<&str>

The dialed number, on the same terms as caller_number: the dump’s Caller-Destination-Number, then sip_to_user, then the first Processing line’s destination.

Trait Implementations§

Source§

impl Clone for SessionState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SessionState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.