Say

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:

AttributeDescription
textThe message to be played to the caller using TTS.
loopNumber of times the text is said.
languageLanguage and (by implication) the locale to use.
privacyModeIndicates if the request contains sensitive information which should be hidden.

text

REQUIRED

Type: 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

OPTIONAL

Type: 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

OPTIONAL

Type: 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

OPTIONAL

Type: 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 be inherited by any nested commands.


Language Values

ValueDescription
ca-ESCatalan (Spain)
da-DKDanish (Denmark)
de-DEGerman (Germany)
en-AUEnglish (Australia)
en-CAEnglish (Canada)
en-GBEnglish (United Kingdom)
en-INEnglish (India)
en-USEnglish (United States)
es-ESSpanish (Spain)
es-MXSpanish (Mexico)
fi-FIFinnish (Finland)
fr-CAFrench (Canada)
fr-FRFrench (France)
it-ITItalian (Italy)
ja-JPJapanese (Japan)
ko-KRKorean (Korea)
nb-NONorwegian (Norway)
nl-NLDutch (Netherlands)
pl-PLPolish (Poland)
pt-BRPortuguese (Brazil)
pt-PTPortuguese (Portugal)
ru-RURussian (Russia)
sv-SESwedish (Sweden)
zh-CNChinese (China)
zh-HKChinese (Hong Kong)
zh-TWChinese (Taiwan)