Skip to main content
This page covers the XML elements for audio output: converting text to speech, playing audio files, and sending DTMF tones.

Speak

The <Speak> element converts text to speech and plays it to the caller. Use it for dynamic messages that can’t be prerecorded.

Basic Usage

Speak Attributes

Change Voice and Language

Loop a Message

Play a message multiple times:
Set loop="0" to repeat indefinitely until the call ends:

Supported Languages

SSML Support

Speech Synthesis Markup Language (SSML) provides fine-grained control over pronunciation, pitch, rate, and pauses. Use Polly voices for SSML support.

Common SSML Tags

Speak Nesting

<Speak> can be nested inside:
  • <GetDigits> - Play message while collecting input
  • <GetInput> - Play message while collecting speech/digits
  • <PreAnswer> - Play message before answering

Play

The <Play> element plays an audio file to the caller. Use it for pre-recorded messages, music, or sound effects.

Basic Usage

Play Attributes

Loop Audio

Play hold music on repeat:

Supported Formats

Requirements:
  • Audio must be served over HTTPS
  • Maximum file size: 10 MB
  • Recommended: 8kHz or 16kHz sample rate, mono

Combine with Speak

Play During IVR

Nest <Play> inside <GetDigits> to play audio while collecting input:

Play Nesting

<Play> can be nested inside:
  • <GetDigits> - Play while collecting digits
  • <GetInput> - Play while collecting speech/digits
  • <PreAnswer> - Play before answering the call

Play Best Practices

  1. Use HTTPS - Audio URLs must use HTTPS
  2. Optimize file size - Compress audio for faster loading
  3. Host reliably - Use a CDN for audio file hosting
  4. Test audio quality - Ensure audio is clear at phone quality (8kHz)
  5. Provide fallback - Use <Speak> as backup if audio fails to load

DTMF

The <DTMF> element sends DTMF (Dual-Tone Multi-Frequency) tones on the current call. Use it to navigate IVR systems, enter PINs, or interact with telephony systems.

Basic Usage

DTMF Attributes

Allowed Characters

With Pauses

Use w (0.5s) or W (1s) to add delays between tones:
This sends 1, waits 1 second, sends 2, waits 1 second, etc. When dialing an external number with an IVR:
This is typically done using the sendDigits attribute on <Number> rather than the <DTMF> element.

Send During Call

Send tones during an active call:

Synchronous vs Asynchronous

Async (default): DTMF sends while next element starts
Sync: Wait for DTMF to complete before continuing

DTMF Use Cases

Combined with Dial

When using with <Dial>, prefer sendDigits on the <Number> element: