Skip to Content
Asterisk: The Future of Telephony, 2nd Edition
book

Asterisk: The Future of Telephony, 2nd Edition

by Jim Van Meggelen, Jared Smith, Leif Madsen
August 2007
Intermediate to advanced
608 pages
20h 33m
English
O'Reilly Media, Inc.
Content preview from Asterisk: The Future of Telephony, 2nd Edition

Name

FastAGI() — Executes an AGI-compliant script across a network connection

Synopsis

FastAGI(agi://hostname[:port][/script],args)

Executes an AGI-compliant program across the network. This application is very similar 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.

Tip

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) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Asterisk: The Future of Telephony

Asterisk: The Future of Telephony

Jim Van Meggelen, Jared Smith, Leif Madsen
Switching to VoIP

Switching to VoIP

Theodore Wallingford

Publisher Resources

ISBN: 9780596510480Errata Page