Skip to main content
Key Capabilities
  • Bidirectional streaming: Send and receive audio in real-time
  • Multiple audio tracks: Stream inbound, outbound, or both tracks
  • Flexible codecs: Support for multiple audio formats and sample rates
  • Event streaming: Send playback, checkpoint, and control events via WebSocket

Audio directions

A bidirectional stream uses one WebSocket connection, but it describes incoming and outgoing audio separately:
The two directions can use different supported formats. Decode inbound media events using start.mediaFormat. Encode each outbound playAudio payload using the format declared in that event.
To play a 24 kHz TTS response, send genuine L16/24 kHz audio with playAudio.media.sampleRate: 24000. Do not set <Stream contentType="audio/x-l16;rate=24000">; contentType configures inbound audio sent to your application.

Attributes

Parameters sent to statusCallbackUrl

This information is sent to the statusCallbackUrl when an event is triggered.

Status callback events

When you configure a statusCallbackUrl, Vobiz sends HTTP POST/GET requests to that URL when specific stream lifecycle events occur. These are separate from WebSocket events and are useful for logging, monitoring, and triggering business logic.
HTTP Callbacks vs WebSocket EventsHTTP status callbacks (sent to statusCallbackUrl):
  • StartStream, PlayedStream, StopStream events
  • Sent via HTTP POST/GET to your web server
  • For logging, monitoring, and triggering workflows
WebSocket events and commands:
  • Vobiz sends start, media, playedStream, and clearedAudio
  • Your application sends playAudio, checkpoint, clearAudio, and stop
  • Sent through the WebSocket connection in real time
  • For audio streaming and real-time interaction

StartStream - stream started

Fired when the WebSocket connection is successfully established and audio streaming begins.
Example StartStream Callback

PlayedStream - checkpoint reached

Fired when audio queued before a checkpoint event has been successfully played to the caller. The Name parameter contains the checkpoint name you specified.
This event is only sent if you send a checkpoint event via WebSocket and the audio plays successfully. If playback is interrupted, this event may not fire.
Example PlayedStream Callback

StopStream - stream ended

Fired when the audio streaming session ends. This can happen due to:
  • Stream timeout (streamTimeout reached)
  • Call ended by either party
  • WebSocket connection closed
  • Network error or disconnection
Example StopStream Callback

Common parameters in all events

Example: handling status callbacks

Node.js Express Handler

Examples

Basic audio stream

Simple one-way audio stream
Streams inbound audio (default) to your WebSocket server at the specified URL.

Bidirectional audio stream

Two-way audio streaming with callbacks
Configures inbound L16 audio at 16 kHz, enables bidirectional playback, keeps the call alive during streaming, and sends status updates to your callback URL. Configure outbound playback independently in each playAudio event.

Stream both tracks with timeout

Stream inbound and outbound audio with 1-hour timeout
Streams both inbound and outbound audio for up to 1 hour, includes custom headers, and continues to subsequent XML elements after streaming ends.

Next steps

  • Audio formats: 8, 16, and 24 kHz - Choose the correct format for inbound streaming and outbound playback.
  • Initiate a Stream - Learn how to establish a WebSocket connection and start streaming audio from active calls.
  • Stream Events Overview - Understand how to send events like playAudio, clearAudio, and checkpoint via WebSocket.
  • Checkpoint Event - Send checkpoint events to confirm audio playback completion and manage event queues.
  • Play Audio Event - Transmit audio through WebSocket for bidirectional audio streaming use cases.