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
toneStringorNumbercomposed by a single valid DTMF symbol.optionsObjectcontaining the DTMF tone with other extra parameters (see below).
Fields in options Object
duration- Positive decimal
Numberindicating the duration of the tone expressed in milliseconds. Default value is100. eventHandlers- Optional
Objectof event handlers to be registered to each DTMF tone. extraHeaders- Optional
ArrayofStringswith 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). requestJsSIP.OutgoingRequestinstance 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. responseJsSIP.IncomingResponseinstance 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. responseJsSIP.IncomingResponseinstance generating the failure for originator value ofremote, null otherwise.cause- One value of Failure and End Causes.