大网数据广告活动
Web 标准与前端开发

RTCDTMFSender: toneBuffer property

· 52CE 我爱测

The **`toneBuffer`** read-only property of the RTCDTMFSender interface returns a string containing a list of the DTMF tones currently queued for sending to the remote peer over the RTCPeerConnection. To place tones into the buffer, call RTCDTMFSender.insertDTMF.

WebRTC

The toneBuffer read-only property of the RTCDTMFSender interface returns a string containing a list of the DTMF tones currently queued for sending to the remote peer over the RTCPeerConnection. To place tones into the buffer, call RTCDTMFSender.insertDTMF.

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 that are 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 DTMF standard but not included on most telephones. These are not interpreted as digits. 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 row of the telephone keypad.
  • The comma (",")
    • : This character instructs the dialing process to pause for two seconds before sending the next character in the buffer.

[!NOTE] All other characters are unrecognized and will cause RTCDTMFSender.insertDTMF to throw an InvalidCharacterError DOMException.

Using tone buffer strings

For example, if you're writing code to control a voicemail system by sending DTMF codes, you might use a string such as "*,1,5555". In this example, we would send "*" to request access to the VM system, then, after a pause, send a "1" to start playback of voicemail messages, then after a pause, dial "5555" as a PIN number to open the messages.

Setting the tone buffer to an empty string ("") cancels any pending DTMF codes.

Example

tbd

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。