A shim to insulate apps from WebRTC spec changes and browser prefix differences
Overall
score
98%
Build a WebRTC voice call application component that sends DTMF (touch-tone) signals over an active peer connection. The component should enable sending phone keypad tones (0-9, *, #, A-D) during a voice call, similar to what happens when you press buttons on a phone keypad during a call.
Your implementation should:
@generates
/**
* Creates a DTMF sender component for WebRTC voice calls
*
* @param {RTCPeerConnection} peerConnection - The RTCPeerConnection to use
* @returns {Object} An object with methods to manage DTMF sending
*/
function createDTMFSender(peerConnection) {
// IMPLEMENTATION HERE
}
/**
* Adds an audio track to the peer connection and prepares for DTMF
*
* @param {MediaStreamTrack} audioTrack - The audio track to add
* @returns {RTCRtpSender} The RTP sender for the audio track
*/
function addAudioTrack(audioTrack) {
// IMPLEMENTATION HERE
}
/**
* Gets the DTMF sender for the audio track
*
* @returns {RTCDTMFSender|null} The DTMF sender or null if unavailable
*/
function getDTMFSender() {
// IMPLEMENTATION HERE
}
/**
* Sends DTMF tones with specified timing
*
* @param {string} tones - The DTMF tones to send (e.g., "123", "*", "#")
* @param {number} duration - Duration of each tone in milliseconds (default: 100)
* @param {number} interToneGap - Gap between tones in milliseconds (default: 70)
* @returns {boolean} True if tones were queued successfully
*/
function sendTones(tones, duration = 100, interToneGap = 70) {
// IMPLEMENTATION HERE
}
module.exports = {
createDTMFSender,
addAudioTrack,
getDTMFSender,
sendTones
};Provides cross-browser WebRTC compatibility, including DTMF sender support for audio tracks.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-webrtc-adapterdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10