playAudio to send audio from your WebSocket application to Vobiz for playback to the caller. The stream must use bidirectional="true".
Inbound and outbound formats are independent.
start.mediaFormat describes audio Vobiz sends to your application. playAudio.media describes audio your application sends to Vobiz. The two directions can use different supported formats.Event fields
Supported outbound playback formats
For
audio/x-l16, send signed 16-bit mono samples. For both formats:
- Remove WAV, MP3, or other file-container headers before Base64 encoding.
- Generate or resample the source audio at the declared rate.
- Validate the payload in your application before sending it. A playback checkpoint confirms queue progress, not encoding correctness.
Send audio at 8, 16, or 24 kHz
The XML does not change when you change the outbound playback rate. Change both the real audio payload andmedia.sampleRate in the playAudio event.
- L16 at 8 kHz
- L16 at 16 kHz
- L16 at 24 kHz
- μ-law at 8 kHz
media events and send an outbound L16/24 kHz TTS response with playAudio.
Choose a chunk size
Send playback in approximately 20–60 ms chunks for responsive barge-in and predictable queueing. This is a recommendation, not a requirement.
For L16, calculate the raw payload size with:
clearAudio discard queued speech sooner when the caller interrupts. Keep the chunk duration and payload format consistent within an utterance.
Send playback from Node.js
audioBuffer. If your TTS provider returns a WAV or another container, extract the raw samples before calling this function.
Track playback completion
After the finalplayAudio chunk for an utterance, send a checkpoint:
- A WebSocket
playedStreamevent with the checkpoint name. - An HTTP
PlayedStreamstatus callback when you configuredstatusCallbackUrl.
clearAudio removes queued audio before the checkpoint, the completion event may not arrive. Use a timeout in your application instead of waiting indefinitely.
Sending L16/24 kHz audio to Vobiz does not guarantee 24 kHz audio at the handset. The carrier, SIP, or PSTN leg may use a lower-rate codec.