Asterisk Clustering – Improvements for distributed services

One of the areas that I am very interested in right now is coming up with new ways to distribute Asterisk services across multiple servers, both locally with Asterisk clustering, or distributed with servers across the internet. Off and on this year I have been working on an event system. I want to have a framework that is easy to use such that when certain events occur on one server, they can be propogated to a federation of servers.

This effort is broken down to two main parts:

  1. Internal Event API
  2. Event Distribution Methods

Internal Event API

The first phase of this effort is to come up with a generic API for generating events inside of Asterisk. This is different than the Asterisk Manager Interface (AMI). The code for generating Asterisk manager events is very specific to the manager interface and does not lend itself toward using this information anywhere else in Asterisk.

I consider this part of the project to already be pretty mature. There is a generic, binary encoded event publish and subscribe API in Asterisk trunk. I have already converted some things to use it, such as Voicemail message waiting information (more on this later!), but a more aggressive effort to convert things to use this API will be done after phase 2 has matured.

Here is the header file for this API if you are curious.

Event Distribution Methods

This part is a little bit more tricky than the first. The project here is to take the binary encoded events that are passed around using the internal event API and distribute them between a distributed network of Asterisk servers. This part is still very much in development.

I have completed a module to implement one method of distributing events. I set it up and verified that voicemail message waiting state was distributed and available between multiple servers. This approach works great for some network scenarios, but not for others.


I have more to say on the specifics of what I’m working on. I will be making follow up posts on this topic to describe details of the event distribution methods I come up with as well as what features are being converted to take advantage of these new underlying features. I can say now that the areas that I have been working on so far are sharing voicemail and device state (presence) information.

I hope that people will find this work useful as it progresses.

8 thoughts on “Asterisk Clustering – Improvements for distributed services

  1. Pingback: SIPFree - Las Comunicaciones del futuro » Blog Archive » Clustering en Asterisk

  2. It’s interesting that you bring up AIS. Under the “Event Distribution Methods” heading, I noted that I have written a module for distributing events between servers. The module is called res_ais and uses the EVT (Event) service of AIS to accomplish the task.

    I did my development and testing using the open source implementation of AIS, openais.

    There are certainly very interesting possibilities with the combination of Asterisk and AIS. I hope that I can continue working with it to take advantage of the tools it provides.

    Another interesting note is that a couple years ago, a developer at IBM used AIS to do a proof of concept implementation showing how SIP session information could be transferred to a server in the case of a fault on another server. Eventually, we should be able to get some of these types of features developed for public consumption.

  3. Hi Russel,
    i’ve been struggling to find a way to save a CDR into multiple databases, in this case, the same CDR saved on MySQL and SQLServer. I’ve about 20 Asterisk servers running TV and Radion contests, which represents about 300.000 calls per day. Now, because of a new TV Contest, i need to save CDR on a SQLServer, so i was looking for a way to set on the TV Show’s dialplan, which is in fact a Context, a way to set the server,database, and table to where to save CDRs. Does this makes any sense to you? 🙂
    Is there a way? Requirement: no AGI scripts, no Mysql Replication services. Any ideas?
    Thanks in advance.
    Sergio Charrua

  4. Pingback: Asterisk Clustering - Melhorias para serviços distribuidos « Comunidade Linux de BH

Leave a Reply to Bytecoders Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.