VonyxDocs

WebSocket audio

How call audio reaches your agent, and how your agent ends the call.

View this page as Markdown

When the call connects, Vonyx opens a WebSocket to your websocket_url and streams the call audio both ways.

Audio

SettingValues
Sample rate8000 or 16000 Hz, from sample_rate
Formataudio/x-l16 (16-bit PCM, default) or audio/x-mulaw (8-bit μ-law)

Message format

The full message reference (start, audio and stop messages) is coming soon.

Ending the call

The callee hangs up. The call ends and Vonyx closes the WebSocket.

Your agent hangs up. Send this message, and the call ends at once:

{ "event": "hangup", "hangupType": "agent_ended" }

hangupType is required. Its value is recorded as the reason the call ended.

Don't just close the socket

An unexpected close is treated as a dropped connection. Vonyx reconnects to your websocket_url up to 3 times before ending the call. Send the hangup message first.

ElevenLabs agents

With "ws_protocol": "elevenlabs", Vonyx speaks the ElevenLabs protocol. End the conversation from your agent, for example with ElevenLabs' end_call tool. The call ends when the agent closes the connection. See ElevenLabs.

On this page