Voice
How an app answers the phone and holds a realtime voice conversation, with LiveKit for media, Telnyx for telephony, and a voice worker that bridges to the model and exposes the app's methods as tools.
An app can answer the phone, place calls, and hold a realtime voice conversation in the browser, with its methods available to the conversation as tools. The media runs through LiveKit and telephony through Telnyx; a dedicated voice worker bridges the two to the realtime model providers and back to the platform. This chapter covers the components and a call's lifecycle.
#The Components
The voice worker is its own image and Deployment, a LiveKit Agents process that registers with LiveKit Cloud and receives a job per session. It imports nothing from the platform's code; the whole boundary is HTTP, typed as a wire contract that the two sides evolve together. Its lifecycle is call-shaped: surge-only rollouts, a long drain on SIGTERM so a live call finishes, and scaling on active calls.
LiveKit carries the media. A browser joins a room directly over WebRTC. A phone call arrives from Telnyx over SIP into a room. The worker joins the room as the agent.
Telnyx provides the phone numbers. The platform searches, orders, and configures numbers on the workspace's behalf, binds them to apps, sets caller-ID names, and bills monthly rental for dedicated numbers. A sandbox tier of shared numbers serves development.
The platform mints every session, holds the configuration, resolves the engine, receives tool calls, stores transcripts, and bills usage.
#Engines
A voice interface declares its engine in the manifest. Two shapes are supported: a native speech-to-speech model with a voice, or a cascaded pipeline of a language model, a speech-to-text model, a text-to-speech model, and a voice. The platform normalizes either into a canonical engine and resolves each slot against the model catalog. Slot credentials follow the workspace's vendor controls: a workspace's own key for a provider is used when present, and the platform's otherwise. The same resolution runs at build time to reject an engine that is not wired, and at billing time to price what ran.
#A Call's Lifecycle
- Mint. A browser calls the app's voice routes, or an inbound call arrives on a bound number. The platform creates the session row, with its channel recorded explicitly as web, phone-in, or phone-out, and mints a LiveKit room token whose dispatch metadata carries everything the worker needs.
- Dispatch. LiveKit dispatches a job to the worker. For an inbound call the worker first registers the call with the platform using its standing token, since no session exists yet; from then on it authenticates every request with the session's own credential.
- Configure. The worker fetches the runtime configuration: the resolved engine, the tools the interface exposes, the app's instructions, and the caller's verification state.
- Converse. The worker bridges the room's audio to the realtime model. When the model calls a tool, the worker posts the call to the platform, which runs the method through the normal execution path with the voice session as its originating identity, and returns the result to the model. Tools can be fast, slow, or background; a background tool releases the turn and resolves later.
- Transcribe. Spoken turns and tool rounds append to the session's transcript as they happen, with previews rather than full payloads for tool traffic.
- Finalize. When the call ends the worker finalizes the session; the platform closes the transcript, records duration and model usage per slot, and bills the workspace.
Outbound calls start from a method through the SDK, authenticated with the hook token, and follow the same lifecycle from dispatch.
Figure 30, "Voice": a call's path, a bridge topology. Two callers reach a LiveKit room: a browser joins over WebRTC, and a phone call arrives from Telnyx over SIP. The voice worker (the heavy node) joins the room as the agent, and bridges its audio and text to a realtime model drawn above it (two arrows, one each way): a native speech-to-speech model, or a cascaded pipeline of a language model, speech-to-text, text-to-speech, and a voice. To the right, the worker talks to the platform on a per-session credential: register, config, tool calls, transcript appends, and finalize. Each tool call drops to a method that runs with the voice session as its identity. The platform mints the session (channel: web, phone-in, or phone-out), resolves the engine, stores the transcript, and bills. A footer band carries Telnyx number management: search, order, bind to app, caller-ID, and monthly billing. A cross-reference points to Figure 15 for the execution path each tool call rides. No trust boundary is drawn in this figure, so there is no crimson.