Dialog

Dialog

Class representing a SIP Dialog.

Note that instances of this class are not created directly by your code; rather they are returned from the Srf#createUAC, Srf#createUAC, and Srf#createB2BUA

Constructor

new Dialog(srf, type, opts)

Constructor that is called internally by Srf when generating a Dialog instance.

Parameters:
Name Type Description
srf Srf

Srf instance that created this dialog

type string

type of SIP dialog: 'uac', or 'uas'

opts Dialog~Options
Source:

Extends

  • EventEmitter

Members

local :Dialog~SipEndpointInfo

local side of the Dialog

Type:
Source:

remote :Dialog~SipEndpointInfo

local side of the Dialog

Type:
Source:

sip :Dialog~SipInfo

sip properties that uniquely identify this Dialog

Type:
Source:

Methods

destroy(callbackopt) → {Promise}

destroy the sip dialog by generating a BYE request (in the case of INVITE dialog), or NOTIFY (in the case of SUBSCRIBE)

Parameters:
Name Type Description
callback Dialog~requestCallback <optional>

callback that returns the generated BYE or NOTIFY message

Returns:

if no callback is supplied, otherwise the function returns a reference to the Dialog

Type
Promise
Source:

modify(sdp, callbackopt) → {Promise}

modify the dialog session by changing attributes of the media connection

Parameters:
Name Type Description
sdp string

'hold', 'unhold', or a session description protocol

callback Dialog~modifySessionCallback <optional>

callback invoked when operation has completed

Returns:

if no callback is supplied, otherwise the function returns a reference to the Dialog

Type
Promise
Source:

request(opts, callbackopt) → {Promise}

send a request within a dialog. Note that you may also call request.info(..) as a shortcut to send an INFO message, request.notify(..) to send a NOTIFY, etc..

Parameters:
Name Type Description
opts Dialog~requestOptions

configuration options

callback Dialog~requestCallback <optional>

callback invoked when operation has completed

Returns:

if no callback is supplied a Promise that resolves to the response received, otherwise the function returns a reference to the Dialog

Type
Promise
Source:

Type Definitions

modifySessionCallback(err)

This callback provides the response a modifySession request.

Parameters:
Name Type Description
err Error

non-success sip response code received from far end

Source:

Options

Arguments provided to Dialog constructor.

Type:
  • Object
Properties:
Name Type Attributes Description
req Object

drachtio Request (only provided when creating a 'uas' dialogs)

res Object

drachtio Response

sent Object <optional>

uas only: actual Response sent when confirming the dialog

Source:

requestCallback(err, req)

This callback provides the SIP request that was generated

Parameters:
Name Type Description
err Error

error returned on non-success

req Request

Request that was generated

Source:

requestCallback(err, response)

This callback provides the response to a sip request sent within the dialog.

Parameters:
Name Type Description
err Error

error, if any

response Response

response received from the far end

Source:

requestOptions

Type:
  • Object
Properties:
Name Type Attributes Description
method String

SIP method to use for the request

headers Object <optional>

SIP headers to apply to the request

body String <optional>

body of the SIP request

Source:

SipEndpointInfo

SIP Endpoint identifiers

Type:
  • Object
Properties:
Name Type Description
uri String

sip

sdp String

session description protocol

Source:

SipInfo

SIP Dialog identifiers

Type:
  • Object
Properties:
Name Type Description
callId String

SIP Call-ID

localTag String

tag generated by local side of the Dialog

remoteTag String

tag generated by the remote side of the Dialog

Source:

Events

destroy

a destroy event is triggered when the Dialog is torn down from the far end

Parameters:
Name Type Description
msg Object

incoming BYE request message

Source:

info

an info event is triggered when the far end sends an INFO message. When an application adds a handler for this event it must generate the SIP response by calling res.send on the provided drachtio response object. When no handler is found for this event a 200 OK will be automatically generated.

Parameters:
Name Type Description
req Object

drachtio request object

res Object

drachtio response object

Source:

modify

a modify event is triggered when the far end modifies the session by sending a re-INVITE. When an application adds a handler for this event it must generate the SIP response by calling res.send on the provided drachtio response object. When no handler is found for this event a 200 OK with the current local SDP will be automatically generated.

Parameters:
Name Type Description
req Object

drachtio request object

res Object

drachtio response object

Source:

notify

a notify event is triggered when the far end sends a NOTIFY message. When an application adds a handler for this event it must generate the SIP response by calling res.send on the provided drachtio response object. When no handler is found for this event a 200 OK will be automatically generated.

Parameters:
Name Type Description
req Object

drachtio request object

res Object

drachtio response object

Source:

refer

a refer event is triggered when the far end sends a REFER message. When an application adds a handler for this event it must generate the SIP response by calling res.send on the provided drachtio response object. When no handler is found for this event a 200 OK will be automatically generated.

Parameters:
Name Type Description
req Object

drachtio request object

res Object

drachtio response object

Source:

refresh

a refresh event is triggered when the far end sends a session refresh. There is no need for the application to respond to this event; this is purely a notification.

Parameters:
Name Type Description
msg Object

incoming re-INVITE request message

Source:

update

an update event is triggered when the far end sends an UPDATE message. When an application adds a handler for this event it must generate the SIP response by calling res.send on the provided drachtio response object. When no handler is found for this event a 200 OK will be automatically generated.

Parameters:
Name Type Description
req Object

drachtio request object

res Object

drachtio response object

Source: