Appendix D. Asterisk Gateway Interface Programming

Asterisk Gateway Interface is an implementation that allows any external program to control and interact with Asterisk's Dialplan using STDIN (standard input), STDOUT (standard output), and STDERR (standard error) data streams.

We consider as STDIN all the information sent from Asterisk to the program, and as STDOUT all the data sent back to Asterisk. In other words, AGI lets us add more functionality with Asterisk using any program from bash, Perl, PHP, Visual Basic, and so on. We can even write programs that allow us to communicate with databases, open files, and so on.

The way an AGI program is invoked from Dialplan is as follows:

[context] exten => 8888,1,Answer exten => 8888,n,AGI(script.agi, ...

Get Elastix Unified Communications Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.