promptTTS
promptTTS
- promptTTS(
params):Promise<CallPrompt>
Play text-to-speech while collecting user input from the call, such as digits or speech.
Parameters
Object containing the parameters for prompting the user for input while playing text-to-speech.
Text to play. SSML may be entered as a string wrapped in <speak> tags. See our supported voices and languages documentation for usage and supported tags.
Configuration for collecting digits. You must either set this, or speech. See CollectDigitsConfig.
Configuration for collecting speech. You must either set this, or digits. Pass an empty object to use the default configuration. See CollectSpeechConfig.
Language of the text in ISO 639-1 (language name) + ISO 3166 (country code). Supported languages can be found here.
Gender of the voice.
Voice to use (takes precedence over gender). Supported voices can be found here.
Initial timeout in seconds.
Volume value between -40dB and +40dB where 0 is unchanged.
Returns
Promise<CallPrompt>
A promise that resolves to a CallPrompt object that you can use to
view the current state and results of the prompt session.
Examples
Digits Example
In this example, we dial a phone number and prompt for digits while playing TTS in the background.
After the digits are entered or a timeout occurs, the prompt session will end and return the digits results,
and the call will hangup.
Speech Example
In this example, we dial a phone number and prompt for speech while playing TTS in the background.
After the user speaks or a timeout occurs, the prompt session will end and return the speech results,
and the call will hangup.
SSML Example
In this example, we are using SSML to play a TTS message.
We dial a phone number and prompt for digits while playing TTS in the background.
After the digits are entered or a timeout occurs, the prompt session will end and return the digits results,
and the call will hangup.