Sippet.Message.build_response
You're seeing just the function
build_response
, go back to Sippet.Message module for more information.
Specs
build_response(100..699 | Sippet.Message.StatusLine.t()) :: response() | no_return()
Returns a SIP response created from its basic elements.
The status
parameter can be a Sippet.Message.StatusLine
struct or an
integer in the range 100..699
representing the SIP response status code.
In the latter case, a default reason phrase will be obtained from a default
set; if there's none, then an exception will be raised.
Examples:
iex> resp1 = Sippet.Message.build_response 200
%Sippet.Message{body: nil, headers: %{},
start_line: %Sippet.Message.StatusLine{reason_phrase: "OK", status_code: 200,
version: {2, 0}}, target: nil}
iex> status_line = Sippet.Message.StatusLine.new(200)
iex> resp2 = status_line |> Sippet.Message.build_response
iex> resp1 == resp2
true
Specs
Returns a SIP response with a custom reason phrase.
The status_code
should be an integer in the range 100..699
representing
the SIP status code, and reason_phrase
a binary representing the reason
phrase text.
iex> Sippet.Message.build_response 400, "Bad Lorem Ipsum"
%Sippet.Message{body: nil, headers: %{},
start_line: %Sippet.Message.StatusLine{reason_phrase: "Bad Lorem Ipsum",
status_code: 400, version: {2, 0}}, target: nil}