Asterisk Gateway Interface


Asterisk Gateway Interface is a software interface and communications protocol for application level control of selected features of the Asterisk PBX.
AGI allows an external, user-written program, launched from the Asterisk dial plan via pipes to control telephony operations on its associated control and voice channels. It is similar to the CGI feature of web servers in allowing any language to be used for writing the external program which communicates with Asterisk via stdin and stdout.
While the initial feature set of AGI included only a procedural control of Asterisk operations via commands and response handshake, Enhanced AGI also provided out-of-band access to the incoming audio stream.
FastAGI is an extension to AGI which allows the external program to run at a separate network host to avoid the overhead of creating a new process for every call on the Asterisk server. It uses a TCP socket for communication to the external host which provides the function of an AGI service, in a manner of the client–server model. The default TCP port for FastAGI is 4573. Similar to HTTP uniform resource identifiers, FastAGI employs a URI format of.
The AGI feature set of Asterisk is implemented as an Asterisk loadable module. The features may be access by a variety of application programming interfaces in various languages, such as , Perl AGI Library, , , and