The insertDTMF()
method on the RTCDTMFSender
interface starts sending DTMF tones to the remote peer over the RTCPeerConnection
.
Sending of the tones is performed asynchronously, with tonechange
events sent to the RTCDTMFSender
every time a tone starts or ends.
As long as the connection is active, you can send tones at any time. Calling insertDTMF()
replaces any already-pending tones from the toneBuffer
. You can abort sending queued tones by specifying an empty string (""
) as the set of tones to play. Since insertDTMF()
replaces the tone buffer, in order to add to the DTMF tones being played, it is necessary to call insertDTMF
with a string containing both the remaining tones (stored in the toneBuffer
) and the new tones appended together.