Class JsSIP.Options

SIP OPTIONS capabilities querying.

Instance Attributes

direction

String indicating who sent the OPTIONS. Possible values are ‘incoming’ when the OPTIONS is sent by the remote peer or ‘outgoing’ when the OPTIONS is sent by the local user.

local_identity

JsSIP.NameAddrHeader instance indicating the local identity. It corresponds with the OPTIONS From header value when the direction is ‘outgoing’, and with the To header value when the direction is ‘incoming’

remote_identity

JsSIP.NameAddrHeader instance indicating the remote identity. It corresponds with the OPTIONS To header value when the direction is ‘outgoing’, and with the From header value when the direction is ‘incoming’

Instance Methods

send(target, body, options=null)

Sends the SIP OPTIONS request through the WebSocket connection. This method is available for outgoing requests only.

Parameters

target
Destination of the request. String representing a destination username or a complete SIP URI.
body
Optional Options content. String representing the body of the request.
options
Optional Object with extra parameters (see below).

Fields in options Object

contentType
Optional String representing the content-type of the body. Default application/sdp.
eventHandlers
Optional Object of event handlers to be registered to each message event. Define an event handler for each event you want to be notified about.
extraHeaders
Array of Strings with extra SIP headers for the OPTIONS request.

Example


var eventHandlers = {
  'succeeded': function(e){ /* Your code here */ },
  'failed':    function(e){ /* Your code here */ };
};

var options = {
  'eventHandlers': eventHandlers
};

coolPhone.sendOptions('sip:bob@example.com', null, options);

accept(options)

Responds positively to the incoming OPTIONS. Indicates the sender that it has been delivered to the destination. This method is available for incoming messages only.

Parameters

options
Optional Object with extra parameters (see below).

Fields in options Object

extraHeaders
Array of Strings with extra SIP headers for the OPTIONS request.
body
String representing the SIP message body.

reject(options)

Responds negatively to the incoming OPTIONS. Indicates the sender that it has not been delivered to the destination. The response code and reason determinte the rejection cause. This method is available for incoming messages only.

Parameters

options
Optional Object with extra parameters (see below).

Fields in options Object

extraHeaders
Array of Strings with extra SIP headers for the OPTIONS request.
status_code
Number between 300 and 699 representing the SIP response code.
reason_phrase
String representing the SIP reason phrase.
body
String representing the SIP message body.

Events

JsSIP.Options class defines a series of events. Each of them allows callback functions registration in order to let the user execute a handler for each given stimulus.

succeeded

Fired when receiving a final positive response to OPTIONS request.

Event data fields

originator
‘remote’ String. Remote peer responded positively to the SIP OPTIONS.
response
JsSIP.IncomingResponse instance of the received 2XX response.

failed

Fired if no final positive response for the sent OPTIONS is received.

Event data fields

originator
‘remote’/‘system’ String. Where does the OPTIONS failure come from.
response
JsSIP.IncomingResponse instance generating the failure for originator value of remote, null otherwise.
cause
One value of Failure and End Causes.