Introducing The Asterisk Realtime Architecture – ARA

The Asterisk Realtime Architecture is a new set of drivers andfunctions implemented in Asterisk 1.1dev (and the following v1.2 stable).The benefits of this architecture are many, both from a code managementstandpoint and from an installation perspective. This article introduces you to the ARA. 

The ARA is designed to be independent of storage. Currently, mostdrivers are based on SQL, but the architecture should be able to handleother storage methods in the future, like LDAP.efit comes in the database support. In Asterisk v1.0 somefunctions supported MySQL database, some PostgreSQL and other ODBC.With the ARA, we have a unified database interface internally in Asterisk,so if one function supports database integration, all databases that has arealtime driver will be supported in that function.Currently there are three realtime database drivers:

  • ODBC: Support for UnixODBC, integrated into AsteriskThe UnixODBC subsystem supports many different databases,please check www.unixodbc.org for more information. 
  • MySQL: Found in the asterisk-addons cvs archive on cvs.digium.com
  • Res_perl: Found in the asterisk-addons cvs archive on cvs.digium.com

Realtime peers and friends

The ARA realtime mode is used to dynamically load and update objects.This mode is used in the SIP and IAX2 channels, as well as in the voicemailsystem. For SIP and IAX2 this is similar to the v1.0 MYSQL_FRIENDSfunctionality. With the ARA, we now support many more databases fordynamic configuration of phones.The ARA static mode is used to load configuration files. For the Asteriskmodules that read configurations, there\’s no difference between a staticfile in the file system, like extensions.conf, and a configuration loadedfrom a database.

Realtime SIP friends

The SIP realtime objects are users and peers that are loaded in memorywhen needed, then deleted. This means that Asterisk currently can\’t handlevoicemail notification and NAT keepalives for these peers. Other than that,most of the functionality works the same way for realtime friends as forthe ones in static configuration.There is also a new function to load SIP peers when needed from the ARAand keep them in memory for the duration of the registration or the call.In this mode, we will support mailbox notification and NAT keepalives.

New function in the dial plan: The Realtime Switch

The realtime switch is more than a port of functionality in v1.0 to thenew architecture, this is a new feature of Asterisk based on theARA. The realtime switch let\’s your Asterisk server do database lookupsof extensions in realtime from your dial plan. You can have many Asteriskservers sharing a dynamically updated dial plan in real time with thissolution.

So what can you do?

The realtime Architecture lets you store all of your configuration indatabases and reload it whenever you want. You can force a reload overthe AMI, Asterisk Manager Interface or by calling Asterisk from ashell script with

asterisk -rx \"reload\"

You may also dynamically add SIP and IAX devices and extensionsand making them available without a reload, by using the realtimeobjects and the realtime switch.

Configuration in extconfig.conf

You configure the ARA in the configuration file extconfig.conf(yes, it\’s a strange name, but is was defined in the early days of therealtime architecture and kind of stuck).The part of Asterisk that connects to the ARA use a well defined familyname to find the proper database driver. The syntax is easy:

<family> => <realtime driver>,<db name>[,<table>]

The options following the realtime driver identified depends on therealtime driver implementation.Defined well-known family names are:

  • sippeers, sipusers: SIP peers and users
  • iaxfriends IAX2 peers
  • voicemail Voicemail accounts

There is documentation of the SQL database in the fileREADME.extconfig in your Asterisk source code tree, the /docdirectory.For voicemail storage with the support of ODBC, there is aREADME.odbcstorage documentation file.

Please test this architecture in order to make it stable

The Asterisk CVS head version, v1.1 dev, is there for you to test. In orderto move it forward to a stable release (v1.2) we need more tests,more bug reports and more fixes.You will find download instructions for Asterisk CVS head onthe www.asterisk.org web site. As usual, do not install adevelopment version on a production server.If you have any questions, the developer team is available almostaround the clock on the #asterisk-dev channel on irc.freenode.net.