How it works
Browser ──WebRTC/Opus──▶ SFU (Go, Pion) ──gRPC PCM 16k──▶ Server (Python) ──▶ AI provider
▲ │ │
└──── WebSocket signaling ─┴────────────────────────────────┘
Phone ──Twilio Media Stream (μ-law 8k)─────────────────────────▶ Server
- Server (
python/, FastAPI): the REST API, WebSocket signaling, auth, sessions, and the audio pipeline to the AI provider. It also runs tool calls and sends webhooks. - SFU (
sfu/, Go/Pion): terminates WebRTC, decodes and encodes Opus, and resamples between 48 kHz and 16 kHz. - AI provider: Gemini Live (16 kHz in, 24 kHz out), OpenAI Realtime (24 kHz both ways), or echo.
Call lifecycle
- Your backend calls
POST /api/sessionwith an API key. It gets backsession_id, a short-livedtoken,signaling_urlandice_servers. - The browser opens
signaling_url, sends its WebRTC offer, and gets an answer. ICE connects and audio flows. - The AI listens and replies. When the caller speaks over it, the AI stops (barge-in).
- The call ends when the caller hangs up, you call
DELETE /api/session/{id}, orMAX_CALL_SECONDSruns out. Voxwire then sendscall.endedandtranscript.readyand writes the call to the call log.
Session status moves through waiting → active → ended. A session can be used for one call only.