<Play>
<Play>
a remote audio file.
Join our Discord community - we're here to help.
Description
The <Play>
verb plays an audio file back to the caller.
Example
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play loop="10">https://my.remote.server/cowbell.mp3</Play>
</Response>
Attributes
The following attributes are supported:
Attribute Name | Allowed Values | Default Value |
---|---|---|
answer | true , false | true |
digits | a string of characters 0 … 9 or w | None |
loop | integer >= 0 | 1 |
statusCallback | URL | none |
statusCallbackMethod | POST or GET | POST |
Attribute: answer
When set to false
, and the call was not yet answered by another operation (Dial
, for example, does not cause a call to be answered by itself - until the receiver answers the call), then the Play
verb will cause the specified media to be played using "early media" (SIP response code 183
) without answering the call.
Attribute: digits
Instead of playing an audio, play the DTMF tones corresponding to the specific digits, or play 0.5seconds of silence for a w
character. For example, specifying "1ww2ww3" will play the DTMF tones for the digits 1, 2 and 3 with 1 second of silence between each two tones.
Attribute: loop
The 'loop' attribute specifies how many times the audio file is played. The value 0
means to play the audio continously until the call is hang up.
Attribute: statusCallback
A URL to be called when the audio output has completed playing. This URL will be called with all the parameters of a standard CXML request, but its output is discarded.
Attribute: statusCallbackMethod
The HTTP method to use for the statusCallback
URL.
Nouns
The <Play>
verb accepts only text inside the verb, which must be a valid HTTP or HTTPS URL (with optional surrounding white space) that can be used to load an audio file.
The URL must be resolved to an HTTP OK response with a content-type header specifying the type of audio file in the response body. Cloudonix supports the following MIME content type specifications (whether official or not):
MIME type | Description |
---|---|
audio/mpeg | MPEG audio (either "MP3" or "MPEG 4 audio") |
audio/wav , audio/x-wav | "wav" format audio |
audio/gsm , audio/x-gsm | GSM 06.10 Full Rate audio |
audio/ulaw , audio/x-ulaw | headerless μ-law encoded 1 channel audio at 8KHz |
audio/alaw , audio/x-alaw | headerless A-law encoded 1 channel audio at 8KHz |