/asterisk-picotts

Asterisk AGI script to use SVOX Pico TTS in dialplans.

Primary LanguagePerlGNU General Public License v2.0GPL-2.0

=============================================
       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],[return_variable]): 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).
If 'return_variable' is set the script return into the variable name passed the file.

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-US)
    ;;Play message in Spanish
exten => 1234,n,agi(picotts.agi,"Esta es una simple prueba en español.",es-ES)
    ;;Play message in French
exten => 1234,n,agi(picotts.agi,"Ceci est un test simple en français.",fr-FR)

; 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-US)
    ;;Wait for digit:
exten => s,n(start),agi(picotts.agi,"Please dial a digit.",en-US,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-US,any)
exten => _X,n,WaitExten()

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

exten => t,1,agi(picotts.agi,"Request timed out.",en-US)
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.