View on GitHub
Clone and run the full working example
Getting started
Overview
This example shows the lowest-level integration possible with Vobiz - raw WebSocket audio frames, manual VAD, direct STT/LLM/TTS API calls, and base64 audio encoding back to Vobiz. Use this when you need maximum control and minimum latency with no intermediary layers.Architecture
How it works
1
XML routing
When an inbound call hits your FastAPI webhook, respond with Vobiz XML instructing Vobiz to open a bidirectional WebSocket to your server.
2
Audio frame parsing
Vobiz sends JSON frames containing base64-encoded G.711 μ-law audio. Decode these frames into raw byte streams.
3
Streaming STT
Forward raw audio bytes to Deepgram’s streaming WebSocket for real-time transcription. As words are recognized, stream them to the LLM.
4
LLM response
Send the transcription to OpenAI’s ChatCompletions API. Response tokens stream back as they are generated.
5
TTS and playback
Synthesize tokens using a TTS engine (ElevenLabs or OpenAI). Base64-encode the resulting audio and send it back over the WebSocket to Vobiz, which plays it to the caller.
Vobiz XML hook
When to use this
Environment variables
.env