Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sat Dec 05, 2020 7:16 am
Voice Broadcast System

All times are UTC

Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Billing for Helpdesk-style inbound calls with A2Billing
PostPosted: Thu Jun 03, 2010 10:29 am 

Joined: Sun May 30, 2010 9:09 pm
Posts: 6
When you want to on-bill "customers" of any description for Calls, A2Billing really is the best solution. Having investigated several others, it appeared that A2Billing was not only incredibly flexible, but extensible, and should be able to do just what I need. The problem lies in getting it setup. Considering this wasn't a "standard" request, I decided to enlist the help of Joe Roper. He had been very prompt with Forum answers, but because of the uniqueness of the situation I felt it best to go for Paid Support.

I can safely say it was well worth the money. The support was top notch and Joe really knew his stuff.

In under an hour, we have a system that will let us bill customers for their calls in to your PBX, for example if you were doing a Helpdesk / Support-style offering to your customers. Because it's for regular support customers (Not once-off customers), the first time they call in it will prompt them for their PIN. After that, it will remember their PIN based on the incoming Caller ID.

I've also been encouraged to do this write-up on the process of billing for inbound calls with A2Billing. While it's not the most straight-forward setup, once explained you should have a fair idea on how it works and how to modify it. The A2Billing guys have been nice enough to let me post up this How-To for everybody else to enjoy! Don't forget if you need assistance at any stage, head on over to and contact their sales team, they'll be most happy to assist with this sort of setup.

Here's a quick run-down of how this is going to be setup:

The call comes in via a SIP trunk, which goes immediately to A2Billing

A2Billing runs agi-conf1, which is (in a nutshell) a collection of instructions on how it's going to handle the call.

We're going to tell A2Billing, through agi-conf1, how to handle the "billing" side of things, and how to control the call once it's begun billing.

Once A2Billing is "finished" with processing the billing for the call, it's going to pass it off to FreePBX in the form of a new local-only trunk, a loopback trunk if you will. This lets us handle the call in any way that we want, such as with a Queue or Ring Group, or anything else.

Once the call gets hung up, A2Billing stops the CDR Billing, everyone's happy!

Now, we're going to start by presuming you have already followed the instructions to get A2Billing successfully installed. I was running Elastix, and also had to run this to fix MySQL: /usr/bin/mysql_upgrade -p

Starting by pushing calls from your Support Trunk through to A2Billing

We're now going to create a Custom Destination in FreePBX. You may need to use the Unembedded FreePBX GUI, under the Tools tab at the top. The custom destination will be:


Call it something such as A2Billing-Passthru.

Now go into your Inbound Routes and amend the applicable inbound route for your Helpdesk line, so that it uses the new A2Billing-Passthru Custom Destination as its destination.

Adding A2Billing into your Asterisk Dial-plan

Once you've done that, you're going to fire up SSH and login as root. You want to edit the file: /etc/asterisk/extensions_a2billing.conf

Add the following at the bottom of it:

exten => _X.,1,DeadAGI(a2billing.php|1)
exten => _X.,n,Hangup

We're also going to make sure that it's load that config file, so check in: /etc/asterisk/extensions_custom.conf

You want to look for this line probably at the bottom:

#include extensions_a2billing.conf

This will make sure that Asterisk loads everything out of the extensions_a2billing file, which is a great way of separating the A2billing customizations from everything else.

So we've told your system to pass the calls off to A2Billing to handle, now we've got to go into the A2Billing WebGUI and tell A2Billing what it has to do with these calls when it gets them.

A2Billing setup

Now, the order that I've been told you setup ANY A2Billing system is:
Call Plan

Adding a Provider -- Loopback trunk

In this case, it's not a real provider, as we're not going to be passing calls back out to the world. Instead, it's a "local" trunk looping back to Asterisk.

Under Providers --> Providers, add a new Provider and name it "local-support".

Next we'll add a new Trunk.

Under Providers --> Trunks --> Add Trunk

Set the VoIP Provider as "local-support" which you just created a second ago

Give this trunk a Name, I called it "Local Support". For the purposes of this How-To, it's probably worth you sticking to this name too in order to keep clarity.

Provider Tech needs to be set to "local", so that it creates a local asterisk-only trunk.

Provider IP needs to be set to "[email protected]". This is what the "inbound" Caller ID will be when you create a new trunk in FreePBX later on, just keep that in the back of your mind.

We've got Concurrent Connections set to "0" and Max Connections to "-1". You also definitely want the status as "Active".

Then, we're done, and it's time to move on to the RateCards.

RateCards -- How much is that call going to cost them?

Click on Rates --> RateCards

Set the tariffname to something like "support", this is going to be your main support rate that you charge your customers.

Set the trunk to "Local Support", then both the DNID Prefix and CallerID Prefix to "all".

Save the RateCard, and then we're going to create a "Prefix" so that when you look in the CDR logs, you can see the prefix of "999" associated with the "Support" calls. It's just an extra bonus that I was shown so it looks nicer in the CDR reports.

Go to Providers --> Prefixes --> Add Prefix

You want to give it the prefix 999, with the Destination name "Support".

Now, we're going to define the Rates. Go to Rates --> Rates --> Add Rate

Use the RateCard you created earlier, specify the Dial Prefix of "defaultprefix", and the Destination Prefix of "999". This will assign the destination "Support" in the CDR Reports.

Set all your buy-rates to zero, but the next part is the really crucial part.

Because we're doing Support, we're going to set the per-minute rate to something like 2.00 ($2 per-min). You can always adjust this to suit.

The next 6 options are fully customizable to suit. Have a play around.

Leave the rest as defaults and you should be good. Confirm Data to save.

Linking the Ratecard to the Call Plan

We've made the RateCard and the Call Plan, but haven't yet linked the two. If you ever have more than one RateCard, you'll see how this is very useful. Don't skip this step, I'm told it's the number one mistake people make, forgetting this.

We're going to select Rates --> Call Plan

Click on the Pencil to edit the Call Plan that we created earlier.

Select the "support" RateCard that you've just finished creating and hit "Add RateCard"

Click on Confirm Data and you're all set.

Additional settings

Before we add the Customers, we're going to adjust the length of the "card" which is going to be used as the PIN, only on the initial time the customer calls in.

To do this, we go in to System Settings --> Global List

Where it says "Select Group", there is a drop-down box. Choose global and then hit Search.

The very first entry should be "interval_len_cardnumber". I've got mine set to 5-20. Confirm the Data and you should be taken back to the Global List of settings.

Now, select "agi-conf1" from the dropdown list and hit Search.

You want to adjust the following:

min_duration_2bill = 120 (This is so that calls where they've just sat in our "Queue" and decide to hang up before speaking to somebody, won't get billed)

use_dnid = yes (This is so the customer doesn't have to enter in a destination number)

say_balance_after_auth = no (So that we don't tell the customer how much credit they have. It gets annoying)

say_timetocall = no (So that we don't tell the customer "You have 3 minutes for this call", we don't want to rush them)

cid_askpincode_ifnot_callerid = yes (So if it's their first time calling in, we prompt for their PIN, and associate with their Caller ID)

cid_auto_assign_card_to_cid = yes (This makes the previous item work the way that we want it to, automatically)

Creating a Customer

Now we go and add in some customers who are going to call us.

Click on Customers --> Add :: Search --> Add a Customer

Up the top there is a drop-down box "Change the Account Number Length:", we're going to set this to "5", unless we happen to have thousands of customers, it should be enough. It gets annoying punching in an extremely long card number otherwise, even though you only have to do it once before it associates with the Caller ID.

Leave the WebUI details alone, but we'll give them a massive initial balance, say "999999".

Fill in the "Personal Details" to your liking for your customer, obviously the more the better, as we're going to pull this information at a later stage.

We'll change them to a "post-paid" card type

Select the Call Plan. Later on you may have multiple Call Plans, such as a "standard" support rate, and a "VIP" support rate (Cheaper for the really regular customers) for example. So far we've only setup one, so choose it now.

Set your TimeZone to the correct TimeZone

Leave the rest as defaults, except we want to adjust AutoRefil = Yes, and set the Refil Balance to something like "99999". That's a lot of money to auto-top them up, but it's not relevant, as we'll bill them externally.

Now, your customer has been setup, we're going to tell FreePBX how to handle things once you've finished passing the call through A2Billing.

Last FreePBX configurations -- Inbound routes for the "billed" call

Fire up FreePBX and go to the Inbound Routes, we're going to create a new one.

Give it the name "Support" and the DID Number "support". This is what we set earlier in the Provider IP in A2Billing.

Give it a destination, and you're ready to go. Submit, Apply Changes, and it's time to test!

We recommend setting it up as an Extension of your own to initially test with, however I'm sure you're already smart enough to have thought of that.


When you first make the call in, you should be prompted for your PIN. This is the "Account Number" that A2Billing gives you, and should be 5-digits long if you've created it according to the above instructions.

When you call back in a second time, you should not be prompted for a PIN, and the call should immediately connect.

Billing your Customers -- Pulling the data from A2Billing (MySQL)

We're now going to use MS Access to pull the data from the system, and start matching up the fields to give us some nice reports.

Firstly we need an ODBC connector for MySQL so we can import the data into Access:

Once you have this installed, it's time to fire up MS Access. I'm using Access 2007 for this example.

Create a new Blank Database when prompted.

Click on the External Data tab, then "More", then "ODBC Database".

It'll ask us if we want to Import or Link the data, we want to Link.

You'll be prompted to select the Data Source, click on the "Machine Data Source" tab and hit "New".

Select if you want anybody on this PC or just your User to have access to this.

Select the Driver as "MySQL ODBC Driver", then hit Next, and then Finish.

You should now have the MySQL ODBC Data Source Configuration window open. The data source name and description don't matter too much, so we're just going to call them both "A2Billing".

Enter in the IP Address for your A2Billing server, and the correct MySQL authentication details. For me, it was the Elastix defaults, though you may wish to try:

user = a2billinguser
password = a2billing

Once you've got the correct host, user and password, the drop-down list should become populated with the databases. Select the A2Billing database, in my instance it's "mya2billing".

Upon hitting the "Test" button it should tell you "test successful". Click OK, and you'll get a new window appear asking what tables you want to link to. Select "cc_call" and "cc_card".

cc_card contains your customer details, such as their First / Last name, Address, Phone, Email, Website and Company Name.

cc_call contains all the call records. This should grow very significantly in a short space of time, just warning you.

When looking in cc_call, the easiest way to see who called is the "card_id" value. Check the card_id value against the value in cc_card, the "id" value, and you'll see who it was who made the call

In cc_call, to see what you should be charging them, have a look at the "sessionbill" value. For calls that are under 2 minutes, we zero-rated them in case they simply sat in a queue, or the person at your office didn't pick up, or maybe it went to Voicemail for example. This is the best way for you to see what it is you should be billing your customer, with the "sessionbill" value.

Don't forget that if you ever get "interrogated" over the times of the calls, they're there in the "starttime" and "stoptime".

It's now up to you to link things up nicely depending on how you want to bill your customers etc.

Good luck!

 Post subject: Re: Billing for Helpdesk-style inbound calls with A2Billing
PostPosted: Tue May 10, 2011 1:48 pm 

Joined: Mon Nov 10, 2008 11:42 pm
Posts: 61
can suggestion to do the same without FreePbx ? can you share the .conf files part of that uses helpdesk system . Also can the calls be made to pstn dialout to mobiles ?

 Post subject: Re: Billing for Helpdesk-style inbound calls with A2Billing
PostPosted: Wed May 11, 2011 6:23 am 

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065

If you are not using FreePBX, then presumably you are comfortable with building asterisk dial-plans. In the example above, just create a context with the dial plan you want to execute in extensions.conf, including dialling other external phones over your asterisk trunks, and edit the trunk details in A2Billing to suit. In your case, change "[email protected]" to [email protected]


 Post subject: Re: Billing for Helpdesk-style inbound calls with A2Billing
PostPosted: Thu Jun 28, 2012 4:43 pm 

Joined: Thu Jun 28, 2012 4:40 pm
Posts: 1
I did as stated in the post, but does not work. Do not quite understand this part: Provider IP needs to be set to "support @ from-pstn". This is what the "inbound" Caller ID Will Be When You create a new trunk in FreePBX later on, just keep That in the back of your mind.

Could you help me?

Thank you.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 
Auto Dialer Software

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group