Skip to main content

Voice WebSocket Protocol

Stream real-time voice call events over a persistent WebSocket connection. Use this protocol for live dashboards, call monitoring, real-time transcription displays, and custom call control interfaces.

Connection Setup

Endpoint

Authentication

Include your API key as a query parameter or in the first message after connection:
Or authenticate with an auth message after connecting:
The server responds with an auth.success or auth.error message:

SDK Connection

The SDKs handle connection, authentication, and reconnection automatically.

Message Format

All messages follow a consistent envelope format:

Message Types

call.started

Emitted when an outbound or inbound call is connected.

call.ringing

Emitted when the outbound call is ringing on the recipient’s end.

call.answered

Emitted when the recipient picks up.

call.transcription

Emitted in real-time as speech is transcribed. Segments may be partial (streaming) or final.

call.agent_response

Emitted when the agent generates a response that will be spoken.

call.dtmf

Emitted when the caller presses a key on their phone keypad (DTMF tone).

call.hold

Emitted when the call is placed on or taken off hold.

call.transfer

Emitted when the call is transferred to another number or agent.

call.sentiment

Emitted periodically with rolling sentiment analysis.

call.ended

Emitted when the call terminates for any reason.

call.error

Emitted when an error occurs during the call.

Subscribing to Specific Calls

Filter events to a specific call or agent by sending a subscribe message:
The server confirms with:

Heartbeat / Ping-Pong

The server sends a ping message every 30 seconds. The client must respond with a pong within 10 seconds or the connection will be closed.
The SDKs handle ping-pong automatically. If you are implementing a raw WebSocket client, ensure you respond to every ping.

Error Handling

Connection Errors

Reconnection Strategy

Use exponential backoff with jitter for automatic reconnection:
  1. First retry: 1 second
  2. Second retry: 2 seconds
  3. Third retry: 4 seconds
  4. Max backoff: 30 seconds
  5. Add random jitter of 0-1 seconds to each delay

Next Steps