v160 · webrtc · replacement API
DTMF keypad (the replacement)
What call-centre and SIP softphone code used pc.createDTMFSender(track) for, done the standard way: a keypad that drives RTCRtpSender.dtmf.insertDTMF() on a real loopback call in this tab. Watch the toneBuffer drain, each tonechange event fire, and the second peer’s received audio light up as the tones arrive.
This page never calls the removed method, so it works identically on Chrome 159, Chrome 160 and other browsers. The call uses a silent Web Audio track — no microphone permission. Tones are audible only on the receiving side’s analyser; nothing plays through your speakers.
Call
Idle. Start the call to enable the keypad.
Keypad
Dial a string
- canInsertDTMF
- —
- toneBuffer
- —
- last tone
- —
0
tonechange events
No events yet.
the code
const sender = pc.addTrack(audioTrack, stream);
const dtmf = sender.dtmf; // RTCDTMFSender (null for video)
dtmf.ontonechange = ({ tone }) =>
log(tone === "" ? "buffer drained" : "playing " + tone);
key.onclick = () => {
if (!dtmf.canInsertDTMF) return; // not negotiated / not sending
// insertDTMF REPLACES the buffer, so append to keep queued digits
dtmf.insertDTMF(dtmf.toneBuffer + key.value, duration, gap);
};