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
| Attribute | Type | Default | Description |
|---|---|---|---|
voice | string | WOMAN | Voice tone. Allowed: WOMAN, MAN |
language | string | en-US | Language for speech. See supported languages below |
loop | integer | 1 | Number of times to repeat. 0 = infinite |
Change Voice and Language
Loop a Message
Play a message multiple times:loop="0" to repeat indefinitely until the call ends:
Supported Languages
| Language | Code | Woman | Man |
|---|---|---|---|
| Danish | da-DK | Yes | No |
| Dutch | nl-NL | Yes | Yes |
| English (Australian) | en-AU | Yes | Yes |
| English (British) | en-GB | Yes | Yes |
| English (USA) | en-US | Yes | Yes |
| French | fr-FR | Yes | Yes |
| French (Canadian) | fr-CA | Yes | No |
| German | de-DE | Yes | Yes |
| Italian | it-IT | Yes | Yes |
| Polish | pl-PL | Yes | Yes |
| Portuguese | pt-PT | No | Yes |
| Portuguese (Brazilian) | pt-BR | Yes | Yes |
| Russian | ru-RU | Yes | No |
| Spanish | es-ES | Yes | Yes |
| Spanish (USA) | es-US | Yes | Yes |
| Swedish | sv-SE | Yes | No |
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
| Tag | Description | Example |
|---|---|---|
<break> | Add a pause | <break time="500ms"/> |
<say-as> | Control pronunciation | <say-as interpret-as="spell-out">ABC</say-as> |
<prosody> | Modify pitch, rate, volume | <prosody rate="slow">Slowly</prosody> |
<emphasis> | Add emphasis | <emphasis level="strong">Important</emphasis> |
<p> | Paragraph pause | <p>First paragraph.</p> |
<s> | Sentence pause | <s>First sentence.</s> |
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
| Attribute | Type | Default | Description |
|---|---|---|---|
loop | integer | 1 | Number of times to play the audio. 0 = infinite loop |
Loop Audio
Play hold music on repeat:Supported Formats
| Format | Extension | Notes |
|---|---|---|
| MP3 | .mp3 | Recommended for smaller file sizes |
| WAV | .wav | Highest quality, larger files |
- 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
- Use HTTPS - Audio URLs must use HTTPS
- Optimize file size - Compress audio for faster loading
- Host reliably - Use a CDN for audio file hosting
- Test audio quality - Ensure audio is clear at phone quality (8kHz)
- 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
| Attribute | Type | Default | Description |
|---|---|---|---|
async | boolean | true | Send asynchronously and continue to next element |
Allowed Characters
| Character | Description |
|---|---|
0-9 | Digit tones |
* | Star key |
# | Pound/hash key |
w | Wait 0.5 seconds |
W | Wait 1 second |
With Pauses
Usew (0.5s) or W (1s) to add delays between tones:
Navigate External IVR
When dialing an external number with an IVR: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 startsDTMF Use Cases
| Scenario | Example |
|---|---|
| Enter PIN | <DTMF>1234#</DTMF> |
| Navigate IVR menu | <DTMF>1</DTMF> |
| Enter extension | <DTMF>wwww5678</DTMF> |
| Star code | <DTMF>*67</DTMF> |
Combined with Dial
When using with<Dial>, prefer sendDigits on the <Number> element:
Related
- Input Collection - GetDigits, GetInput
- Call Routing - Dial, Redirect, Hangup, Wait
- SSML Concepts - Advanced speech control