Audio Streams
Start an Audio Stream
Fork live call audio over a WebSocket connection to your AI pipeline in near real time - configure codec, track direction, and bidirectional mode per stream.
POST
Start audio stream
stream_id.
Authentication required:
X-Auth-ID- Your account Auth IDX-Auth-Token- Your account Auth TokenContent-Type: application/json
Important: The target WebSocket URL must be reachable from Vobiz and must accept connections over
wss:// in production.Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
auth_id | string | Yes | Your Vobiz authentication ID. |
call_uuid | string | Yes | UUID of the active call to attach the stream to. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
service_url | string | Yes | WebSocket URL (wss:// or ws://) to which Vobiz forwards the call audio. Must be reachable from the public internet; use wss:// in production. |
audio_track | string | No | Track of the call to fork to the WebSocket. One of “inbound”, “outbound”, “both”. Default: “both”. When bidirectional is true, set audio_track to “inbound” - “both”/“outbound” are not supported with bidirectional. |
bidirectional | boolean | No | If true, the WebSocket may send audio back into the call using playAudio events. Default: false. |
content_type | string | No | Audio encoding format. Options: “audio/x-l16;rate=8000”, “audio/x-l16;rate=16000”, “audio/x-l16;rate=24000”, or “audio/x-mulaw;rate=8000”. Default: “audio/x-l16;rate=8000”. This value is echoed back to your server in the start.mediaFormat WebSocket event - match it in every playAudio. |
stream_timeout | integer | No | Maximum stream duration in seconds. Vobiz automatically stops the stream when this limit is reached. Default: 86400 (24 hours). |
status_callback_url | string | No | URL invoked when the stream status changes (connected, stopped, timeout, failed). |
status_callback_method | string | No | HTTP method for status_callback_url. One of “GET”, “POST”. Default: “POST”. |
extra_headers | string | No | Comma-separated list of additional HTTP headers (header:value) sent when opening the WebSocket connection. Useful for auth tokens. |
Status Callback Events
When the stream changes state, Vobiz sends a form-encoded HTTP request to yourstatus_callback_url. The Event field is one of:
Event value | Meaning |
|---|---|
StartStream | The WebSocket connected and audio is being forwarded. Carries ServiceURL. |
PlayedStream | Audio queued before a checkpoint finished playing. Carries Name. Only fires if playback completed. |
StopStream | Streaming ended. Reliably observed only for server-initiated stops - not for caller hangup or mid-call kill. |
Bidirectional Streaming
Whenbidirectional=true, your WebSocket server can send audio back to the call by sending a JSON message:
Send audio from WebSocket to call
| Field | Values |
|---|---|
contentType | audio/x-l16, audio/x-mulaw |
sampleRate | 8000, 16000, 24000 (must match the negotiated content_type) |
payload | Base64-encoded raw audio (little-endian for L16; no WAV header) |
checkpoint, clearAudio (barge-in), stop, and the inbound media/start events - see Stream Events Overview and Play Audio Event.
Response
Returns a confirmation along with the generatedstream_id.
Response - 202 Accepted
Example Request
cURL
Authorizations
Your Vobiz account Auth ID
Your Vobiz account Auth Token
Path Parameters
Your account Auth ID
Example:
"MA_XXXXXX"
Body
application/json
Response
200 - application/json
Stream started