Class JsSIP.RTCSession.DTMF
SIP INFO based DTMF.
Instance Attributes
tone
String
indicating the DTMF symbol.
duration
Number
indicating the duration of the tone expressed in milliseconds.
Instance Methods
send
(tone, options)
Sends a SIP INFO request carrying the given DTMF tone. This method is available for outgoing DTMF’s only.
Parameters
tone
String
orNumber
composed by a single valid DTMF symbol.options
Object
containing the DTMF tone with other extra parameters (see below).
Fields in options
Object
duration
- Positive decimal
Number
indicating the duration of the tone expressed in milliseconds. Default value is100
. eventHandlers
- Optional
Object
of event handlers to be registered to each DTMF tone. extraHeaders
- Optional
Array
ofStrings
with extra SIP headers for each INFO request.
Throws
Example
var tone: '2';
var options = {
'duration': 160,
'extraHeaders': [ 'X-Foo: foo', 'X-Bar: bar' ],
'eventHandlers': {
'succeeded': function(e){ /* Your code here */ }),
'failed': function(e){ /* Your code here */ }
}
};
var dtmf = new JsSIP.RTCSession.DTMF(coolPhone);
dtmf.send(tone, options);
Events
JsSIP.RTCSession.DTMF
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.
Every event handler is executed with a JsSIP.Event
instance as the only argument.
sending
Fired when the INFO request is created, before sending through the WebSocket connection and after firing UA.newDTMF
event.
Event data
fields
originator
- ‘local’
String
(local user generated the DTMF). request
JsSIP.OutgoingRequest
instance of the generated INFO request.
succeeded
Fired when receiving a final positive response to DTMF INFO request.
Event data
fields
originator
- ‘remote’
String
. Remote peer responded positively to the SIP INFO. response
JsSIP.IncomingResponse
instance of the received 2XX response.
failed
Fired if no final positive response for the sent DTMF INFO is received.
Event data
fields
originator
- ‘remote’/‘system’
String
. Where does the DTMF failure come from. response
JsSIP.IncomingResponse
instance generating the failure for originator value ofremote
, null otherwise.cause
- One value of Failure and End Causes.