A2billing call handling bypass solution for high call volume
Page 1 of 1

Author:  Sam [ Mon Jun 23, 2008 12:34 am ]
Post subject:  A2billing call handling bypass solution for high call volume

I think it would be an good idea to have a mode a2billing could be launch for high volume traffic without loading all the other features. Something simple that doesn’t uses much ram would be nice.

Badly needing more server recourses so I wrote a dialplan which I am sharing here. I am getting call center traffic and other high volume traffic from clients who were sending calls at he rate of 3 to 5 calls per second. I have a massive number of records in cc_ratecard table being close to a million rates for various plans I created for retail clients. To query for rates and plans on this high volume traffic in such a large table will crash a lot of servers as it did mine.

A2billing also takes up to 8 to 12 MB of RAM for each call. So this was a new problem I was starting to run into and part of the reason for writing a dial plan that completely bypasses a2billing and still checks for credit , creditlimit and authenticates clients by account code, logs CDR in the same CDR table A2billing uses and deducts the balance form the clients just the same as a2billing does. Below is list of features benefits.

1. Authenticates client by account code from a2billing database.
2. Checks credit and creditlimit and activated fields from clients account in the a2billing database and determines if client has enough founds or rather his/hers account been shut off.
3. Uses a2billing database so client can still log in a2billing and a view their CDRs and balance same as before and make payments using paypal or whatever.
4. Uses a fraction of the servers resources compared to a2billing.
5. Doesn’t keep a live connection to the database for the entire duration of the call.
6. BY duplicating the dial plan multable times you can use different tables for rates for differant client. Example one clients wants all the rates blocked above .0088 you can create him a special table and only add areas which are less than or = .0088... Because tables will have fewer records it speeds up the call process tremendously and uses less resources.
7. Supports spoofing whatever caller id you want per npanxx.
8. Supports dialing with or without a tech prefix.
9. Table is very simple to populate with data. It has only five fields npanxx price provider spoofCid Prefix
10. Bills calls on per second increments.
11. Blocks calls from being made unless in rate table.
12. If no caller id number is in spoofCid field the original received caller ID will be sent
13. Supports choosing multiple providers or trunks to send the calls out, based on NPANXX. Trunk names must be same as in table listed under provider.
14. Logs originating caller id and the spoof caller id with the CDR. To use this feature you must add new field in cc_call table. Also logs the total non billable seconds in your CDRs. This helps you find which providers take a long time to connect your calls.
15. Supports using Canreinvite=yes to help save on bandwidth and in some cases greatly increase voice quality.
CDRs fields logged in your cc_call table are
Sessiontime (seconds billed for)
Calledstation (number called)
Startdelay (time call took connecting)
Terminatecause (call progress report)
Calledprovider (company or trunk call went out on)
Calledrate (rate the call was charged at)
Sessionbill (about of the bill)
Beforebal (the balance before the call)
Src (spoofed caller id)

Customers account fields updated in cc_card table which are updated

1. lastuse , credit, nbused =( update with nbused+1)

To sum it all up it working great for my test calls and it was all done with only 41 lines of code. Use at your own risk. Attached is the code in text file.

To make table run code below.
CREATE TABLE `cc_route_nCid` (
`npanxx` varchar(50) NOT NULL,
`price` double default NULL,
`provider` varchar(50) default NULL,
`spoofCid` varchar(50) default NULL,
`Prefix` varchar(25) default NULL,
PRIMARY KEY (`npanxx`)

a2bbypass.txt [5.92 KiB]
Downloaded 833 times

Author:  dicko [ Fri Jul 25, 2008 2:50 pm ]
Post subject:  Those missing 41 lines . . .

That makes so much sense for this scenario, very intriguing, but I can't find your enclosed code.


Author:  Sam [ Fri Aug 08, 2008 11:05 am ]
Post subject:  Re: Those missing 41 lines . . .

dicko wrote:
That makes so much sense for this scenario, very intriguing, but I can't find your enclosed code.


Ok first code had some errors in it..
A little work was done to fix this.. Below are the updates

CREATE TABLE `cc_route` (
`id_provider` int(11) NOT NULL auto_increment,
`npanxx` varchar(50) default NULL,
`price` double default NULL,
`provider` varchar(50) default NULL,
`spoofCid` varchar(25) default NULL,
`Prefix` varchar(25) default NULL,
PRIMARY KEY (`id_provider`),
KEY `npannx` (`npanxx`)

custom_extensions_a2billing.txt [6.13 KiB]
Downloaded 896 times

Author:  hfvoip [ Mon Feb 09, 2009 6:23 am ]
Post subject:  you make take a look at this

I implement it using MYSQL application ,so not use permanent db connection during call,not initial one php process for each call

it's stable,working configs
but for callback/callingcard ,it still not supported

Author:  cyford [ Sat May 09, 2015 1:23 am ]
Post subject:  Re: A2billing call handling bypass solution for high call volume

I do my callback outside a2billing. i add the callback rates to the outbound calls.. i needed more redundancy and couldnt get it with a2billing,. my google voice limits calls and now if google voice ends it i can originate with a different provider...

i will be using this script too.. but what i am curious is will it work with the Speed dial function.. all my customers depend on the speed dial

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group