Sippet.Message.build_request
You're seeing just the function
build_request
, go back to Sippet.Message module for more information.
Specs
Returns a SIP request created from its basic elements.
If the method
is a binary and is a known method, it will be converted to
a lowercase atom; otherwise, it will be stored as an uppercase string. If
method
is an atom, it will be just kept.
If the request_uri
is a binary, it will be parsed as a Sippet.URI
struct.
Otherwise, if it's already a Sippet.URI
, it will be stored unmodified.
The newly created struct has an empty header map, and the body is nil
.
Examples:
iex> req1 = Sippet.Message.build_request(:invite, "sip:foo@bar.com")
%Sippet.Message{body: nil, headers: %{},
start_line: %Sippet.Message.RequestLine{method: :invite,
request_uri: %Sippet.URI{authority: "foo@bar.com", headers: nil,
host: "bar.com", parameters: nil, port: 5060, scheme: "sip",
userinfo: "foo"}, version: {2, 0}}, target: nil}
iex> req2 = Sippet.Message.build_request("INVITE", "sip:foo@bar.com")
iex> request_uri = Sippet.URI.parse!("sip:foo@bar.com")
iex> req3 = Sippet.Message.build_request("INVITE", request_uri)
iex> req1 == req2 and req2 == req3
true