stevenmirabito / asterisk-picotts

Asterisk AGI script to use SVOX Pico TTS in dialplans.
GNU General Public License v2.0
10 stars 7 forks source link

============================================= Pico TTS script for Asterisk

This script makes use of the SVOX Pico TTS engine in order to render text to speech and play it back to the user. It supports a variety of different languages.


Requirements

Perl The Perl Programming Language sox Sound eXchange, sound processing program libttspico SVOX Pico TTS engine picospeaker Command line client for Pico TTS


Installation

To install copy picotts.agi to your agi-bin directory. Usually this is /var/lib/asterisk/agi-bin/ To make sure check your /etc/asterisk/asterisk.conf file


Usage

agi(picotts.agi,"text",[language],[intkey],[speed]): This will invoke the Pico TTS engine, render the text string to speech and play it back to the user. If 'intkey' is set the script will wait for user input. Any given interrupt keys will cause the playback to immediately terminate and the dialplan to proceed to the matching extension (this is mainly for use in IVR, see README for examples).

The script invokes PicoSpeaker in order to get the voice data, which then stores in a local cache (by default /tmp/) for future use.


Examples

sample dialplan code for your extensions.conf

; Pico TTS Demo ; Play back messages to user

exten => 1234,1,Answer() ;;Play mesage in English: exten => 1234,n,agi(picotts.agi,"This is a simple google text to speech test in english.",en) ;;Play message in Spanish exten => 1234,n,agi(picotts.agi,"Esta es una simple prueba en español.",es) ;;Play message in Greek exten => 1234,n,agi(picotts.agi,"Αυτό είναι ένα απλό τέστ στα ελληνικά.",el)

; A simple dynamic IVR using Pico TTS

[my_ivr] exten => s,1,Answer() exten => s,n,Set(TIMEOUT(digit)=5) exten => s,n,agi(picotts.agi,"Welcome to my small interactive voice response menu.",en) ;;Wait for digit: exten => s,n(start),agi(picotts.agi,"Please dial a digit.",en,any) exten => s,n,WaitExten()

;;PLayback the name of the digit and wait for another one:

exten => _X,1,agi(picotts.agi,"You just pressed ${EXTEN}. Try another one please.",en,any) exten => _X,n,WaitExten()

exten => i,1,agi(picotts.agi,"Invalid extension.",en) exten => i,n,goto(s,start)

exten => t,1,agi(picotts.agi,"Request timed out.",en) exten => t,n,goto(s,start)

exten => h,1,Hangup()


License

The Pico TTS script for Asterisk is distributed under the GNU General Public License v2. See COPYING for details.