audioBridge.attach
subscribes the uplink track and gives you every frame in onUplink. Ask for
pcm16 at 16000 Hz. The bridge then transcodes the G.711 PSTN leg for you,
so your ASR gets exactly the audio it wants.
This is the “bring your own ASR” path. You own the recognizer and the dialog
logic. If you prefer that ClutchCall runs a managed cascade
(ASR → LLM → TTS) from one config file, see
BYO ASR / LLM / TTS instead.
Attach the bridge and feed your ASR
attach takes the call_sid, a codec/rate, and your onUplink callback.
Frames arrive as raw little-endian PCM16. A mono 20 ms frame at 16 kHz is 320
samples (640 bytes). Push each frame to your recognizer as it arrives.
- TypeScript
- Python
Transcribe an inbound call
Bind the bridge as soon as the call answers. The example below originates an outbound call with no server-side agent, so your ASR is the only consumer of the uplink. The sameattach works for an inbound sid that you already hold.
- TypeScript
- Python
Want Opus frames instead?
Your recognizer possibly takes Opus directly, or you only capture to disk. In that case, ask forcodec: "opus" and skip the transcode. The caller’s audio
then reaches you as 20 ms encoded Opus packets. Use pcm16 only when your ASR
needs raw samples.
- TypeScript
- Python
Related
Send TTS audio back
Push synthesized audio to the caller with
publishDownlink.BYO ASR / LLM / TTS
Let the runtime assemble a managed cascade from one config file.
Turn detection
VAD and barge-in: decide when a caller’s turn is over.
Sessions, calls & tracks
How
voice/<sid>/uplink and downlink tracks are addressed.
