Skip to main content

Registration

Struct Registration 

Source
pub struct Registration {
    pub registrar: Uri,
    pub aor: String,
    pub contact: String,
    pub expires: Duration,
    pub call_id: String,
    pub cseq: u32,
    pub instance: Option<InstanceId>,
    pub reg_id: Option<RegId>,
    pub gruu: Option<Kind>,
    pub push: Option<Device>,
    pub headers: Vec<Header>,
}
Expand description

What to register.

Fields§

§registrar: Uri

The registrar’s URI, which is the Request-URI of the REGISTER.

§aor: String

The address of record being registered.

§contact: String

Where to reach this user agent.

§expires: Duration

How long a lease to ask for.

§call_id: String

The Call-ID, constant across refreshes.

§cseq: u32

The CSeq, increasing across refreshes.

§instance: Option<InstanceId>

The device identity this registration presents (RFC 5626 §4.1, RFC 5627 §4.1).

One field, and that is the point. Outbound and GRUU both identify the instance with the same +sip.instance media feature tag, and they must present the same value: a registrar that correlates them sees one device asking to be two. Two fields would eventually hold two values, and the resulting fault appears at the registrar rather than here — which is the worst place to discover it.

When set, the Contact carries +sip.instance.

§reg_id: Option<RegId>

Which Outbound flow this registration is (RFC 5626 §4.2), when Outbound is in use.

Together with Registration::instance it makes the Contact an Outbound one and has the REGISTER offer the outbound option tag. A reg-id without an instance is not an Outbound registration — §4.2 needs both — and is ignored rather than half-offered.

§gruu: Option<Kind>

Which GRUU this UA will use once the registrar issues them (RFC 5627 §4.4).

Some asks for one: §4.1 has the REGISTER offer the gruu option tag alongside the instance ID. None does not ask, and no registrar will volunteer.

§push: Option<Device>

How a push notification service can wake this device (RFC 8599 §4.1.2).

Beside the instance identity rather than in a story of its own, because it is the same claim: this is the device, and this is how to reach it when there is no flow. When set, the Contact URI carries pn-provider, pn-param and pn-prid — inside the angle brackets, which is where a registrar’s URI parser looks.

None registers without push, which is every client that holds a connection of its own.

§headers: Vec<Header>

Validated application-owned fields repeated on retries and refreshes.

Implementations§

Source§

impl Registration

Source

pub fn request(&self) -> Result<Request, BuildError>

Build the REGISTER request.

Note the two URIs that are easy to confuse: the Request-URI names the registrar, the To names the user. A REGISTER addressed to the user reaches nothing.

Source

pub fn contact(&self) -> String

The Contact to register: the configured one, plus whatever the instance identity adds.

+sip.instance appears exactly once, however many mechanisms want it — RFC 5626 §4.1 and RFC 5627 §4.1 name the same tag, and it is emitted from the one field that holds it.

The push parameters go on first and go inside: RFC 8599 §8.7 registers them as URI parameters, so they belong in the URI’s own grammar, while +sip.instance and reg-id are contact-params and belong after the angle brackets. Two lists, two meanings, and putting either in the other’s place produces a Contact that parses and says the wrong thing.

Source

pub fn advance(&mut self)

Advance the sequence number for the next attempt.

The Call-ID deliberately does not change: a new one makes this a new registration rather than a refresh, which leaves the old contact at the registrar until it expires.

Trait Implementations§

Source§

impl Clone for Registration

Source§

fn clone(&self) -> Registration

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 Registration

Source§

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

Formats the value using the given formatter. 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,