Session speak

From FreeSWITCH Wiki
Jump to: navigation, search

Uses the TTS engine to say a phrase. You must have a TTS module loaded for this to work.

Contents

Synopsis

speak(engine,voice,phrase,timer)

  • engine - the engine to use
  • voice - the name of the voice to use
  • phrase - what you want it to say
  • timer - optional timer to use (eg "soft")

in cepstral phrase can include SSML tags as well. See http://www.cepstral.com/cgi-bin/support?page=faq&type=ssml for more info

in cepstral if phrase starts with / it will open a file specified and read its contents instead of a string -- need windows specifics on path information

Example

session.speak("cepstral","David","Hello from FreeSwitch");

with callback

function my_dtmf_callback(dtmf_str, digits, args)
{
    console_log("debug", "you dialed the following " + dtmf_str + " + digits + "\n");
    return true;
}
session.speak("cepstral", "david", '<break time="500ms"/>Hello this is a test of the break tag', my_dtmf_callback);

Be sure not to put the name of the callback function in quotes.

reading a file

session.speak("cepstral","David","/etc/passwd");

See Also