Skip to content

VoiceML: <Play>

The <Play> action allows you to play audio on the call.

Attributes

The <Play> action supports the following attributes.

Attribute Allowed Values Default
LoopCount 1-1000 1
Digits [0-9w#*]+ none

LoopCount

The LoopCount attribute specifies the number of times to loop the audio.

Digits

The Digits attribute, if specified, plays DTMF digits over the call instead of playing audio. If specified, you cannot use any other attribute or specify an audio file.

Body

The body of an action is the content nested within the action. The following is supported for <Play>.

Type Description
plain text The URI of an audio file to play.

The following MIME types are supported.

MIME type Description
audio/mpeg MP3 audio
todo todo

Examples

Example 1: Play audio from a URL

The following example plays the sound of a rooster crowing 3 times. Perfect for a wake up call!

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play LoopCount="3">https://demo.enfonica.com/media/rooster.mp3</Play>
</Response>

Example 2: Send DTMF digits (tones)

The following example waits 1 second then plays the tones for digits 1, 2 and 3.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play Digits="ww123"/>
</Response>