Play
The <Play> verb plays an audio file, which SignalWire fetches from the URL you configured, back to the caller.
An example of an audio file set to loop 15 times:
An example which plays an RTMP stream into the call:
Verb attributes
The digits attribute allows you to play DTMF tones throughout a call. If pauses are required in between your DTMF tones, the character w can be used. w adds a pause of 0.5 seconds for each occurrence, so www would render a pause of 1.5 seconds. Note that this attribute simply plays tones into a call. To enter an extension when making a call, use the sendDigits attribute for the noun <Number> of the verb <Dial>.
The loop attribute determines how many times an audio file is played. If loop is set to 0, <Play> will continue looping until the call has ended.
Nouns
The noun of an XML verb is nested within the verb upon which the verb acts. <Play> has the following noun:
MIME types
The following are the MIME types supported by SignalWire:
Nesting
No other verbs can be nested within <Play>. However, <Play> can be nested within <Gather>. In this case, the verb attribute digits is not supported.
Examples
Play a simple audio file
The simplest case for <Play>: SignalWire downloads the specified audio file and plays it to the caller.
Use DTMF tones in calls
As described in the attributes section, the character w produces a 0.5 second pause. In this example, SignalWire will wait 2.5 seconds before playing the digit ‘9’.
Notes on usage
- Audio files that are longer than 40 minutes should be split into smaller files, as it may result in a dropped call.
- Since it takes some time to download and cache files from your server, slight delays may occur the first time an audio file is played. In this case, SignalWire may play a tone during download.
- SignalWire attempts to cache files only when allowed by HTTP headers (ETag and Last-Modified). Always check for a new version of the file with a response of
Cache-Control: no-cache. This enables your server to respond with a new version, or with a ‘304 Not Modified’, which tells SignalWire to use the cached version. - The degradation that occurs when transcoding high bitrate, lossy encoded files, such as 128kbps MP3 files, can take a long time, resulting in audio that sounds worse than those in lossless 8kbps formats.
- SignalWire transcodes all audio files into a format that is identifiable by the telephone network. Telephones typically do not support high bitrate audio, so playback results in lower-quality audio.