Telephony.sendTones()
This API is available on Firefox OS for internal applications only.
The sendTones()
method of the Telephony
Interface generates multiple DTMF tones, with a specified duration for each tone, and an optional delay before generation starts. The tones are sent to the currently active call.
Syntax
The new syntax is promise-based:
JavaScript
Copy Code
myTelephony.sendTones(dtmfChars,pauseDuration,toneDuration,serviceId).then(function() { // do something in response });
In addition to the newly added syntax, the existing syntaxs are just regular non-promise methods without the capability of controlling the duration.
JavaScript
Copy Code
<code id="line-47">myTelephony.startTone(dtmfChar, serviceId); myTelephony.stopTone(serviceId);</code>
Parameters
dtmfChars
- A
DOMString
containing the DTMF characters to generate; these must be characters from 0-9, "*", or "+". pauseDuration
- The time to wait before sending the tones. The default value if none is specified is 3000ms. Optional
toneDuration
- The length each tone should be. The default value if none is specified is 70ms. Optional
serviceId
- The service ID, as specified in the
dom.telephony.defaultServiceId
setting. Optional
Examples
JavaScript
Copy Code
// Telephony object var tel = navigator.mozTelephony; tel.sendTones("123456789").then(function(call) { // });
Specifications
Specification | Status | Comment |
---|---|---|
Web Telephony | Draft | Draft |
Browser compatibility
For obvious reasons, support is primarily expected on mobile browsers.
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | No support | No support | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | No support | 12.0 (12.0) | 1.0.1 | No support | No support | No support |
Promise version | No support | 30.0 (30.0) | 1.4 | No support | No support | No support |
See also
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/telephony/sendtones