Page 333 - Asterisk™: The Future of Telephony
P. 333
Once you’re sure that the Festival server is running and not rejecting your connections,
you can start Festival by typing:
[root@asterisk ~]# festival_server 2>&1 >/dev/null &
Calling Festival from the Dialplan
Now that Festival is configured and the Festival server is started, let’s call it from within
a simple dialplan:
exten => 123,1,Answer()
exten => 123,2,Festival(Asterisk and Festival are working together)
You should always call the Answer() application before calling
Festival(), to ensure that a channel is established.
As Asterisk connects to Festival, you should see output like this in the terminal where
you started the Festival server:
[root@asterisk ~]# festival --server
server Sun May 1 18:38:51 2005 : Festival server started on port 1314
client(1) Sun May 1 18:39:20 2005 : accepted from asterisk.localdomain
client(1) Sun May 1 18:39:21 2005 : disconnected
If you see output like the following, it means you didn’t add the host to the access list
in festival.scm:
[root@asterisk ~]# festival --server
server Sun May 1 18:30:52 2005 : Festival server started on port 1314
client(1) Sun May 1 18:32:32 2005 : rejected from asterisk.localdomain not
in access list
Yet Another Way to Use Festival with Asterisk
Some people in the Asterisk community have reported success with passing text to
Festival’s text2wave utility and then having Asterisk play back the resulting .wav file.
For example, you might do something like this:
exten => 124,1,Answer()
exten => 124,2,System(echo "This is a test of Festival" | /usr/bin/text2wave
-scale 1.5 -F 8000 -o /tmp/festival.wav)
exten => 124,3,Playback(/tmp/festival)
exten => 124,4,System(rm /tmp/festival.wav)
exten => 124,5,Hangup()
This method also allows you to call other text-to-speech engines, such as the popular
speech engine from Cepstral http://www.cepstral.com, which is an inexpensive com-
mercial derivative of Festival with very good-sounding voices. For this example, we’ll
assume that Cepstral is installed in /usr/local/cepstral/:
exten => 125,1,Answer()
exten => 125,2,System(/usr/local/cepstral/bin/swift -o /tmp/swift.wav
Festival | 305