Recently I’ve had a few calls about rate cards in A2Billing not working as expected. Everything looked good except the expiry date on the rate card was showing as 0000-00-00 00:00. This caused the rates in that rate card not to be evaluated as part of the call plan.
It looks like this is caused by a limitation in 32 bit Linux with the last date able to be represented as 19 January 2038. See here for more information about this – http://en.wikipedia.org/wiki/Year_2038_problem
When you create a new rate card, A2Billing tries to add 25 years to the current date to generate the expiry date for the rate card. Since 19 January 2013 this would have taken it past the last valid date in 32 bit Linux – causing the 0000-00-00 00:00
Here is a php script designed to download the callwithus.com rate file and create a rate card in a2billing from it. It’s designed to work with the latest version of A2Billing – version 1.4.1
Here is a link to the script – http://sysadminman.net/misc/cwu-rates.html
If you copy and paste the script in to a file on your A2Billing server called /tmp/cwu-rates.php you can then run it by doing –
Before running it you will need to set the correct dabase, user and password name for a2billing at the top of the script. Also, the default markup for your ‘sell rate’ is 50% but you can alter this by modifying $markup.
If everything went well you should then find a new rate card created in A2Billing. You will need to set a trunk for the rate card and also assign it to a call plan before it can be used. Obviously check that the rates it has created look good too!
Also, I would suggest that before you run the script you take a backup of you A2Billing database – just in case things go wrong.
This script can be easily modified to work with other providers that provide a rate file that you can download.
When I setup my ratecard here I only created 1 rate to Leicester in the UK. Ok for testing but not much use in the real world! So how are we going to enter all of the rates we need – the answer is to import them. Many ITSP (Internet Telephony Service Providers) publish a rate file that you can download. I’m going to use the callwithus (my provider) rate file that you can download from here.