Parrot.Sip.Headers.To (Parrot Platform v0.0.1-alpha.2)
Module for working with SIP To headers as defined in RFC 3261 Section 20.39.
The To header identifies the logical recipient of the request. Like the From header, it contains a URI that identifies the target of the request, an optional display name, and parameters. The tag parameter, which may be added by the UAS in responses, is a critical component for dialog identification.
The To header serves several key functions:
- Specifying the recipient of the request
- Contributing to dialog identification (when tag is present)
- Allowing recipient identification independent of the Request-URI
Initially, requests contain a To header without a tag. The UAS adds a tag parameter in responses, which then becomes part of the dialog identification as described in RFC 3261 Section 12.1.
References:
- RFC 3261 Section 8.1.1.2: To
- RFC 3261 Section 12.1: Creation of a Dialog
- RFC 3261 Section 19.3: Dialog ID Components
- RFC 3261 Section 20.39: To Header Field
Summary
Functions
Converts a To header to a string representation.
Gets a parameter from a To header.
Creates a new To header.
Creates a new To header with a tag parameter.
Parses a To header string into a To struct.
Gets the tag parameter from a To header.
Adds or updates a parameter in a To header.
Adds a tag parameter to a To header if one doesn't exist.
Types
@type t() :: %Parrot.Sip.Headers.To{ display_name: String.t() | nil, parameters: map(), uri: String.t() | Parrot.Sip.Uri.t() }
Functions
Converts a To header to a string representation.
Gets a parameter from a To header.
Creates a new To header.
Creates a new To header with a tag parameter.
Parses a To header string into a To struct.
Examples
iex> Parrot.Sip.Headers.To.parse("Bob <sip:bob@biloxi.com>;tag=a6c85cf")
%Parrot.Sip.Headers.To{display_name: "Bob", uri: %Parrot.Sip.Uri{scheme: "sip", user: "bob", host: "biloxi.com"}, parameters: %{"tag" => "a6c85cf"}}
iex> Parrot.Sip.Headers.To.parse("<sip:bob@biloxi.com>")
%Parrot.Sip.Headers.To{display_name: nil, uri: %Parrot.Sip.Uri{scheme: "sip", user: "bob", host: "biloxi.com"}, parameters: %{}}
Gets the tag parameter from a To header.
Adds or updates a parameter in a To header.
Adds a tag parameter to a To header if one doesn't exist.