sippet v0.1.8 Sippet.Proxy

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

Functions

add_record_route(request, hop)

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(request, protocol, host, port)

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(request, protocol, host, port, branch)
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.

forward_request(request)
forward_request(Sippet.Message.request) ::
  :ok |
  {:ok, client_transaction :: Sippet.Transaction.Client.t} |
  {:error, reason :: term}

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(request, request_uri)

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.

forward_response(response)

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.