[FAQ] Integration - AGI/FastAGI, Manager API & AJAM

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

[FAQ] Integration - AGI/FastAGI, Manager API & AJAM

Postby muppetmaster » Wed Dec 14, 2005 4:28 am

How to integrate to Asterisk is a frequent question on this forum. Asterisk has multiple interfaces for integration that allow for a myriad of third party applications to be built leveraging Asterisk.


The first interface is the Application Gateway Interface (AGI), which allows for an external application to be called to provide access to external data/systems and external dialplan logic on calls (incoming or outgoing). The AGI aware application may be written in virtually any language (Perl, PHP, C/C++, Java, Pascal, Bourne Shell, etc) and access almost any database (ODBC, MySQL, Postgres, Oracle, etc). Examples of using the AGI may be to trigger the opening of a new case for a helpdesk automatically when a call arrives, to providing Least Cost Routing (LCR) capabilities from a custom database application, to integrating Text To Speech (TTS) applications.

Those familiar with an Avaya Communication Manager will know this type of functionality as a call to an adjunct link from a vector/VDN, while those familiar with a Nortel Meridian background will know this as the ability to call a host from a CDN. A key difference is that the Asterisk AGI allows for much greater control of the channel (ie - playback messages, capture digits, etc) than an Avaya or Nortel does.

The cousin of the AGI is the FastAGI, which allows one to call a remote AGI aware application via a TCP socket connection. Allowing the developer to offload the AGI resource load onto another server.

Manager API

The Asterisk Manager API is an interface that allows for third-party call control. This may be thought of as a Computer Telephony Integration (CTI) interface such as CSTA/TSAPI. This interface allows for a third-party application to connect via a telnet/TCP interface to do such actions as originate calls, call and extension event monitoring, call recording/monitoring, etc. Examples of uses for this interface would be autodialing (in lieu of using call files), call recording applications, inbound call screen-pops to desktop applications, etc.

Aynchronous Javascript Asterisk Manager (AJAM)

AJAM is is a new technology (available in v1.4) which allows web browsers or other HTTP enabled applications and web pages to directly access the Asterisk Manger Interface (AMI) via HTTP.

Opensource Libraries

While connecting to an AGI/Manager API interface is straightforward, there are several libraries available to do the dirty work for you. These include:

- Asterisk-Java
- Asterisk.NET
- Asterisk-Perl (AGI only)
- Asterisk-Python
- [url=http://www.adhearsion.com]Adhearsion - Ruby
- [url=http://telegraph.rubyforge.org]Telegraph - Ruby

- Presentation from Astricon in Dallas in Oct 2006 may be found here.

Example Application

Here is an example of an application that was developed using Asterisk and Asterisk integration capabilities:


Just one example of the powerful web services that may be built leveraging Asterisk and its various integration interfaces.
Last edited by muppetmaster on Sun Aug 20, 2006 3:44 am, edited 6 times in total.
Salt of the Asterisk
Posts: 1080
Joined: Thu Dec 21, 2006 10:56 pm
Location: San Carlos, CA

Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest