How To Configure Asterisk2billing v1
How To Configure Asterisk2billing v1
3 in Trixbox
v2.0beta
This document details the basic setup and configuration of a2billing v1.2.3 in Trixbox
v2.0beta. It assumes that no configuration has been performed yet...as in, we are
starting with a blank slate.
Please note that Trixbox v2.0beta is a beta version of the Trixbox product. Caution
should be used when placing a beta version of any product into production. Be sure to
test extensively before using Trixbox v2.0beta in a production environment.
SureTeq is now an FtOCC authorized Trixbox support vendor. We can provide remote
support and troubleshooting, or we can design, implement and support your company's
complete VoIP PBX solution. Hourly rates and support contracts are available. For
pricing information and contact details, please Contact Us.
- SureTeq now has a blog/RSS feed! Subscribe to our blog for tips, tricks, news, and
general information about all things Asterisk/Trixbox.
Table of contents
1.0 - Update a2billing v1.0.7 to v1.2.3
2.0 - Security configuration
3.0 - a2billing understood
4.0 - Providers and trunks
5.0 - Rate cards
6.0 - Tariff groups
7.0 - Customers
8.0 - Trixbox setup
Install AGI
The AGI files are how a2b speaks to Asterisk/Trixbox. They consist of the libs_a2billing
directory and the a2billing.php file.
cd /var/lib/asterisk/agi-bin
mv a2billing.php a2billing_old.php
cp /usr/src/a2billing2/trunk/A2Billing_AGI/a2billing.php .
mv libs_a2billing libs_a2billing_old
cp -r /usr/src/a2billing2/trunk/A2Billing_AGI/libs_a2billing .
chown asterisk:asterisk a2billing.php
chown R asterisk:asterisk libs_a2billing
Install a2billing.conf file
cd /etc/asterisk
mv a2billing.conf a2billing_old.conf
cp /usr/src/a2billing2/trunk/a2billing.conf .
chown asterisk:asterisk a2billing.conf
Change database type from postgres to mysql
nano /etc/asterisk/a2billing.conf
In [database] section, change:
dbtype=postgres
;dbtype=mysql
To:
;dbtype=postgres
dbtype=mysql
CTRL+X to exit nano, and then Y when asked to save.
Log into A2B
Open http://<asterisk IP>/a2billing in a browser.
Default username and password are: admin / mypassword
All done!
When I first started looking into the capabilities of a2billing, it took me a while to wrap
my mind around the different pieces that make the full puzzle. There are rate cards,
trunks, customers...all of these new items to configure before everything starts
working. Here is each piece explained simply...we will go into further detail about each
one later in this document.
Customers - customers are essentially the calling cards themselves. You create a new
customer for either yourself or someone else, and that customer is assigned a PIN
number and card number.
Rates - The cost associated with dialing a specific area.
Rate cards - rate cards can be thought of as a group of rates used for calling a
particular phone prefix. For instance, if it costs 10 cents per minute to call the UK, you
would set up a rate card for the 011 international dialing code and assign rates to that
rate card. If it costs 2 cents to call Los Angeles, you would set up a separate rate card
for the Los Angeles area code.
Tariff groups - tariff groups are a collection of rate cards. Using the above example, if I
had one rate card for calling the UK, and another rate card for calling the USA, I could
group them together as a tariff group along with any other rate cards for calling
different areas.
Trunks - trunks are your a2billing's connection to the outside world. Trunks can be set
up as either Zaptel channels (physical phone lines) or SIP/IAX providers (from VoIP
termination company such as SellVOIP or VoIP Pulse).
Those are the five main pieces of a2billing.
Click 'Confirm Data.' You should now see Voice Pulse listed as a provider. This is done
mainly for reporting purposes...a provider is essentially a group of trunks.
Now, let's set up our first trunk. Click on 'Add Trunk' in the left hand menu and enter in
the following information:
VoIP-Provider: VoicePulse
Label: VoicePulse1
Add Prefix: (blank)
Remove Prefix: (blank)
Provider Tech: IAX2
Provider IP: VoicePulse1 (the name of my IAX2 Voice Pulse trunk in Trixbox)
Additional Parameter: (blank)
Failover Trunk: (not defined)
Click 'Confirm Data.' You should now see two trunks set up...default and VoicePulse1.
Let's delete 'default' since we won't be using it. Click the 'DELETE' button to the right of
the default trunk and then click 'Delete' again to confirm.
Since I have a second IAX VoicePulse trunk, I will set it up the same way as the first
trunk, but in place of the Label, I will type 'VoicePulse2' and in place of Provider IP, I
will type 'VoicePulse2' which is the name of my 2nd VoicePulse IAX trunk in Trixbox. I
click 'Confirm Data' and now I have two trunks set up. I want VoicePuse2 to be a
failover trunk for VoicePulse1, so let's click 'edit' to the right of VoicePulse1 and change
'Failover Trunk' to VoicePulse2. Click 'Confirm Data' to save that change.
It's time to set up some rate cards. Rate cards are used for defining how much it costs
to call different areas of the country/world. First, we will set up a default rate card for
all calls that don't specifically match a dialing prefix. Expand 'Ratecard' in the left hand
menu and then click on 'Create new RateCard' and enter in the following information:
Tariffname: default
Start date: (take default)
Click 'Confirm Data.' You should now see your default rate card listed. Now, let's add a
rate to go with this default rate card.
Click on 'Add rate' in the left hand menu and fill in the following information:
Ratecard: default
Dial prefix: defaultprefix
Destination: default
Buying rate: 0.02 (what I pay for the minutes used...note, this is in USD)
Buyrate Min duration: (blank)
Buyrate Billing block: (blank)
Selling rate: 0.05 (what I charge for users using my minutes...3 cent markup in
price :) )
Sellrate Min duration: 60 (minimum charge of 60 seconds per call no matter the total
duration)
Sellrate billing block: (blank)
Connect charge: (blank)
Disconnect charge: (blank)
Start date: (leave default)
Click 'Confirm Data.' You should now see your rate listed. Our default rate card now has
a default rate associated with it. But...what if my users want to call international? That
certainly isn't going to cost me $0.02 per minute...so let's set up another rate for dialing
internationally.
Click 'Add Rate' in the left hand menu and enter in the following information:
Ratecard: default
Dial prefix: 011
Destination: International
Buying rate: 0.20
Buyrate Min duration: (blank)
Buyrate Billing block: (blank)
Selling rate: 0.50
Sellrate Min duration: 60 (minimum charge of 60 seconds per call no matter the total
duration)
Sellrate billing block: (blank)
7.0 - Customers
Now that we have set up our 'calling infrastructure' (or what to do with dialed calls), it's
time to put them to use by creating some customers. A customer is basically a calling
card number. Click on 'Customers' in the left hand menu and then click on 'Create
Customers.' Enter in the following information:
Card number: (leave default...should be a 10 digit number)
Card alias: (leave default)
WebUI password: (you can leave this default, or change it to something else...it is the
customer's password to get into the a2customer web interface)
Balance: 20.00 (add 20 bucks to this card)
Language: (leave default)
Tariffgroup: default
DIDGroup: Not Defined
Campaign: Not Defined
Callback: (blank)
Activated: Yes
Signup confirmation: Yes
Simultaneous Access: Simultaneous Access (this allows for the card to be in use more
than once at a time)
Currency: (leave default)
nano /etc/asterisk/extensions_custom.conf
Under the [from-internal-custom] context, add the following:
exten => 225,1,Answer
exten => 225,2,Wait,2
exten => 225,3,DeadAGI,a2billing.php
exten => 225,4,Wait,2
exten => 225,5,Hangup
CTRL+X to exit nano, and then press Y when asked to save.
This creates extension 225 which answers the call, waits 2 seconds, and then passes
the call to the a2billing application. You can change the 225 to whatever extension you
prefer, but make sure it is an unused extension in your dial plan.
Type 'asterisk -r' to connect to Asterisk and do an 'extensions reload' to
reload your extension files. You can now dial extension 225. You should hear a lady
asking for your complete PIN number. The PIN number is one of your created
customer's card number. Enter in the 10 digit number, and it now asks you for the
number you would like to dial followed by the # key. I dial my cell phone in the format
1NXXNXXXXXX and hit #. If all is well, it will dial out through one of the trunks I have
set up.
A note from the author:
Hey everyone!
If you have found this document useful, and plan on purchasing some VoIP equipment,
I would greatly appreciate if you use the banner link for Voipsupply.com below. I have
purchased equipment from Voipsupply.com many times, and I have always found their
pricing to be great and their shipping fast, so I definitely recommend them. By using
the link below, you won't be raising YOUR purchase price at all...you would simply be
donating a small percentage of your purchase to me, and I would definitely appreciate
it!
Thanks,
-Chris Sherwood
My Voipsupply.com banner link: