Play audio content on the call. Supports TTS (text-to-speech), audio file URLs,
silence, and ringtone. Returns a PlayAction
that you can use to pause, resume, stop, adjust volume, or wait for completion.
This method emits calling.call.play events. See Call Events for payload details.
This method corresponds to the SWML play verb. See the
SWML play reference for the full specification.
Array of media items to play. Each item is an object with a type key and
type-specific fields:
{ type: 'tts', text: 'Hello', language: 'en-US', gender: 'female' } — text-to-speech{ type: 'audio', url: 'https://example.com/audio.mp3' } — audio file URL{ type: 'silence', duration: 2 } — silence for a duration in seconds{ type: 'ringtone', name: 'us' } — play a standard ringtoneVolume adjustment in dB, from -40.0 to 40.0.
Audio direction. Valid values:
"listen" — play to the caller only"speak" — play to the remote party only"both" — play to both sidesNumber of times to repeat the media. 0 loops indefinitely.
Custom control ID for this operation. Auto-generated if not provided.
Callback invoked when playback reaches a terminal state. Can be a regular function or async function.
Promise<PlayAction> — An action handle with
stop(), pause(), resume(), volume(), and wait() methods.