Skip to content

Twilio

Syrinx terminates Twilio Media Streams directly — the μ-law 8 kHz phone audio is transcoded to PCM16 for your pipeline, and your agent’s speech is transcoded back, all inside one WebSocket per call.

Configure your Twilio phone number’s “A call comes in” webhook to POST https://<your-host>/incoming-call. Syrinx returns TwiML that bridges the PSTN leg to the /twilio media-stream endpoint:

<Response>
<Connect>
<Stream url="wss://<your-host>/twilio?sessionId=<callSid>" />
</Connect>
</Response>

The Twilio CallSid becomes the session id, so the call’s media, resume, and any recording all key off the same stable id.

Mount the Twilio media-stream handler alongside your other routes; it speaks the Media Streams protocol (connected / start / media / mark / stop) and drives a VoiceAgentSession per call.

The reference Worker binds a TwilioVoiceConversation Durable Object to /twilio — see Deploy on Cloudflare. One hibernatable Durable Object per call, no server to run.

Twilio Media Streams is μ-law (PCMU) at 8 kHz in both directions. Syrinx handles the transcode; there’s nothing to configure. For wideband audio (G.722) you’ll want Telnyx.

See Codecs, DTMF & transfer for sending DTMF and transferring calls.