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

Executes an AGI-compliant program across the network. This application is very sim-
               ilar to AGI(), except that it calls a specially written FastAGI script across a network
               connection. The main purposes for using FastAGI are to offload CPU-intensive AGI
               scripts to remote servers and to help reduce AGI script startup times (the FastAGI
               program is already running before Asterisk connects to it).

               FastAGI() tries to connect directly to the running FastAGI program, which must already
               be listening for connections on the specified port on the server specified by hostname.
               If port is not specified, it defaults to port 4573. If script is specified, it is passed to the
               FastAGI  program  as  the  agi_network_script  variable.  The  arguments  specified  by
               args will be passed to the program.


                           See agi/fastagi-test in the Asterisk source directory for a sample FastAGI
                           script.  This  should  serve  as  a  good  roadmap  for  writing  your  own
                           FastAGI programs.


               Returns -1 if the application requested a hangup, or 0 on a non-hangup exit.
                   ; connect to the sample fastagi-test program, which must already be running
                   ; on the local machine
                   exten => 123,1,Answer()
                   exten => 123,2,FastAGI(agi://localhost)
                   ; connect to a FastAGI script on a host named "calvin" on port 8000, and
                   pass along
                   ; a script name of "testing", with the argument "12345"
                   exten => 124,1,Answer()
                   exten => 124,2,FastAGI(agi://calvin:8000/testing,12345)

               See Also
               AGI(), DeadAGI()


               Festival()                         Uses the Festival text-to-speech engine to read text to the caller
               Festival(text[,intkeys])

               Connects to the locally running Festival server, sends it the text specified by text, and
               plays the resulting sound file back to the user. This application allows the caller to press
               a key (specified by intkeys) to immediately stop the playback and return the value of
               intkeys. If intkeys is set to any, Festival() will send control of the channel to the
               extension entered by the user.
               See Chapter 14 for more in-depth information on using Festival with Asterisk and the
               README.festival file located in the contrib/ subdirectory of the Asterisk source.
               You  must  start  the  Festival  server  before  starting  Asterisk,  and  you  must  use  the
               Answer() application to answer the channel before calling Festival().


                                                                             Festival() | 395
   418   419   420   421   422   423   424   425   426   427   428