A2B: Setting up a trunk in A2Billing

IP BASED AUTHENTICATION

Setting up a trunk to your call provider in A2Billing is very straightforward if you can use IP based authentication.

All you do is go to the “PROVIDERS / Trunk / Add Trunk” menu and create a new trunk. Here you will provide the protocol used to connect the trunk (SIP/IAX2) and the IP address provided by your call termination provider –

Because we’re using IP based authentication with our provider we don’t need to supply any more details.

USERNAME/PASSWORD BASED AUTHENTICATION

If we are using username/password authentication with our provider then we need to set our trunk up manually in Asterisk. We will give that trunk a name and then use that name, instead of the IP address, in the A2Billing trunk setup screen above.

Here’s an example of setting up a trunk with voip.ms. Many providers will be similar and provide the connection details you need to enter. These settings go in the file /etc/asterisk/sip.conf.

If you need to ‘register’ with your termination provider enter the register line under the existing [general] section –

register => myusername:[email protected]:5060

And then enter the connection details below that. Here we are calling the trunk ‘voipms’. This will be used as the ‘IP Address’ in the A2Billing trunk set up page –

[voipms]
canreinvite=no
context=default
host=london.voip.ms
secret=mypassword
type=peer
username=myusername
disallow=all
allow=ulaw
fromuser=myusername
trustrpid=yes
sendrpid=yes
insecure=invite
nat=no

Next, apply those settings by running a ‘sip reload’ in Asterisk –

[[email protected] ]# asterisk -rv
a2b100*CLI> sip reload
a2b100*CLI> exit

Now we can set up the trunk in A2Billing, using the name we specified above, instead of the IP address –

a2billing_username_password_trunk

17 thoughts on “A2B: Setting up a trunk in A2Billing

  1. Guillermo

    Hi, congratulations on the page, excellent and very useful information.
    I want to ask how I can resolve an issue with having the dialprefix a2billing and freepbx. For example if I have to call a number 035115XXXXXXX (cell Argentina) from my users dial dialprefix now 035115-XXXXXXX SIP trunk does not accept 0 -15.
    My trunk (net2phone) accept a dialprefix 549351-XXXXXXX. Within a trunk allows me to do and it works (remove prefix 035115) + (addprefix 549351). The problem that presents itself is that in Argentina there are 340 mobiles prefix, means that I need to configure trunk 340 (one for each, eliminating the 0 and 15) Is there any way to configure a trunk to remove as follows:
    Removeprefix: 0XXX15
    Addprefix: 549XXX
    I have installed A2billing 1.9 and freepbx 1.8

    Thank you very much!

  2. matt Post author

    Hi Guillermo,

    I don’t totally follow everything you’re trying to do but here’s what I do …

    In the a2billing rate cards have all the rates starting with just the country code. For example a UK rate might be 44123 (where 44 is the country code)

    Use the rules on the FreePBX outbound route to ensure the number is passed to a2billing in that format

    Then on the a2billing trunk add any prefixes that your call provider requires.

  3. Guillermo

    Hi Matt:
    For example, I have 340 different rates in dialprefix.
    Each one has a dialprefix 0XXX15 (035115, 035215, 035315, up to 340 rates).
    My provider does not accept 0 to 15.
    Then I have to create a trunk for each rate so the trunk can remove the prefix 035115. and add 351?
    In the configuration of the trunk does not accept wildcard delete prefixes, eg to remove and add 9XXX 0XXX15. Is that possible?
    Thanks

  4. matt Post author

    I don’t think it’s possible to do a wildcard replace by default on an outbound trunk in a2billing.

    Ideally you want only the rates in the rate card that your provider accepts, and you want them in a format you can easily send the call to the provider.

    Best to do any modification required in FreePBX, before sending to a2billing and matching in the rate card.

  5. Guillermo

    Basic question, how do I create an outbound route in freepbx and associate with a trunk in a2billing?
    Thank you!

  6. Guillermo

    How I can change the context a2billing dialplan?
    For example:
    The dialed number: 0351151234567
    A2billing receives: 0351151234567
    Freepbx must transform to number: 999005493511234567

    It is possible through a2billing/freepbx? Please, how to?

  7. Guillermo

    It’s a server installed myself.
    Works perfect, just that having so many cellular prefixes in Argentina, not find a way not to create a trunk in A2billing for each.

  8. Guillermo

    There is much information on how to integrate freepbx/a2billing, but not very updated.
    So much confused when configure.
    What are the requirements to modify the dialprefix of freepbx-a2billing, achieving send the call to carrier?

  9. matt Post author

    I depends how you want to integrate them? It sounds like you’re not trying to send a FreePBX extension to a2billing, just incoming SIP connection.

    I’m unsure of the easiest way to do the modification. It would either be on the trunk that passes the call to a2billing, on in the dial plan on the conext before the call is given to the a2billing.php script.

  10. Guillermo

    Thanks Matt.
    I feel the same regarding the extension Context.
    In my case the extensions have the following context:
    [a2billing]
    exten => _X., 1, DeadAGI (a2billing.php, 1)
    exten => _X., n, Hangup

    Not sure, but should add something to make it work on outbound routes.

    Thanks.

  11. Guillermo

    Sorry, but we could in any other way ask you questions via MSN or Skype, etc.
    I Would greatly help resolve this problem.
    Thank you very much.

  12. matt Post author

    Unfortunately I’m only able to offer that sort of support to VPS customers. I try to answer questions via the blog where I can, but with different setups on servers etc it’s not always possible.

  13. Guillermo

    Please could you tell me if I have to change some on context?

    There are settings that are added to the context, eg [macro-dialout-trunk-predial-hook]
    But I have no idea.
    Thanks.

  14. Parjeen

    Dear Matt

    Thank you for your tutorial.

    I would like to ask whether it is possible to setup a trunk in my A2Billing system with a normal provider’s user name and password for example:

    I have an account with smartvoip.com and this provider only sells voip call credit to end users and not to other providers, however I would like to be able use my user name and password of the account that I have with smartvoip to create a trunk on my own billing system using your method above because this provider doesn’t provide IPs they only use (sip.smartvoip.com).

    Do you think that is possible with this tutorial or your tutorial is for a different type of providers.

    Please kindly confirm

    Kind regards.
    Parjeen

Comments are closed.