AI Voice Agents
Bridge inbound calls to an AI voice agent over a WebSocket media stream
AI Voice Agents
An AI voice agent is just another forward destination. When a number's forwardTo is a wss:// URL, Zernio bridges the call's live, bidirectional audio to that WebSocket media server instead of a phone or SIP endpoint. That is how you put Vapi, Retell, or your own agent on the line.
How it works
- Your agent platform (Vapi, Retell, or a custom media server) exposes a WebSocket endpoint that streams call audio in both directions.
- You enable voice on the number with
forwardToset to thatwss://URL. - On an inbound call, Zernio answers and streams the audio to your agent; the agent speaks back over the same socket. To the caller it is one continuous call.
await zernio.voice.enableVoiceOnNumber({
path: { id: 'PHONE_NUMBER_ID' },
body: { forwardTo: 'wss://your-agent.example.com/media' }
});curl -X POST "https://zernio.com/api/v1/phone-numbers/PHONE_NUMBER_ID/voice" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"forwardTo": "wss://your-agent.example.com/media"}'The wss:// destination works the same for inbound routing and as a per-call override on outbound calls, so you can hand a specific outbound call to an agent without changing the number's default.
Vapi and Retell
Vapi and Retell each provide a media WebSocket URL for an assistant. Use that URL as forwardTo. Configure the assistant (prompt, voice, tools) on their side; Zernio only handles the carrier leg and the audio bridge. Turn on recording or transcription in the number's voice config if you want Zernio to capture the call as well.
Custom agents
Any server that speaks the media WebSocket protocol works. Point forwardTo at your own wss:// endpoint to run a fully custom pipeline (your own speech-to-text, LLM, and text-to-speech). This is the same bidirectional-media bridge used for WhatsApp Calling, so an agent you build once can serve both channels.