Accepts the Media-Streams websocket for an inbound call already delivered by the voice webhook.
The inbound Call SID from the webhook.
Ends the call (REST calls(sid).update({ status: 'completed' })).
The Call SID to complete.
Optionalargs: Record<string, unknown>Flushes buffered outbound audio on Twilio's side (Media Streams 'clear' event).
The Call SID whose playback buffer to clear.
Registers the call-ended callback (status-callback completed/failed/canceled or stream stop).
The Call SID.
Invoked when the call ends.
Registers the inbound DTMF callback (<Gather> webhook results or Media-Streams dtmf events).
The Call SID.
Invoked with each received DTMF digit string.
Registers the inbound Media-Streams audio callback for the call (what the agent hears).
The Call SID whose inbound stream to subscribe to.
Invoked with each inbound PCM audio frame.
IN-BAND over the media stream as synthesized tones. The REST alternative (<Play digits>) replaces the
call's TwiML, which ends <Connect><Stream> — the agent would lose the call's audio and the stream stop
would tear the whole call down. Tones go out in 20 ms frames like any other agent audio, so they queue
behind whatever the agent is already saying.
Pushes one outbound audio payload onto the call's Media-Streams websocket (the agent's voice).
The Call SID whose stream to write to.
The audio bytes (the adapter encodes to the Media-Streams μ-law/PCM media frame).
Transfers the live call (REST calls(sid).update({ twiml: '<Dial>...' })).
The Call SID to redirect.
The transfer destination.
Optional. Speaks message to the caller and then hangs up, in one carrier-side step (REST
calls(sid).update({ twiml: '<Say>…</Say><Hangup/>' })). The call is ending anyway, so replacing its TwiML
(which ends the media stream) is what we want here. When absent the SDK just completes the call.
The Call SID.
The text to speak.
Production ITwilioClientBindings over the real Twilio REST API + Media Streams, expressed against the injected ITwilioRestLike / ITwilioMediaPump surfaces so it builds and unit-tests with no
twilioinstall and no network.createCall→ RESTcalls.createwith the<Connect><Stream>TwiML.acceptInbound→ no REST call (the inbound webhook already returned the connect TwiML); the websocket for the delivered Call SID is what "accepting" means — handled by onStreamAudio.completeCall/redirectCall/playDigits→ RESTcalls(sid).update.pushStreamAudio/onStreamAudio→ Media-Streams frames, transcoded through the T0 codec.