Using A2Billing for wholesale or residential services

This is a very quick walk through for using A2Billing to offer wholesale or residential services. What this means is providing call services to another device, such as a SIP extension or Asterisk server.

This tutorial produced using a SysAdminMan VPS running Asterisk 1.6.2 and A2Billing 1.9.2

First we need to set up a trunk that will be used for our outbound calls. I am going to use voip.ms in this example, it’s free to sign up for an account with them.

First you need to find your SIP account details in the voip.ms control panel –

Now we are going to set up a trunk using FreePBX. This trunk could be configured by editing sip.conf if you don’t have FreePBX on the system.

First select Add a SIP trunk –

Now enter your voip.ms account details. All we need is a name and trunk details in Outgoing Settings –

Now we need to set the trunk up in A2Billing. All we need to enter is the name, the call type (SIP) and the name of the trunk we setup in FreePBX –

Next we need to create our rates. For this I’m going to download an Excel file with the rates from voip.ms. We’re only going to get the fields shown in the screenshot below –

The reason I downloaded an Excel file is that I need to modify the file a bit to get all the fields I need, and in the right order. We want to end up with the following 5 columns. I duplicated the rate column to create a ‘buy rate’  and a ‘sell rate’. At the moment they are the same value. It is important that these columns are in the correct order –

Make sure you save the Excel spreadsheet as a CSV using File, Save As.

Now create a new blank rate card in A2Billing –

Now to import the rates. You may find that A2Billing will not let you import a file ending in .csv, if this happens just rename it to .txt.

Select the 2 additional fields for import as shown below. The most important thing is that the fields selected and their order match those in your CSV file –

Now I’m going to add 10% to the ‘sell rate’ value. This will mean we make 10% markup on our calls. Under RATES/Rates select BATCH UPDATE and the Add 10% to the SELLING RATE column –

Next create a call plan. I’m going to select Remove Inter Prefix because the rates we imported do not begin with ’00’ so if someone dials that we want to take it off before passing to the rate card –

Next we need to edit the call plan and add the rate card we created to it. This is the part that many people forget to do –

Finally we’re going to create a customer account. Make sure you give the account a positive balance so that it can make a call and also select Yes to create SIP details –

Next, as we’re not using Asterisk Realtime, we need to click on VOIP Settings and create the Asterisk SIP files and reload Asterisk –

Now using the SIP account details for the customer we should be able to either create a trunk on a remote Asterisk system or enter the account details in a SIP extension/softphone. Here are the details we are going to use –

and here are the details enetered into x-lite where I could sucsessfully make a call –

There is definitely more you would want to do but following the above should get you a working system billing for calls with a markup for the rates.

One other thing to point out if you are doing this on your own A2Billing install (and not a SysAdminMan VPS) is that this setup has been completed which makes customers in the ‘a2billing-sip’ context use AGI-CONF2 in A2Billing. This agi-conf has been set up for sip customers such as the balance not being read out, the dialled number being used, etc …

15 thoughts on “Using A2Billing for wholesale or residential services

  1. matt Post author

    If you’re using Asterisk RealTime in a2Billing then you shouldn’t need to do anything. If you’re not then you need to click on the button to generate the SIP (or IAX) files and then the reload Asterisk button.

    If it’s still not working it’s likely that your A2Billing SIP (or IAX) config files are not being loaded as part of the Asterisk config.

  2. Jermaine Gray

    Yes you are correct because when i try to click the reload the page did not return to the a2billing customer screen. it return a blank screen. what can i do to reload the configuration for my a2billing customer account to register with my sip phone. also to you do provide paid support.

  3. matt Post author

    I’d guess you don’t have the manager username/password set correctly. Check in the A2Billing Global settings. The manager username/password should match what you have defined in the Asterisk config files.

    Unfortunately I’m not providing any paid support at the moment, only the preconfigured virtual servers.

  4. Kai

    The password in xlite that you have typed does it really work?

    Can you remove the password, and try to make a call to see if you can or not.

    Thanks to let me know.

  5. matt Post author

    Hi Kai,

    Certainly the password worked when the testing and documentation was done. I’m not sure if you can create an A2Billing customer with no password, even if you can I would not recommend it.

  6. Tedd

    Hi I have followed your instructions, they all work fine for Elastix 1.6 , could not make it work on Elastix2.2 or Elastix 2.3.
    My main issue is that Extensions are billed upon dialing an outside number where failing to make a2billing deduct for calls made between extension.
    Any help here will be greatly appreciated.
    As for Elastix 2.2 and 2.3 , when can we have the new steps?

  7. matt Post author

    Hi Tedd,

    I’m not sure if I’ll update the instructions for newer versions of Elastix. Maybe.

    I’m not sure about billing for extension to extension calling though.

    Regards, Matt

  8. Tedd

    Hi Matt,
    Thank you for the swift reply, appreciated.
    It is really a pity, I am not sure what I did wrong in order not to be able to apply your instructions to the Elastix 2.2 or 2.3.
    Elastix 1.6 on which your instructions were based they perfectly work. If you can give me a hint where to look and I will try to re-write the tutorial.
    As for the Extension to Extension billing , I could not find any positive reply on the net. That is important to me but not high priority as much as the Extension to Trunk billing.

    Regards, Tedd

  9. Ricky

    Hi Matt, I followed your steps and everything went well, except that when I setup a trunk at a remote freepbx server using the sip details from a2billing and I try to make a call, I can see the call coming in at the server using CLI, but I hear nothing…. I can also see that a2billing is playing the file where it asks the. A for the destination number bu I dialed it.

    Do u know why this might be happening?

  10. Chris

    Hi Matt. Congrats on your work here on this site.

    I was wondering if you could solve my solve my puzzle problem or at least where I should look for a solution.
    I am trying to connect two A2B servers, back to back. Server A and Server B.
    Server B is doing the calls accounting for Server A, which in turn does the call accounting (billing) for call that arrived via SIP to the server (A).
    The call gets through to server B, terminates (destination phone rings) however as soon as the destination phone picks up the line drops immediately (at ALL attempts).

    The servers are interconnected as if they where completely not related one to the other: Server B has SIP accounts inside and ONE of those is connecting via Server A (instead of a normal IP phone). I tested normal SIP authentication AND IP authentication, both worked but with the same result. The line drops. Each server on the other hand behaves normally on a standalone basis (i.e each server is able to terminate and connect calls normally. The problem is when trying to send the calls from server A to server B!).

    Any ideas?
    A SIP Debug trace is here: http://pastebin.com/tu2N03P9

    Regards
    Chris

  11. matt Post author

    Hi Chris,

    Glad you like the site!

    From the debug it looks like maybe a SIP reinvite is happening and failing.

    You could try setting canreinvite to No on all of the a2billing SIP accounts.

    Matt

  12. Hi Matt

    Dear Matt, I am trying to connect sip customer on eyebeam softphone but unfortunately getting the same problem forbidden (Bad Auth) Error !!
    please guide me how to resolve this issue..

    thanks in advance..

Comments are closed.