View Source Sippet (Sippet v1.0.16)

Holds the Sippet stack.

Network transport protocols should be registered during initialization:

def init(_) do
  Sippet.register_transport(:udp, false)
  ...
end

Messages are dispatched to transports by sending the following message:

send(pid, {:send_message, message, host, port, transaction})

Whenever a message is received by a transport, the function Sippet.handle_transport_message is called, which will validate and route messages through the transaction layer or send directly to the core.

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

Sippet identifier

Functions

Registers the stack core.

Registers a transport for a given protocol.

Verifies if the transport protocol used to send the given message is reliable.

Sends a message (request or response) using transactions if possible.

Handles the sigil ~K.

Terminates a client or server transaction forcefully.

Types

@type client_key() :: Sippet.Transactions.Client.Key.t()

A client transaction identifier

@type reason() :: term()

An network error that occurred while sending a message

@type request() :: Sippet.Message.request()

A SIP message request

@type response() :: Sippet.Message.response()

A SIP message response

@type server_key() :: Sippet.Transactions.Server.Key.t()

A server transaction identifier

@type sippet() :: atom()

Sippet identifier

Functions

Link to this function

register_core(sippet, module)

View Source
@spec register_core(sippet(), atom()) :: :ok

Registers the stack core.

Link to this function

register_transport(sippet, protocol, reliable)

View Source
@spec register_transport(sippet(), atom(), boolean()) ::
  :ok | {:error, :already_registered}

Registers a transport for a given protocol.

Link to this function

reliable?(sippet, message)

View Source
@spec reliable?(sippet(), Sippet.Message.t()) :: boolean()

Verifies if the transport protocol used to send the given message is reliable.

@spec send(sippet(), request() | response()) :: :ok | {:error, reason()}

Sends a message (request or response) using transactions if possible.

Requests of method :ack is sent directly to the transport layer.

A Sippet.Transactions.Client is created for requests to handle client 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.

Handles the sigil ~K.

It returns a client or server transaction key depending on the number of parameters passed.

Examples

iex> import Sippet, only: [sigil_K: 2]

iex> Sippet.Transactions.Client.Key.new("z9hG4bK230f2.1", :invite)
~K[z9hG4bK230f2.1|:invite]

iex> ~K[z9hG4bK230f2.1|INVITE]
~K[z9hG4bK230f2.1|:invite]

iex> Sippet.Transactions.Server.Key.new("z9hG4bK74b21", :invite, {"client.biloxi.example.com", 5060})
~K[z9hG4bK74b21|:invite|client.biloxi.example.com:5060]

iex> ~K[z9hG4bK74b21|INVITE|client.biloxi.example.com:5060]
~K[z9hG4bK74b21|:invite|client.biloxi.example.com:5060]
@spec terminate(sippet(), client_key() | server_key()) :: :ok

Terminates a client or server transaction forcefully.

This function is not generally executed by entities; there is a single case where it is fundamental, which is when a client transaction is in proceeding state for a long time, and the transaction has to be finished forcibly, or it will never finish by itself.

If a transaction with such a key does not exist, it will be silently ignored.