RTCDTMFSender: toneBuffer property
BaselineWidely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2020.
TheRTCDTMFSender
interface's toneBuffer property returns a stringcontaining a list of theDTMF tones currently queued for sending to theremote peer over theRTCPeerConnection
. To place tones into the buffer,callinsertDTMF()
.
Tones are removed from the string as they're played, so only upcoming tones are listed.
Value
A string listing the tones to be played. If the string is empty,there are no tones pending.
Exceptions
InvalidCharacterError
DOMException
Thrown if a character is not a DTMF tone character (
0-9
,A-D
,#
, or,
).
Tone buffer format
The tone buffer is a string which can contain any combination of the characters thatare permitted by the DTMF standard.
DTMF tone characters
- The digits 0-9
These characters represent the digit keys on a telephone keypad.
- The letters A-D
These characters represent the "A" through "D" keys which are part of the DTMFstandard but not included on most telephones. These arenot interpreted asdigits. Lower-case "a"-"d" automatically gets converted to upper-case.
- The pound/hash sign ("#") and the asterisk ("*")
These correspond to the similarly-labeled keys which are typically on the bottom rowof the telephone keypad.
- The comma (",")
This character instructs the dialing process to pause for two seconds before sendingthe next character in the buffer.
Note:All other characters are unrecognized and will causeinsertDTMF()
to throw anInvalidCharacterError
DOMException
.
Using tone buffer strings
For example, if you're writing code to control a voicemail system by sending DTMFcodes, you might use a string such as"*,1,5555"
. In this example, we would send"*"
torequest access to the VM system, then, after a pause, send a "1" to start playback ofvoicemail messages, then after a pause, dial "5555" as a PIN number to open themessages.
Setting the tone buffer to an empty string (""
) cancels any pending DTMFcodes.
Example
tbd
Specifications
Specification |
---|
WebRTC: Real-Time Communication in Browsers # dom-RTCDTMFSender-tonebuffer |