Tap here to compare the top VoIP providersTap here to hide the top VoIP Providers
Asterisk cmd Festival
SynopsisSay text to the caller
Uses the Festival open-source speech synthesizer (which you need to have installed) to generate the specified text as a sound stream. The intkeys parameter is optional. If present, it specifies the buttons that, if dialed by the caller, will cause the playing of the sound stream to stop, and for Festival returns the button pressed. If you specify the intkeys parameter as "any", then Festival will return at the first button dialed, regardless of what it is. Please note that the intkeys parameter has to be enclosed by single quotes (') and there must not be a space between text, the comma and intkeys (see example).
The text parameter should be enclosed in quotation marks if there are any spaces.
Festival is not an application that will automatically answer the channel - so you need to do it yourself.
Exampleexten => 003,1,Answer
exten => 003,2,Festival('Hello asterisk user, how are you today?') ; <-- note the quotes ...
exten => 003,3,Festival('And an example the user can stop by pressing any key','any') ; note quotes and no spaces
Remember to Answer the channel before using the Festival command.
TipYou may get better results using the System command to access Festival's text2wave program to generate a .WAV file, and then use the Background or Playback commands, rather than using Asterisk's Festival command.
% text2wave -o myfile.ulaw -otype ulaw
Will take text from stdin and make a sound file of the text in ulaw format. You can simply use Playback(myfile) to play it through asterisk.
If you have problems with Festival seeming to drop some of the text, this may be for you. Also, if you have a lot of intensive processing (this in itself is intensive processing) you may want to spin this off into the background, and then play music or instructions for your user in the meantime. For example:
exten => s, 1, System(do_stuff &) exten => s, 2, Playback(introduction-instructions) exten => s, 3, Playback(my_new_sound) ***** do_stuff ***** #!/usr/bin/php <?php // Take care of all your processing. $data = "A lot of text or something here."; system("echo $data | text2wave -o my_new_sound.ulaw -otype ulaw -"); ?>
Something like that will allow you to do a bunch of heavy processing without forcing the user to wait on you.
- Festival: Festival open source speech synthesis software
- Installing Festival for Asterisk
- Festival Configuration
- The Dialplan - extensions.conf
Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+