Page 332 - Asterisk™: The Future of Telephony
P. 332

Getting Festival Set Up and Ready for Asterisk
               There are currently two ways to use Festival with Asterisk. The first (and easiest) meth-
               od—without having to patch and recompile Festival—is to add the following text to
               Festival’s configuration file (festival.scm, usually located in /etc/ or /usr/share/festival/):

                   (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)))
               You may place this text anywhere in the file, as long as it is not between any other
               parentheses.
               The second (and more traditional) way is to compile Festival with an Asterisk-specific
               patch (located in the contrib/ directory of the Asterisk source).
               Information on both of these methods is contained in the README.festival file, located
               in the contrib/ directory of the Asterisk source.
               For either method, you’ll need to modify the Festival access list in the festival.scm file.
               Simply search for the word “localhost” and replace it with the fully qualified domain
               name of your server.
               Both of these methods set up Festival to be able to correctly communicate with Asterisk.
               After setting up Festival, you should start the Festival server. You can then call the
               Festival() application from within your dialplan.

               Configuring Asterisk for Festival

               The Asterisk configuration file that deals with Festival is aptly called festival.conf. Inside
               this file, you specify the hostname and port of your Festival server, as well some settings
               for the caching of Festival speech. For most installations (if you’re going to run Festival
               on your Asterisk server), the defaults will work just fine.


               Starting the Festival Server
               To  start  the  Festival  server  for  debugging  purposes,  simply  run  festival  with  the
               --server argument, like this:
                   [root@asterisk ~]# festival --server







               304 | Chapter 14: Potpourri
   327   328   329   330   331   332   333   334   335   336   337