Sippet v0.3.4 Sippet.Proxy
Defines very basic operations commonly used in SIP Proxies.
Summary
Functions
Adds a Record-Route header to the request
Adds a Via header to the request
Adds a Via header to the request with a supplied branch
Forwards the request
Forwards the request to a given request_uri
Forwards a response
Forwards a response using an existing server transaction key
Types
on_request_sent :: :ok | {:ok, client_key :: Sippet.Transactions.Client.Key.t} | {:error, reason :: term} | no_return
Functions
add_record_route(Sippet.Message.request, Sippet.URI.t) :: Sippet.Message.request
Adds a Record-Route header to the request.
When a proxy wishes to remain on the path of future requests in a dialog created by this request (assuming the request creates a dialog), it inserts a Record-Route header field value in the request, before forwarding.
The indicated hop
parameter should indicate the destination where requests
and responses in a dialog should pass. The hop
SIP-URI will get a "lr"
parameter, if it does not have one, and will be placed as the first header
value.
add_via(Sippet.Message.request, Sippet.Message.protocol, host :: String.t, dport :: integer) :: Sippet.Message.request
Adds a Via header to the request.
A proxy must insert a Via header field value before the existing request Via
header field values. A "branch"
parameter will be randomly computed as
being a 72-bit random string starting with the magic cookie "z9hG4bK"
.
add_via(Sippet.Message.request, Sippet.Message.protocol, host :: String.t, dport :: integer, branch :: String.t) :: Sippet.Message.request
Adds a Via header to the request with a supplied branch
.
A proxy must insert a Via header field value before the existing request Via
header field values. If the branch
parameter does not start with the magic
cookie "z9hG4bK"
, it will be added.
Forwards the request.
If the method is :ack
, the request will be sent directly to the network transport.
Otherwise, a new client transaction will be created.
This function will honor the start line request_uri
.
forward_request(Sippet.Message.request, Sippet.URI.t) :: on_request_sent
Forwards the request to a given request_uri
.
If the method is :ack
, the request will be sent directly to the network transport.
Otherwise, a new client transaction will be created.
This function will override the start line request_uri
with the supplied one.
Forwards a response.
The topmost Via header of the response is removed before forwarding.
The response will find its way back to an existing server transaction, if one exists, or will be sent directly to the network transport otherwise.
forward_response(Sippet.Message.response, Sippet.Transactions.Server.Key.t) :: on_response_sent
Forwards a response using an existing server transaction key.
See forward_response/1
.