Getting started with A2Billing – Part 4 Creating a customer and making a call

So we’ve created a trunk to make calls through here, we’ve created a ratecard and call plan here and we’ve created an access phone number here so we’re finally ready to create a customer!

Creating a calling card customer

Click on CUSTOMERS on the left hand menu

Click Create Customers

We get a big list of options but the only things we need to set are –

BALANCE – set the inital balance for the customer

CALL PLAN – ensure the call plan is set to the one we created here

LASTNAME & FIRSTNAME – not required but definitely useful!

Then click on CONFIRM DATA



There are obviously a lot more settings I can use when configuring a customer but if I click on List Customers I can see my customer is setup


So, lets give it a go!

I ring my access number 12532433498 (configured here)

and it asks for my PIN number so I enter 1137742329  (my card number created above)

I now get the message “Please enter the number you wish to call and then enter the pound key” so  I dial 011441162572850# (remember I can only dial numbers in Leicester in the UK for now as that is the only rate we created here) and my call is made!

Now, a couple of things have also happened.

If I click on CALL REPORT and then CDR Report I can see that a record has been made of the call plus the call charges –


and also if I click on CUSTOMER, List Customers and then click on EDIT next to my customer –


and then scroll down to the bottom I can see that my CLID has been added to my customer record (this is becuase cid_enable and cid_auto_assign_card_to_cid have been enabled in a2billing.conf). This means that next time I call the system from my phone it will know who I am and I will not need to enter my pin number again.


41 thoughts on “Getting started with A2Billing – Part 4 Creating a customer and making a call

  1. John

    I have set up everything and it’s working except one thing – when I dial the pin number and then phone number, I hear message “The number you trying to reach is currently unavailable”. How do I fix this?

  2. matt Post author

    Sounds like maybe your trunk is not working correctly. Does the call appear in the call reports?

  3. John

    No, when I dial the number with the dial prefix 1212 I near the message “The number you trying to reach is currently unavailable”. When I dial the same number with 0111212 I hear the number of minutes left for the call (system calculates the time correctly based on the rate I set up but right after that the message about the number being unavailable follows). Trunk configuration:


    Asterisk SIP info under Tools shows that Asterisk registered with CWU. Not really sure what’s wrong.

  4. matt Post author

    What is the prefix for? Are you dialling a number in the US that starts 1212?

    If so it looks like your calling card is expecting to have 01 on the front of the number but I’m not sure that callwithus is. You could edit the cwu trunk in a2billing and try removing that 01 prefix.

  5. John

    Actually the CWU trunk seems to be working fine with both international and U.S. numbers. In fact, I am able to dial all numbers when calling via X-Lite with 011 prefix (including U.S. numbers); I dial 011+1+212 for New York, and I dial 011+44+XXX for the UK. So, the trunk is working fine, and CWU is accepting 011 prefix, but for some reason, the call is going through when the number is dialed via calling card gateway. I searched online and discovered that I am not the only one having exactly the same problem, but noone seems to know what to do. I think something is wrong with the configuration of a2billing itself, but don’t know what.

  6. matt Post author

    Does the trunk name you’ve used in a2billing match the name you’ve used in freepbx?

    If so I think the only option would be to switch on the debug in a2billing for the agi-conf that you are using and see what the logs think is going on.

  7. ahmed

    Hi matt, i have my trunk and extensions working. when i call my DID the call comes to FreePBX i can send it to one of my extensions just fine. but when i try to send it to a2billing it gives busy signal. what do you think where my problem is?
    any help is greatly appreciated

  8. Phillip

    Hi matt

    Everything is working correctly, the only issue i have is that once the balance of a card reaches 0, the clid is still stored on this card. So everytime i call in with this clid i get the message that “i dont have enough credit to make a call”. Is there a way to remove cards with 0 balance from the system?


  9. matt Post author

    Hi Philip,

    Do you mean remove the cards automatically? You can obviously remove them manually through the GUI, or you could just remove the associated CLID.

    If you mean automatically then I don’t think so. Not sure you’d want to do that anyway as wouldn’t you want them on there in case they decided to top up?

  10. Phillip

    Hi Mat

    Yes i mean automatically, when a subscriber calls in for the first time and enters his pin number, his CLID is associated with that card, but when that cards balance goes to 0 the association of his CLID is still there, regardless of whether he enters a new pin number the system will not associate the new card with the CLID since it already exists (in the 0 balance card) and the customer has to keep on putting in his new pin number. Therefore, i would like either to remove that association or remove the card automatically. I guess i would need to make a script for that right?

  11. Phillip

    Hi Mat

    I set the Not Enough Credit and New Caller ID to YES. This resolved what i wanted to do. Now when a client doesnt have enough balance and enters a new pin number the new pin number is associated with the CLID and removed from the old pin number.

  12. Phillip

    The only thing im having an issue with now is that i get negative balance on some accounts, have you encountered this before?

  13. rachna

    I am very new to A2billing and Asterisk. Just want to know I need to do 2 things:
    1)Customize the web interface of A2Billing and
    2)Customize some features provided by A2Billing

    what is the first step , how should i get started?

  14. rachna

    Thanks for the quick response.I want to reduce the number of features showing on a2billing interface and specifically need to customize the reseller panel.

  15. rachna

    Hi Matt,
    Can you clarify if a2billing gives a feature where you can create mult-level agents?
    This is one of my main requirement.


  16. Roberto

    Hi Matt,

    I´ve configured everything as you suggested and have come across the following issue

    After the pin authentication is performed the system doesn´t prompt me for the destination number but tries to dial the DDI number instead. So weird!! Do you know what could be wrong?


    7/07/2011 14:14:50]:[file:a2billing.php – line:106 – uniqueid:]:[CallerID:]:[CN:]:[IDCONFIG : 1]
    [27/07/2011 14:14:50]:[file:a2billing.php – line:107 – uniqueid:]:[CallerID:]:[CN:]:[MODE : standard]
    [27/07/2011 14:14:50]:[file:Class.A2Billing.php – line:718 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:]:[ get_agi_request_parameter = 4252010344 ; SIP/callcentric-00000006 ; 1311768888.6 ; ; 17772822007]
    [27/07/2011 14:14:50]:[file:a2billing.php – line:162 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:]:[[ANSWER CALL]]
    [27/07/2011 14:15:04]:[file:a2billing.php – line:193 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:6442846455]:[[CHANNEL STATUS : 6 = Line is up]
    [CREDIT : 10.00000][CREDIT MIN_CREDIT_2CALL : 0]]
    [27/07/2011 14:15:04]:[file:a2billing.php – line:396 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:6442846455]:[TARIFF ID -> 2]
    [27/07/2011 14:15:04]:[file:Class.A2Billing.php – line:881 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:6442846455]:[[CALL 2 DID]]
    [27/07/2011 14:15:04]:[file:Class.A2Billing.php – line:896 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:6442846455]:[DESTINATION ::> 17772822007]
    [27/07/2011 14:15:04]:[file:Class.A2Billing.php – line:1017 – uniqueid:1311768888.6]:[CallerID:4252010344]:[CN:6442846455]:[ERROR ::> RateEngine didnt succeed to match the dialed number over the ratecard (Please check : id the ratecard is well create ; if the removeInter_Prefix is set according to your prefix in the ratecard ; if you hooked the ratecard to the Call Plan)]
    [27/07/2011 14:15:04]:[CallerID:4252010344]:[CN:6442846455]:[[exit]]

  17. matt Post author

    You should check a setting called use_dnid in the agi-conf you are using. I think it is set to Yes and should be No.

  18. Roberto

    Matt, sorry to bother you again
    I´ve set up the “say_balance_after_auth” and “say_timetocall” keys to YES in agi-conf1 but when I make a call the system only prompts me to enter the pin and destination number
    I´m using EN as default language
    I must be missing something in the config but can´t figure it out

  19. Roberto

    Matt, sorry to bother you again
    I´ve set up the “say_balance_after_auth” and “say_timetocall” keys to YES in agi-conf1 but the system only prompts me for the PIN and destination number. It doesn´t provide the balance or time info
    The base language is English
    Maybe I´m overlooking something in the A2B config

  20. matt Post author

    There’s an overall play_audio setting that needs to be yes. Other than that I can only think of 2 things – the audio prompts are not installed, or you are not using agi-conf1?

  21. Roberto

    “play_audio” setting is the winner today. Thanks for making my life much easier ;-))

  22. jeff

    Set up voip account under customer, but phone will not register with account number and secret from a2.
    Will only register with extension set up in Elastix. Any ideas?

    Thank you.,

  23. matt Post author

    Which version of Elastix is this. I think in older versions a2billing wasn’t set up correctly and Asterisk did not include the SIP files it generated.

  24. Payam

    How can i set up A2billing that the customer dial a destination an hour per day
    for example he/she can dial +44 destination 1 hour per day

  25. matt Post author

    Not sure you can do something daily. You can create packages with call allowances, but they are weekly/monthly.

  26. rosh

    Hi John,

    I have exactly the same issue that you had.

    “The number you trying to reach is currently unavailable”.

    Would you able to advise me how you fixed that issue.


  27. ricky

    Hi Dear,
    i need to know one thing, my provider allow me prefix 653291xxx for India and i have allowed 454591xxx to my wholesale client for india, can you please help me that how i can do that ?

    many thanks in advance

  28. Matt Newcombe Post author

    You would normally match the rate in the rate card without the prefix, and then add the 653291 prefix on the trunk in a2billing

  29. mohamed

    Hi Matt.

    I got destination unreachable after dialing my DID and putting the pin. I used the simulator and it works fine and also I can make outgoing calls from extensions on xlite.

    does anyone one now how to fix this?


  30. Matt Newcombe Post author

    If the simulator works, but the call doesn’t then it’s normally an issue with the trunk setup. I don’t suppose your trunk name has a space in it?

  31. shehzad khan

    hello sir am using installation freepbx with huawei usb dongle for call termination business i need a2billing for my freepbx can i use it free or have any charges please tell me best regards

  32. Matt Newcombe Post author

    A2Billing is open source so if you run it on your own server there is no cost.

  33. Jonathan

    Hola Matt.
    Estoy teniendo un problema con el registro de callerid, esta puesto pero me sige pidiendo el numero de pin. por donde podria empezar a investigar?? en el CLI de Asterisk cuando hago el llamado en CID = no me aparece mi Did, si no que veo anonymous.

  34. Jonathan

    Hola Matt.
    Estoy teniendo un problema con el registro de callerid, esta puesto pero me sigue pidiendo el numero de pin. por donde podria empezar a investigar??

  35. Matt Newcombe Post author

    The only way to see what’s going on is switch on the detailed a2billing debugging and see what a2billing thinks is happening.

Comments are closed.