Skip to main content
PurposeThe stop event terminates the stream from your application’s side. When Vobiz receives it:
  • The stream stops immediately and the WebSocket closes
  • Vobiz moves to the next XML element in your response (e.g. <Speak>, <Dial>, <Redirect>)
  • If there is no next element, Vobiz hangs up the call automatically (HangupCauseCode=4010)

Attributes

Request & Response

Request Format

Send this JSON message through the WebSocket to terminate the stream:
Stop event request

Response Format

There is no inbound JSON acknowledgment for the stop event. The WebSocket close itself is your confirmation.
No inbound stop event exists. Vobiz does not send { "event": "stop" } when the call ends - the WebSocket simply closes. Do not wait for an inbound JSON reply after sending the stop command. Treat the WebSocket close event as your end-of-stream signal.
What happens after you send stop:

Examples

Complete Event Sequence

Send stop to end the stream

Node.js Implementation

Agent teardown with stop event

Python AsyncIO Example

Stop event in Python asyncio

Best Practices

Play Farewell Audio Before Stopping

Send any farewell audio and a checkpoint before the stop event. Wait for the playedStream acknowledgment so the caller hears the full goodbye message before the stream terminates.

Handle the WebSocket Close Event

Wire up a ws.on('close') handler to flush in-memory buffers (recordings, transcripts) and clean up per-call state. Do not rely on a JSON reply - the close event is your only confirmation.

Avoid Sending Events After Stop

Do not send playAudio, clearAudio, or checkpoint events after the stop command. The WebSocket closes immediately and any queued sends will be dropped.