Tag Archives: callwithus

Automatically create A2Billing rate card from callwithus rate file

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 –

cd /tmp
php cwu-rates.php

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.

Using a callwithus DID with FreePBX/Asterisk

Using a callwithus DID with FreePBX/Asterisk is very straight forward.

First you need to purchase the DID through your callwithus account. I am buying a number located in the UK.

buying a DID from callwithus

Once you have purchased the DID you can click on the DID menu option again to check where the DID is being forwarded to. To make things easier on the FreePBX side we want to change this from the default.

Continue reading

Updated sip proxy/registrar settings for callwithus.com

If you’re using sip to connect to callwithus then you need to make sure that you’re using the generic address sip.callwithus.com as your proxy/registrar.

From May 1st the other, more specific addresses, that used to work will stop accepting registrations (west.callwithus.com, east.callwithus.com, uk.callwithus.com)

See here for further details – http://www.callwithus.com/configuration

Getting started with A2Billing – Part 5 Importing a ratecard

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.

Continue reading

Getting started with A2Billing – Part 2 Ratecards and Call Plans

After we’ve created a trunk we need to create a ratecard and assign it to a call plan. This is the main part of the billing application and also the most complicated!

Initially I’m just going to create a ratecard that allows calls Leicester in the UK. The dialling code for Leicester is 0116 so the international prefix would be 44116  (44 being for the UK)

Creating a Ratecard

First click on the RATECARD menu on the left hand side of the screen

Then give your ratecard a name. I called mine “test-rate-card”

Assign the ratecard to use the trunk we created here

And click on CONFIRM DATA

Continue reading

Getting started with A2Billing – Part 1 Setting up a trunk

In this series of articles I’m going to run through how to get up your a2billing system up and running.  A2billing is an opensource billing application for Asterisk and can be used in many different ways – I’ll be documenting just some examples  🙂

Some of this setup will depend how you have your main configuration file (/etc/asterisk/a2billing.conf) configured. I will not be discussing that here. Also some of the setup may rely on FreePBX and A2billing being setup to work together.

All of this documentation was created on a sysadminman Asterisk/FreePBX/A2billing VPS. See here for details – http://sysadminman.net/uk-voip-vps.html

Setting up a trunk

We need to setup a trunk to be used for our outbound calls. Obviously you can setup more than one trunk and route calls to different destinations via different trunks.

I will be using the trunk that I configured in FreePBX here – http://sysadminman.net/blog/2009/getting-started-with-freepbx-part-1-setting-up-a-trunk-335. As the main settings for the trunk have been setup in FreePBX we can just call the trunk by it’s name in A2Billing. This trunk is with a provider called callwithus.

To setup a trunk –

Click on TRUNK on the left hand main menu

Continue reading

Getting started with FreePBX – Part 3 Making external calls

This article assumes you have completed part 1 and part 2

So we have configured our trunk and our extension and now we need to tell FreePBX to use that trunk when someone dials a number. This is done by creating an Outbound Route.

The configuration below also takes in to consideration the fact that I am in the UK and that callcentric is a US company. Your setup may differ.

Creating an outbound route

First we need to click on “Outbound Routes” in the main menu on the left hand side of the screen

Continue reading

CallWithUs launch UK based SIP server

*** UPDATE 23/6/09 – While callwithus still have a UK sip server you should use the server ‘sip.callwithus.com’ in your configuration settings. Check the callwithus website for details.

If you’re based in the UK or Europe and looking for a cheap ITSP (VIOP provider) it might be worth looking at CallWithUS as they’ve recently launched a UK based SIP server.

As well as the US based servers sip.callwithus.com, east.callwithus.com and west.callwithus.com you can now use uk.callwithus.com. I now get sub 6ms pings from my Asterisk server in BlueSquare to the CallWithUs server.

I’ve been using CallWithUs for a while now and they provide very competitively priced DIDs and termination rates.

Using callwithus with Asterisk, FreePBX and A2Billing

The instructions below assume that you have got Asterisk, FreePBX and A2Billing installed and working together.

Below are the first steps in setting up a callwithis DID number and passing the call through to A2Billing. This number can then be used as an access number for your calling card clients.

Once you’ve signed up for your callwithus account and purchased your DID number the next thing you want to do is modify how your DID number gets presented to your Asterisk box so you can route it to a2billing.

On the callwithus website, click on DID on the left hand menu and then locate the DID number you want to use and click ‘edit’. Now under ‘DESTINATION’ add ‘/yourdidnumber’ the the end of ‘SIP/youraccountnumber’

This will cause callwithus to append your DID to the call details when it is passed through to your Asterisk server. See the image to the right for details.  




Next we want to go into FreePBX and register A2Billing as a ‘Custom Destination’.

If you don’t have the ‘Custom Destination’ menu in FreePBX you will need to go to the modules menu option and install the ‘Custom Applications’ module.
Enter ‘a2billing’ as the Description and ‘custom-a2billing,${EXTEN},1’ as the custom destination



Now we want to configure our callwithus trunk.




Configure your trunk as in the images here, obviously using your username and password. More information on how to setup your trunk can be found on the callwithus website here.




Now we just need to configure our inbound route. This inbound route decides what happens to a call when it is presented to your Asterisk server. Give it a meaningful description and then in the ‘DID Number’ box enter your callwithus DID in the same format you used in step one above.

Scroll down to the bottom of the configuration page and you should see the ‘a2billing’ ‘Custom Application’ that you setup earlier. Select this and then click on Submit. Don’t forget to click on ‘Apply Configuration’ at the top of the FreePBX page to get Asterisk to read your changes.


And that’s it for now. If you call your callwithus DID it should come to your Asterisk box and then be passed to a2billing. Depending on how you’ve got a2billing configured will determine what happens to that call now.

I’ll discuss in a later post some ideas about how to configure a2billing