Class OverSIP::SIP::UacRequest

NEW in 1.3.x

An instance of the OverSIP::SIP::UacRequest class contains a locally generated SIP request for being sent via a OverSIP::SIP::Uac instance.

Class instance methods

initialize(data, extra_headers=[], body=nil)

Initializer method for the OverSIP::SIP::UacRequest instance.

Parameters

data
A Hash with data for building the SIP request.
Mandatory fields are :sip_method (Symbol or String) and :ruri (a String, a OverSIP::SIP::Uri or a OverSIP::SIP::NameAddr).
Optional fields are :from and :to (a String, a OverSIP::SIP::Uri or a OverSIP::SIP::NameAddr), :from_tag and :to_tag (String), :call_id (String), :cseq (Fixnum) and :max_forwards (Fixnum).
extra_header
An Array of extra headers (Strings) to append to the request.
body
Body (String) for the request.

Examples

uac_request = OverSIP::SIP::UacRequest.new(
  {
    :sip_method => :OPTIONS,
    :ruri => "sip:server@example.net",
    :from => "sip:uac@oversip.net"
  }
)
uac_request = OverSIP::SIP::UacRequest.new(
  {
    :sip_method => :MESSAGE,
    :ruri => OverSIP::SIP::Uri.new(:sip, "alice", "example.net")
  },
  [ "Content-Type: text/plain" ],
  "Hi Alice, I'm processing a call from #{request.from.uri}"
)

tvars

Transaction variables. A Hash for storing custom key / values associated to the client transaction initiated by OverSIP if this request is sent. The same Hash can be later retrieved from the SIP responses replied by peers for this request via the same instance method tvars of the OverSIP::SIP::Response class.