1) apt-get install festival # install it with apt or yum
2) nano /etc/festival.scm # modify some configs on how to parse the audio files
3) Add the following inside this file (below), check to ensure the texts are properly copied, i had issues with that causing festival not to start and listen on TCP port 1314.
5) cp /usr/share/doc/festival/examples/festival.init /etc/init.d/festival
6) chmod +x /etc/init.d/festival
7) update-rc.d festival defaults
8) nano /etc/default/festival # add the line below inside
9) RUN_FESTIVAL=yes
10) nano /etc/asterisk/festival.conf # configure asterisk to use festival, make sure that cache directory exists and permission are okay
[general]
host=localhost
port=1314
usecache=yes
cachedir=/var/cache/asterisk/festival/
festivalcommand=(tts_textasterisk "%s" 'file)(quit)\n
11) /etc/init.d/festival start # start festival
12) netstat -an |grep 1314 # it must exist with TCP listening on 0.0.0.0, otherwise, can try starting it manually to see any error # /usr/bin/festival --server --script /etc/festival.scm this is also good for debugging if the text file is sent to the festival server from asterisk
12) Now, create some dialplans in /etc/asterisk/extensions.conf or anywhere related (like in freepbx would be /etc/asterisk/extension_custom.conf)
[test1]
exten => 555,1,Answer
exten => 555,2,Festival(My Name is Festival) ; do NOT use quotes around the string! if you use commas, you will have to escape them with a "\" (backslash).
exten => 555,3,Hangup
13) Remember to restart asterisk at least once for all these to work, as we are loading the calendar module and dialplans in it.
2) nano /etc/festival.scm # modify some configs on how to parse the audio files
3) Add the following inside this file (below), check to ensure the texts are properly copied, i had issues with that causing festival not to start and listen on TCP port 1314.
;; Enable access to localhost (needed by debian users)4) Copy the init script (so it will auto run next time you reboot)
(set! server_access_list '("localhost\\.localdomain" "localhost"))
;; set italian voice (comment the following 2 lines to use british_american)
;;; Command for Asterisk begin
(define (tts_textasterisk string mode)
"(tts_textasterisk STRING MODE)
Apply tts to STRING. This function is specifically designed for
use in server mode so a single function call may synthesize the string.
This function name may be added to the server safe functions."
(let ((wholeutt (utt.synth (eval (list 'Utterance 'Text string)))))
(utt.wave.resample wholeutt 8000)
(utt.wave.rescale wholeutt 5)
(utt.send.wave.client wholeutt)))
;;; Command for Asterisk end
5) cp /usr/share/doc/festival/examples/festival.init /etc/init.d/festival
6) chmod +x /etc/init.d/festival
7) update-rc.d festival defaults
8) nano /etc/default/festival # add the line below inside
9) RUN_FESTIVAL=yes
10) nano /etc/asterisk/festival.conf # configure asterisk to use festival, make sure that cache directory exists and permission are okay
[general]
host=localhost
port=1314
usecache=yes
cachedir=/var/cache/asterisk/festival/
festivalcommand=(tts_textasterisk "%s" 'file)(quit)\n
11) /etc/init.d/festival start # start festival
12) netstat -an |grep 1314 # it must exist with TCP listening on 0.0.0.0, otherwise, can try starting it manually to see any error # /usr/bin/festival --server --script /etc/festival.scm this is also good for debugging if the text file is sent to the festival server from asterisk
12) Now, create some dialplans in /etc/asterisk/extensions.conf or anywhere related (like in freepbx would be /etc/asterisk/extension_custom.conf)
[test1]
exten => 555,1,Answer
exten => 555,2,Festival(My Name is Festival) ; do NOT use quotes around the string! if you use commas, you will have to escape them with a "\" (backslash).
exten => 555,3,Hangup
13) Remember to restart asterisk at least once for all these to work, as we are loading the calendar module and dialplans in it.
0 comments: