Components
System inventory
- Twilio webhook
- Media WebSocket
- STT
- Turn manager
- LLM
- TTS
- Call trace
A phone call streams through telephony, speech recognition, an orchestrated LLM, and streaming speech synthesis.
Runtime flow
The flow becomes the backbone of the audit trace. Every important boundary needs an input, an output, timing, and an owner.
Twilio sends a signed POST to /api/webhooks/twilio/voice
The server validates the request, creates a session, and returns <Connect><Stream> TwiML
Twilio opens a bidirectional WSS stream carrying base64 μ-law 8 kHz mono audio
The voice gateway forwards audio to streaming STT and combines finalized segments until end-of-turn
The orchestrator runs the system prompt, RAG, tools, policy, and conversation state
Streaming model text is synthesized as μ-law 8 kHz audio and sent to Twilio media messages
Barge-in cancels stale model/TTS work and sends clear before the next turn
On stop/status callbacks, the system persists transcript, timing, tool, handoff, and outcome evidence
Components
Test packs
Evidence
Voice implementation boundary
The HTTP webhook, media WebSocket, STT, orchestration, TTS, and status callback are separate observable boundaries. A connected system can provide live traces; the Northstar reference target can provide controlled fixtures for regression tests.
POST /api/webhooks/twilio/voicereturns signed-call TwiMLWSS /media-streamreceives and sends μ-law 8 kHz media eventsPOST /api/webhooks/twilio/call-statusfinalizes the trace and outcome