08 February 2012

A2Billing Install Guide

Some knowledge of Asterisk and Linux is expected in order to install the system.
  1. Install Asterisk with Asterisk Realtime, MySQL, Apache and PHP version 5.2
  2. Download and explode the A2Billing tarball.
  3. Move, copy or symlink the Admin, Customer, Agent and Common directories into web-root, or configure apache to display them in a directory of your choice.
  4. Move copy or symlink AGI/a2billing.php into the asterisk agi-bin directory, and also copy or symlink the common/lib directory.
  5. Create a new A2Billing database then create the database schema with DataBase/mysql-5.x/a2billing-mysql-schema-v1.7.0.sql
  6. Apply each “DataBase/mysql-5.x/UPDATE...” SQL file in order from 1.7.0 to the latest version.
  7. Place a2billing.conf in /etc/ and adjust the database settings to suit your install.
  8. Move or copy your sound files from addons/sounds/ into the asterisk “sounds” directory.
  9. Install the cronjobs from the Cronjobs/ directory. The comments at the top of each file give a suggested schedule for each cronjob.
  10. Configure the Asterisk dial-plan for A2Billing using the files in addons/asterisk-conf/ as a guide.
The role of A2Billing is to provide public telephony services and therefore in the majority of cases, customers must be given access by both web services and VoIP. A2Billing is often better hosted on a public IP address to reduce NAT issues.
Although an aggregation or PBX distribution can be used as a base for A2Billing, most are not security hardened for connection directly to the Internet and indeed are provided with the caveat that they should be located behind a separate hardware firewall with no access allowed from outside the LAN (Local Area Network).
Note that any telephony server exposed to the internet is a valuable target where an attacker can make real money using a variety of fraudulent techniques. Therefore great care should be taken in building any telephony system to ensure that it is secure.
We recommend that all customers and users operate the latest version of A2Billing. In general we have a policy of not removing any functionality from A2Billing, so there is little or no danger in upgrading to the latest stable version.

A2Billing Initial Set-up

System Settings | Global Settings.

Set the base currency, manager settings timezones, and all the other settings which are appropriate to your installation. Note that if you change the currency, you also have to update the currencies under Billing | Currency List


Create the trunks to the service provider in Asterisk, and confirm they work by configuring an extension in Asterisk and dialling out via the new trunk. Then tell A2Billing that the trunks exist and they can be used in the Providers | Trunks section.

Call-plans & Rate Tables

Create a call-plan and rate tables under rates. The relationship is that one customer has one call plan, which may have multiple rate tables (usually one per trunk) which in turn has multiple rates. Edit the call-plan and add the rate tables pertaining to that call-plan.


Create your rates and upload them into your rate tables, Note that the longest match of dial-code to dialed-digits is chosen first, and that a call cannot be made unless a rate exists for the destination.

Asterisk Dial-Plan

A VoIP dial-plan may look like...
exten => _X.,1,NoOp(A2Billing Start)
exten => _X.,n,DeadAgi(a2billing.php,1)
exten => _X.,1,Hangup()
...whereas a calling card dial-plan may look like this: -
exten => _X.,1,NoOp(A2Billing Start)
exten => _X.,n,Answer()
exten => _X.,n,Wait(2)
exten => _X.,n,DeadAgi(a2billing.php,1)
exten => _X.,1,Hangup()
Note that with VoIP, the call is not usually answered, whereas with a calling card, it is, so you can play audio to the customer. A2Billing VoIP accounts will use the a2billing context by default, whereas you will have to configure your calling card access number to pass into the a2billing-callingcard context.


The “1” after “a2billing.php” in the above dial-plan examples refer to which agi-conf to use. The agi-conf under System Settings controls the call in progress and how the call is to behave, e.g. whether to read out the balance, prompt for the number to call, ask for PIN etc. The agi-conf is well commented, so set its parameters according to the way that you want to handle the call.

Create Customer and Test

Once you have defined your product using call-plans and rates, then you can create a new customer, and at the same time this, by default, creates new VoIP settings. You can now register a VoIP phone or test calling cards once you have added credit to the customer's account.

No comments:

Post a Comment