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.
Source:
Parameters:
Name Type Description
srf Srf Srf instance that created this dialog
type string type of SIP dialog: 'uac', or 'uas'
opts Dialog~Options

Extends

  • EventEmitter

Members

local :Dialog~SipEndpointInfo

local side of the Dialog
Source:
Type:

remote :Dialog~SipEndpointInfo

local side of the Dialog
Source:
Type:

sip :Dialog~SipInfo

sip properties that uniquely identify this Dialog
Source:
Type:

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)
Source:
Parameters:
Name Type Attributes Description
callback Dialog~requestCallback <optional>
callback that returns the generated BYE or NOTIFY message
Returns:
Type:
Promise
if no callback is supplied, otherwise the function returns a reference to the Dialog

modify(sdp, callbackopt) → {Promise}

modify the dialog session by changing attributes of the media connection
Source:
Parameters:
Name Type Attributes Description
sdp string 'hold', 'unhold', or a session description protocol
callback Dialog~modifySessionCallback <optional>
callback invoked when operation has completed
Returns:
Type:
Promise
if no callback is supplied, otherwise the function returns a reference to the Dialog

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..
Source:
Parameters:
Name Type Attributes Description
opts Dialog~requestOptions configuration options
callback Dialog~requestCallback <optional>
callback invoked when operation has completed
Returns:
Type:
Promise
if no callback is supplied a Promise that resolves to the response received, otherwise the function returns a reference to the Dialog

Type Definitions

modifySessionCallback(err)

This callback provides the response a modifySession request.
Source:
Parameters:
Name Type Description
err Error non-success sip response code received from far end

Options

Arguments provided to Dialog constructor.
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:
Type:
  • Object

requestCallback(err, req)

This callback provides the SIP request that was generated
Source:
Parameters:
Name Type Description
err Error error returned on non-success
req Request Request that was generated

requestCallback(err, response)

This callback provides the response to a sip request sent within the dialog.
Source:
Parameters:
Name Type Description
err Error error, if any
response Response response received from the far end

requestOptions

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:
Type:
  • Object

SipEndpointInfo

SIP Endpoint identifiers
Properties:
Name Type Description
uri String sip
sdp String session description protocol
Source:
Type:
  • Object

SipInfo

SIP Dialog identifiers
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:
Type:
  • Object

Events

destroy

a destroy event is triggered when the Dialog is torn down from the far end
Source:
Parameters:
Name Type Description
msg Object incoming BYE request message

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.
Source:
Parameters:
Name Type Description
req Object drachtio request object
res Object drachtio response object

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.
Source:
Parameters:
Name Type Description
req Object drachtio request object
res Object drachtio response object

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.
Source:
Parameters:
Name Type Description
req Object drachtio request object
res Object drachtio response object

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.
Source:
Parameters:
Name Type Description
req Object drachtio request object
res Object drachtio response object

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.
Source:
Parameters:
Name Type Description
msg Object incoming re-INVITE request message

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.
Source:
Parameters:
Name Type Description
req Object drachtio request object
res Object drachtio response object