Skip to main content

SipPassthroughHeader

Struct SipPassthroughHeader 

Source
pub struct SipPassthroughHeader { /* private fields */ }
Expand description

A FreeSWITCH SIP passthrough header variable name.

Combines a SipHeaderPrefix (direction/method) with a SIP header name to produce the channel variable name used on the wire. Use with HeaderLookup::variable() for lookups, or insert into Variables for originate commands.

§Typed constructors (known SIP headers)

use freeswitch_types::variables::{SipPassthroughHeader, SipHeaderPrefix};
use sip_header::SipHeader;

let h = SipPassthroughHeader::request(SipHeader::CallInfo);
assert_eq!(h.as_str(), "sip_h_Call-Info");

let h = SipPassthroughHeader::invite(SipHeader::CallInfo);
assert_eq!(h.as_str(), "sip_i_call_info");

§Raw constructors (custom headers)

use freeswitch_types::variables::SipPassthroughHeader;

let h = SipPassthroughHeader::request_raw("X-Tenant").unwrap();
assert_eq!(h.as_str(), "sip_h_X-Tenant");

Implementations§

Source§

impl SipPassthroughHeader

Source

pub fn new(prefix: SipHeaderPrefix, header: SipHeader) -> Self

Create from a prefix and a known SipHeader.

Source

pub fn new_raw( prefix: SipHeaderPrefix, name: impl Into<String>, ) -> Result<Self, InvalidHeaderName>

Create from a prefix and an arbitrary header name.

Returns Err if the name contains \n or \r (wire injection risk).

Source

pub fn invite(header: SipHeader) -> Self

Incoming INVITE header (sip_i_*).

Source

pub fn invite_raw(name: impl Into<String>) -> Result<Self, InvalidHeaderName>

Incoming INVITE header from raw name.

Source

pub fn request(header: SipHeader) -> Self

Outgoing request header (sip_h_*).

Source

pub fn request_raw(name: impl Into<String>) -> Result<Self, InvalidHeaderName>

Outgoing request header from raw name.

Source

pub fn response(header: SipHeader) -> Self

Outgoing response header (sip_rh_*).

Source

pub fn response_raw(name: impl Into<String>) -> Result<Self, InvalidHeaderName>

Outgoing response header from raw name.

Source

pub fn provisional(header: SipHeader) -> Self

Provisional response header (sip_ph_*).

Source

pub fn provisional_raw( name: impl Into<String>, ) -> Result<Self, InvalidHeaderName>

Provisional response header from raw name.

Source

pub fn bye(header: SipHeader) -> Self

BYE request header (sip_bye_h_*).

Source

pub fn bye_raw(name: impl Into<String>) -> Result<Self, InvalidHeaderName>

BYE request header from raw name.

Source

pub fn no_bye(header: SipHeader) -> Self

Suppress header on BYE (sip_nobye_h_*).

Source

pub fn no_bye_raw(name: impl Into<String>) -> Result<Self, InvalidHeaderName>

Suppress header on BYE from raw name.

Source

pub fn prefix(&self) -> SipHeaderPrefix

The prefix (direction/method) of this variable.

Source

pub fn canonical_name(&self) -> &str

The canonical SIP header name (e.g. "Call-Info", "X-Tenant").

Source

pub fn as_str(&self) -> &str

The pre-computed wire variable name (e.g. "sip_h_Call-Info").

Source

pub fn extract_from(&self, message: &str) -> Option<String>

Extract this header’s value from a raw SIP message.

Delegates to sip_header::extract_header() using the canonical name.

Source

pub fn is_array_header(&self) -> bool

Whether this header may contain ARRAY-encoded values when read from FreeSWITCH.

Only meaningful for the Invite prefix — FreeSWITCH stores multi-valued incoming SIP headers in ARRAY::val1|:val2 format. For other prefixes (which are write-only), this always returns false.

Trait Implementations§

Source§

impl AsRef<str> for SipPassthroughHeader

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for SipPassthroughHeader

Source§

fn clone(&self) -> SipPassthroughHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SipPassthroughHeader

Source§

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

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

impl Display for SipPassthroughHeader

Source§

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

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

impl From<SipPassthroughHeader> for String

Source§

fn from(h: SipPassthroughHeader) -> Self

Converts to this type from the input type.
Source§

impl FromStr for SipPassthroughHeader

Source§

type Err = ParseSipPassthroughError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for SipPassthroughHeader

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SipPassthroughHeader

Source§

fn eq(&self, other: &SipPassthroughHeader) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl VariableName for SipPassthroughHeader

Source§

fn as_str(&self) -> &str

Wire-format variable name (e.g. "sip_call_id").
Source§

impl Eq for SipPassthroughHeader

Source§

impl StructuralPartialEq for SipPassthroughHeader

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.