WebSocket events
WebSocket events are lifecycle webhooks and control-plane callbacks for an audio relay between a session and your wss:// backend — started with the websocket/start command, or born with a standalone type: "websocket" session that has no phone leg. They report relay connection, termination, failure, and backend text frames. A session can have at most one relay active at a time; a second websocket/start while one is already running returns 409.
All webhook deliveries are signed. See Verifying signatures for how to validate event authenticity.
websocket.connected
Fired when your backend accepts the relay’s WebSocket connection and audio begins flowing. For a standalone WebSocket session, this is also when the session advances from connecting to answered.
Payload schema
websocket.disconnected
Fired when the relay reports a server-initiated close or error. A deliberate websocket/stop does not emit this event. On an unexpected close of a standalone WebSocket session, the session also ends, so a call.ended follows.
Payload schema
websocket.failed
Fired when the relay cannot be established — your backend is unreachable, rejects the handshake, or the connection drops before it is usable. On a standalone WebSocket session the session ends, so a call.ended follows.
Payload schema
websocket.message_received
Fired when your backend sends a text frame back over the relay. Use it for out-of-band control or metadata from your backend. To send a final text frame before closing the relay, use websocket/stop with final_text.
Payload schema
websocket.audio_playback_completed
Fired when the relay has played all the backend audio it had buffered and is now idle — useful to know your backend has finished speaking.
Payload schema
Dispatch acknowledgement events
The relay control commands each emit a short acknowledgement event. It confirms that the command was accepted, not that the audio change has taken effect. These events carry event, session_uuid, operation_uuid, and timestamp.
command.websocket.pause.accepted
Confirms dispatch of websocket/pause, which requests pausing audio in both directions while keeping the connection open. It stops sending user audio to the backend and stops playing backend audio to the session. Pausing does not flush buffered backend audio.
command.websocket.resume.accepted
Confirms dispatch of websocket/resume, which requests resuming audio in both directions. It does not unmute either leg; mute settings applied before or during the pause remain in effect.
command.websocket.mute.accepted
Confirms dispatch of websocket/mute, which requests muting a leg (user, backend, or all).
command.websocket.unmute.accepted
Confirms dispatch of websocket/unmute, which requests unmuting a leg.
command.websocket.flush.accepted
Confirms dispatch of websocket/flush, which requests discarding buffered backend audio (barge-in).
Triggered by
websocket.message_received and websocket.audio_playback_completed are backend-driven — they fire whenever your backend sends a text frame or finishes playing its buffered audio, not in response to a command.