sippet v0.1.8 Sippet.Transaction

The Sippet.Transaction is responsible to dispatch messages from Sippet.Transport and Sippet.Core modules to transactions, creating when necessary.

Summary

Types

A client transaction identifier

An network error that occurred while sending a message

A SIP message request

A SIP message response

A server transaction identifier

Functions

Receives a transport error

Receives a message from the transport

Sends a request using client transactions

Sends a response to a server transaction

Sends a response to a server transaction

Starts a client transaction

Starts the transaction process hierarchy

Starts a server transaction

Types

client_transaction()
client_transaction() :: Sippet.Transaction.Client.t

A client transaction identifier

reason()
reason() :: term

An network error that occurred while sending a message

request()
request() :: Sippet.Message.request

A SIP message request

response()
response() :: Sippet.Message.response

A SIP message response

server_transaction()
server_transaction() :: Sippet.Transaction.Server.t

A server transaction identifier

Functions

receive_error(transaction, reason)
receive_error(client_transaction | server_transaction, reason) :: :ok

Receives a transport error.

The client and server identifiers are passed to the transport by the transactions. If the transport faces an error, it has to inform the transaction using this function.

receive_message(incoming_request)
receive_message(request | response) :: :ok | {:error, reason}

Receives a message from the transport.

If the message is a request, then it will look if a server transaction already exists for it and redirect to it. Otherwise, if the request method is :ack, it will redirect the request directly to Sippet.Core; if not :ack, then a new Sippet.Transaction.Server will be created.

If the message is a response, it looks if a client transaction already exists in order to handle it, and if so, redirects to it. Otherwise the response is redirected directly to the Sippet.Core. The latter is done so because of the usual SIP behavior or handling the 200 OK response retransmissions for requests with :invite method directly.

When receiving a burst of equivalent requests, it is possible that another entity has already created the server transaction, and then the function will return a {:error, reason} tuple.

In case of success, returns :ok.

send_request(outgoing_request)
send_request(request) :: :ok | {:error, reason}

Sends a request using client transactions.

Requests of method :ack shall be sent directly to Sippet.Transport. If an :ack request is detected, it returns {:error, :not_allowed}.

A Sippet.Transaction.Client is created to handle retransmissions, when the transport presumes it, and match response retransmissions, so the Sippet.Core doesn’t get retransmissions other than 200 OK for :invite requests.

In case of success, returns :ok.

send_response(outgoing_response)
send_response(response) :: :ok | {:error, reason}

Sends a response to a server transaction.

The server transaction identifier is obtained from the message attributes.

See send_response/2.

send_response(server_transaction, outgoing_response)
send_response(server_transaction, response) ::
  :ok |
  {:error, reason}

Sends a response to a server transaction.

Server transactions are created when the incoming request is received, see receive_message/1. The first parameter server_transaction indicates the reference passed to Sippet.Core when the request is received.

If there is no such server transaction, returns {:error, :no_transaction}.

In case of success, returns :ok.

start_client(transaction, outgoing_request)

Starts a client transaction.

start_link()

Starts the transaction process hierarchy.

start_server(transaction, incoming_request)

Starts a server transaction.