SIP message serializer. Port of NkSIP's nksip_unparse.
Headers are written in a fixed order (Via, From, To, Call-ID, CSeq,
Max-Forwards, Content-Length, Route, Contact, Content-Type, Require,
Supported, Expires, Event), followed by the rest in their original order.
Content-Length is always computed from the body.
Summary
Functions
Serializes a message.
Builds the 400 Invalid <header> response for a request that failed parsing,
copying the Via, From, To, Call-ID and CSeq headers from the raw request.
Standard reason phrase for a response code.
Serializes a message as iodata.
Functions
@spec encode(Caracola.Message.t()) :: binary()
Serializes a message.
@spec error_response(Caracola.ParseError.t()) :: {:ok, binary()} | :error
Builds the 400 Invalid <header> response for a request that failed parsing,
copying the Via, From, To, Call-ID and CSeq headers from the raw request.
Returns :error if the start line could not be parsed or it was a response,
since then no reply must be sent.
@spec reason_phrase(100..699) :: String.t()
Standard reason phrase for a response code.
iex> Caracola.Serializer.reason_phrase(486)
"Busy Here"
@spec to_iodata(Caracola.Message.t()) :: iodata()
Serializes a message as iodata.