Asterisk Realtime and A2Billing – what is it?

There is often confusion when setting up A2Billing about Asterisk Realtime and SIP/IAX2 configuration files. Here’s a quick explanation between the two and some pointers if you have problems.

For a SIP or IAX2 account to be able to connect to Asterisk it needs to be made aware of the SIP/IAX2 account details (username, password, etc). The original way for A2Billing to tell Asterisk about any customers with SIP/IAX2 access details was to create 2 files – additional_a2billing_sip.conf and additional_a2billing_iax.conf.  These would then be ‘included’ as part of the Asterisk configuration files so when Asterisk was reloaded the account details were read.

This is pretty straight forward but does have a couple of downsides. Firstly, it’s not dynamic. Asterisk needs to reread the configuration files when any new accounts are added. Secondly, if you have multiple Asterisk/A2Billing servers there is no central repository for these account details.

A more flexible, but slightly more difficult to setup, option is Asterisk Realtime. Asterisk Realtime stores configuration information in a database (such as MySQL). It can store various configuration information in the database but for A2Billing’s purposes we will be storing SIP and IAX2 account details.

Some confusion comes that the default is for Asterisk Realtime to be turned on in A2Billing (at least in 1.8). So SIP/IAX2 accounts will not work until either Realtime is configured in Asterisk, or A2Billing is told to use the configuration file method instead. The setting for this can be found in the A2Billing admin GUI under SYSTEM SETTINGS, Global List, global, Use Real Time.

Information about setting up Asterisk Realtime can be found here –

5 thoughts on “Asterisk Realtime and A2Billing – what is it?

  1. Alan

    Hi Matt,

    I have been following you wonderful site for the last few years with useful instructions on Asterisk, A2Biling, MySql and others. I really appreciate such an effort to maintain the site. We have been using A2Billing 1.3.4 and are OK with that, however, there is no Global List->Global->use_realtime setting in this old version. I only enabled realtime in Asterisk as no where in A2Billing 1.3.4 to configure realtime. Sip friends register OK and calls are fine. But everytime a SIP friend is created it still asks to click GENERATE ADDITIONAL_A2BILLING_SIP . CONF, then writes to additional_a2billing_sip.conf and prompts for reload Asterisk . Without clicking the button, SIP peer/friend/user cannot register. The purpose of realtime is according to your explanation above to remove the need to write to o additional_a2billing_sip.conf and reload Asterisk, but this A2Billling 1.3.4 version is not acting that way. I would appreciate an instruction as to how to remove the GENERATE ADDITIONAL_A2BILLING_SIP . CONF button or remove the need to click it everytime a Sip friend is created. In short, how to enable realtime in A2Billing 1.3.4. Thanks

  2. matt Post author

    Hi Alan,

    Glad you like the blog!

    The settings for 1.3.4 were in a file called /etc/asterisk/a2billing.conf. After that they moved them in to the MySQL database (which does make you upgrading a little more complicated as you have to manually set up all the agi-conf stuff again).

    I thought 1.3.4 supported realtime. Is there not a use_realtime setting in the config file?

    All that setting really does is tell A2Billing that it does not have to generate the sip.conf files or reload Asterisk. Asterisk directly reads the SIP accounts form the A2Billing MySQL database. Obviously there is some set up in Asterisk too, to tell it what database to look at and what tables to use in MySQL.

    Cheers, Matt

  3. Alan

    According to the original documentation which claims 1.3.4 supported realtime, however, no, there isn’t use_realtime setting in a2billing.conf file. I added use_realtime = YES in the file myself in the right agi-conf, but that damm button still show up everytime a SIP/IAX friend is created which I have got to click it to write to the text file before a SIP user is able to register despite all realtime elements in Asterisk are properly configured. Anyway hope I can get some hints from Joe Roper or someone from A2B forum. Thanks for the response Matt.

    Stay well.

  4. matt Post author

    Hi Alan, the use_realtime option is not specific to individual agi-confs, but is a global on/off setting.

    If anywhere it should go in the global section.

    Cheers, Matt

  5. Alan

    Good point. Matt. Looks like I am on the right track. Will test run it realtime in the next few days and see what the behaviors would be.

    Take care

Comments are closed.