<Play> verb plays an MP3 or WAV audio file, which Telnyx fetches back to the caller from the URL you configure.
Alternatively, specify mediaStorage="true" to fetch a file you previously uploaded to Telnyx using media storage APIs. When mediaStorage="true" is used the verb expects a media_name instead of a URL.
You can also use the digits attribute to play DTMF tones instead of an audio file.
The ringTone attribute generates a country-specific ringback tone instead of fetching an audio file; it cannot be combined with an audio body and is not supported inside <Conference>.
By default, a playback failure (e.g. the audio URL returns 404) aborts the TeXML script. Set continueOnError="true" to log the failure and proceed with the next verb instead.
Set failoverUrl to retry once with a backup audio source before the failure path is taken; continueOnError still applies if the failover also fails.
<Play> can be used independently as a verb or nested within <Gather> as a noun to play an audio file while waiting for DTMF tones.
Attributes
| ATTRIBUTE | DESCRIPTION | OPTIONS | DEFAULT |
|---|---|---|---|
loop | Times to repeat the audio. When used with ringTone, forwarded to FreeSWITCH as the tone_stream loops parameter; loop="0" plays the tone indefinitely until interrupted by a subsequent verb or hangup. | 1 | |
mediaStorage | When true fetches the file from Telnyx media storage using the provided media name. | true, false | false |
digits | DTMF tones to play. The value can include digits 0-9, *, #, and w (for a 0.5 second pause). When specified, the verb plays DTMF tones instead of an audio file. | - | |
failoverUrl | Backup audio source played when the primary URL fails. The mediaStorage flag also applies to this URL. Only one retry attempt is made. | - | |
continueOnError | When true, a playback failure does not abort the script. Telnyx still logs the error and continues with the next verb. | true, false | false |
ringTone | Plays a country-specific ringback tone instead of an audio file. Cannot be combined with an audio body. Not supported inside <Conference>. | at, au, bg, br, be, ch, cl, cn, cz, de, dk, ee, es, fi, fr, gr, hu, il, in, it, lt, jp, mx, my, nl, no, nz, ph, pl, pt, ru, se, sg, th, tw, ve, za, us, us-old, uk | - |