The Say
command provides Text-To-Speech (TTS) support. It converts text to speech and then renders it in a female voice back to the caller. Say
is useful in cases where it's difficult to pre-record a prompt for any reason. Say
can exist as a standalone command or as a nested command. It does not allow barge-in unless nested within the following commands: GetDigits
, GetSpeech
. The file will always be played to completion unless nested or if it is nested and not interrupted by barge-In. When translating text to speech, the Say
action will make assumptions about how to pronounce numbers, dates, times, amounts of money and other abbreviations.
Say
can only be done on a Call when not in Conference.
Note: Say
command always flushes the DTMF buffer.
Nesting Rules
No commands can be nested inside the Say
command. The Say
command can be nested inside the GetDigits
or GetSpeech
commands.
Examples
In the below example, the caller will hear “Welcome to FreeClimb” spoken in a female American English accent and the call ends.
[
{
"Say" : {
"text" : "Welcome to FreeClimb."
}
}
]
In the below example, the caller will hear a sentence spoken in German and then the call ends.
[
{
"Say" : {
"language" : "de-DE",
"text" : "Welche Straße kann ich nehmen?"
}
}
]
Command Attributes
Say
supports the following attributes that modify its behavior:
Attribute | Description |
---|---|
text | The message to be played to the caller using TTS. |
loop | Number of times the text is said. |
language | Language and (by implication) the locale to use. |
privacyMode | Indicates if the request contains sensitive information which should be hidden. |
text
REQUIREDType: string
The message to be played to the caller using TTS. The size of the string is limited to 4 KB (or 4,096 bytes). An empty string will cause the command to be skipped.
loop
OPTIONALType: integer >= 0
Default: 1
Number of times the text
is said. Specifying '0' causes the Say
action to loop indefinitely. If there is a Call hangup or Barge-in, a loop will end even if it has not achieved the number of times initially specified.
language
OPTIONALType: string (see table below for values)
Default: en-US
Language and (by implication) the locale to use. This implies the accent and pronunciations to be used for the TTS. The complete list of valid values for the language attribute is shown below.
Note: Language codes are case-sensitive and must be specified as shown in the table.
privacyMode
OPTIONALType: boolean
Default: false
Indicates if the request contains sensitive information which should be hidden. When set to true
, the contents of the text
attribute will be replaced with the string "xxxxx" in the logs. It's important to note that privacyMode
is set at the command level, meaning it will not inherit any value from a parent command.
Language Values
Value | Description |
---|---|
ca-ES | Catalan (Spain) |
da-DK | Danish (Denmark) |
de-DE | German (Germany) |
en-AU | English (Australia) |
en-CA | English (Canada) |
en-GB | English (United Kingdom) |
en-IN | English (India) |
en-US | English (United States) |
es-ES | Spanish (Spain) |
es-MX | Spanish (Mexico) |
fi-FI | Finnish (Finland) |
fr-CA | French (Canada) |
fr-FR | French (France) |
it-IT | Italian (Italy) |
ja-JP | Japanese (Japan) |
ko-KR | Korean (Korea) |
nb-NO | Norwegian (Norway) |
nl-NL | Dutch (Netherlands) |
pl-PL | Polish (Poland) |
pt-BR | Portuguese (Brazil) |
pt-PT | Portuguese (Portugal) |
ru-RU | Russian (Russia) |
sv-SE | Swedish (Sweden) |
zh-CN | Chinese (China) |
zh-HK | Chinese (Hong Kong) |
zh-TW | Chinese (Taiwan) |