2 Nov

The Grand Unified Asterisk API

(This post covers what the what of the API rather than the how.  The how of APIs – REST vs. RPC, sync vs. async – will be covered in a future post.)

The problem with programming is knowing when to stop.  The key to knowing when to stop is setting goals.  To that end, here are my goals for the new API:

  • After the initial installation, I do not want to have to use the Linux shell
  • I do not want to have to directly edit configuration files
  • I want to be able to script the configuration of a complex Asterisk server instance
  • I want to be able to build a management console that uses API calls to manage every aspect of a system (or cluster of systems)
  • I want to easily write voice applications in real languages: JavaScript (Node.js), Python, Perl, PHP, Clojure, Scala, .NET, etc.
  • I want performance that is 90% of what you can get using the Dialplan
  • I want to be able to build my own version of the monolithic apps currently trapped inside Asterisk (voicemail, queues, parking, etc.)

For a few stretch goals:

  • I want one Asterisk system to be able to automatically mirror another
  • I want Asterisk systems to be able to discover and share load with each other

I’m not being too …

Read more »
28 Oct

The Eight APIs of Asterisk

(The first of a multi-part series on APIs for Asterisk, this article covers the current interfaces, their strengths and weaknesses.  Check back in a few days for part two: a proposal for an enhanced, unified interface for Asterisk programming.)

At the AstriDevCon this year we talked about a number of aggressive projects to make significant improvements to the platform. At the top of the list were a rewrite of our SIP channel and better APIs for application development. Both efforts are important and, frankly, long overdue. I’ll leave the SIP efforts to others and concentrate on the APIs.

Asterisk currently includes a total of eight interfaces:

  1. The internal C language interfaces
  2. The Dialplan scripting language(s)
  3. The Asterisk Gateway Interface (AGI)
  4. The Asterisk Manager Interface (AMI)
  5. The External IVR interface / protocol
  6. The Asterisk Command Line Interface (CLI)
  7. The outgoing call file spool
  8. The Asterisk configuration files

These interfaces provide various means of interfacing with Asterisk. Unfortunately, they’re inconsistent, awkwardly structured, poorly documented and generally developer-unfriendly. Let’s take a look at the pros and cons of each.


Asterisk’s internal C API is used to write applications and functions which are then exposed to the Dialplan and other interfaces.  On the positive side, the resulting apps are fast, have virtually no overhead and have access to all of the …

Read more »