Control and audio use separate sockets
The control WebSocket carries JSON commands and events. A dedicated media WebSocket carries the call's audio. Set media_websocket: true for an outbound bridged call; incoming accepted calls provide a media channel through their own event.
Read the correct URL
The outbound bridged event exposes payload.url:
{
"type": "CALL.MEDIA_READY",
"payload": {
"call_id": "call-id",
"url": "wss://assigned-host/media/channel?token=REDACTED",
"sample_rate": 16000,
"encoding": "pcm16-le"
}
}Inbound calls expose payload.media.ws and payload.media.protocol: "pcm16-le-binary". The starter normalizes these two supported shapes.
Media tokens are short-lived and single-use. Connect promptly to the exact URL provided by the event. Never construct a URL from an assumed host, reuse a consumed token, or log the full URL.
Exchange binary PCM
Bridged audio uses mono, signed 16-bit little-endian PCM in binary WebSocket frames. It is not WAV, MP3, Opus, or base64 JSON. Text frames carry metadata such as media.connected or media.dtmf.
mediaSocket.on('message', (frame, isBinary) => {
if (isBinary) {
// Forward PCM16-LE to your application at the negotiated rate.
onAudio(frame);
} else {
// Parse metadata separately from audio.
onMetadata(JSON.parse(frame.toString()));
}
});
// Send output from your audio application as binary PCM16-LE.
mediaSocket.send(pcmBuffer, { binary: true });At 16,000 Hz, a 20 ms mono PCM16 frame contains 320 samples, or 640 bytes. Pace output to the negotiated frame duration. Do not send a complete audio file as one huge frame. A requested 16 kHz rate does not guarantee that the underlying telephone codec is wideband.
Connect your model or speech provider
Your application must handle the provider's session configuration, audio encoding, resampling, buffering, interruption, and cleanup. The starter does not include an OpenAI or ElevenLabs adapter and does not claim that their audio APIs can be connected with .pipe().
Avoid confusing the legacy echo mode
The older unbridged echo channel reports pcm16-le-base64 and exchanges JSON media.audio messages. It is a different mode from the binary RTP bridge. The starter rejects that protocol rather than treating an echo response as a live audio bridge.
Measure the right latency
Internal frame processing, network transit, carrier delay, and full agent response time are different measurements. A local simulator or loopback result does not establish live audio latency. This site does not publish a fastest-carrier or end-to-end latency guarantee.
Local processing benchmark
On November 8, 2026, a loopback test of the media bridge measured 2,000 frames per direction across 20 runs. Each run's p95 was below 0.3 ms: RTP → WebSocket ranged from 0.043 to 0.087 ms, and WebSocket → RTP ranged from 0.125 to 0.291 ms. These are ranges of per-run percentiles, not a pooled percentile.
The test used PCMU 8 kHz RTP and mono PCM16-LE 16 kHz binary WebSockets on an unloaded local machine. It excludes Internet, TLS, carrier, playout buffering, AI processing, and concurrency load. The largest individual frame took 1.773 ms, so the headline does not mean every frame is below 0.3 ms. No competitor ranking or live-call latency guarantee follows from this result.