Tropo is part of CiscoLearn More

say

Says something to the user. Unlike ask, this function has no ability to wait for a response from the user.

On voice sessions, say plays text strings using Text To Speech (TTS) and streams audio files when given URLs . Audio files can be provided in several different formats.

On SMS sessions, say will send a text string to the user via SMS. URLs to audio files will be sent as text.

Since Tropo is synchronous, say is a blocking method. This means no other method can run until say is complete.

Parameters

text

String
(Required)

In the case of a voice session, this can either be the text to be rendered by the Text to Speech Engine (may also be SSML), or a URL to an audio file to be played. In the case of a text messaging session, this will be the text to be sent to the user.

Map Parameters

allowSignals

String or Array
Default: 
* (any signal)

This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as an empty string (""), it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.

onError

Function

This registers an event handler that fires when a system error (a non-user error) occurs during audio playback.

onHangup

Function

This registers an event handler that fires when the user disconnects or hangs up.

onSignal

Function

This specifies a callback function to run if the function is interrupted by a signal. Review documentation on sending interrupts here.

voice

String
Default: 
allison

Specifies the voice to be used when speaking text back to a user.

A full list of possible voices can be found here (there's many, many options).

promptLogSecurity

String
Default: 
none

Controls whether Tropo logs the text to speech string used by the method. Possible values are "none" (the default) and "suppress", which disables output logging for this method. See Log Suppression for complete details and examples.

Examples

  say("Guess what? https://www.tropo.com/docs/troporocks.mp3", {voice:"kate"});  
say "Guess what? https://www.tropo.com/docs/troporocks.mp3", {:voice => "kate"}
<?php   
say("Guess what? https://www.tropo.com/docs/troporocks.mp3", array("voice" => "kate"));
?>
say("Guess what? https://www.tropo.com/docs/troporocks.mp3", {"voice":"kate"})
say("Guess what? https://www.tropo.com/docs/troporocks.mp3", [voice: "kate"])