A2B: Quick start guide to calling card with A2Billing

This post assumes you have completed the steps here – http://sysadminman.net/blog/2011/a2b100-quick-start-guide-to-wholesale-with-a2billing-3127. These are required steps for calling card access also.

After the steps above have been completed all we need to do is create an DDI access number so that we can call in to our A2Billing system

For testing I’m going to use a free DDI number from here – http://www.ukddi.com/

Once you’ve requested your DDI number you should set the destination to be your A2Billing server. I always set the destination number to be the DDI number in international format, as shown here –


Now in Asterisk we need to pass that incoming call through to A2Billing.

We do that by editing the /etc/asterisk/extensions.conf file. I’m going to add the following lines under the [default] section which is where our incoming calls will go.

The section below matches all numbers starting 441604 and passes them to A2Billing as a calling card access number call. Because UKDDI passes the CLID with a plus (+) on the front there are a couple of lines to remove that –

[default]

Example of incoming calls to 44. being sent to a2billing. + sign removed from incoming DDI when set
exten => _441604.,1,GotoIf($["${CALLERID(num):0:1}" != "+"]?noplusatstart)
exten => _441604.,n,Set(CALLERID(num)=${CALLERID(num):1})
exten => _441604.,n(noplusatstart),Goto(a2billing,${EXTEN},1)
exten => _441604.,n,HangUp()

If your DDI number provider doesn’t put a plus (+) on the front and we don’t need to remove it you could just have had –

[default]
exten => _441604.,1,Goto(a2billing,${EXTEN},1)
exten => _441604.,n,HangUp()

Now we just need to reload the Asterisk dial plan by running –

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

Now if I call the access number I am prompted for my “complete pin number”, this is the “ACCOUNT NUMBER” in A2Billing. If I enter this I am then prompted for the number I wish to call and told how much credit I have left.

If my caller ID is presented then next time I call the access number I will not need to enter my account number, the call will be authorised based on my caller ID.

If you want to enable/disable any of the voice prompts, or stop caller ID based authentication then these settings can be found in A2Billing Admin, SYSTEM SETTINGS, Global List, agi-conf1.

The option for caller id authentication is called “cid_enable”

6 thoughts on “A2B: Quick start guide to calling card with A2Billing

  1. Debanjan Basu

    I did just as in the tutorial, now when I am calling my dnid, I am just getting ringing and no voice prompt.

    Please help asap.

  2. py

    Hi Matt

    i followed the steps above and i have a DID set up and i am getting inbound calls from Asterisk to a2billing,
    asking for the pin number and for the number to dial when entered everything just loop again.
    i mmean the number entered is calling my server instead of calling the right number so i getting anonymous calls and if i active anonymous to yes what i would not want to do then i getting a second call adding to the current asking for the number to dial.
    here is console log bellow

    how can i say to asterisk the right number to dial from the a2billing?
    thanks

    Py

    — Executing [[email protected]:4] AGI(“SIP/callwithus-00000006”, “a2billing.php,1”) in new stack
    — Launched AGI Script /var/lib/asterisk/agi-bin/a2billing.php
    — Playing ‘prepaid-you-have’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/3.slin’ (language ‘fr’)
    — Playing ‘euros’ (escape_digits=#) (sample_offset 0)
    — Playing ‘vm-and’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/80.slin’ (language ‘fr’)
    — Playing ‘digits/12.slin’ (language ‘fr’)
    — Playing ‘prepaid-cents’ (escape_digits=#) (sample_offset 0)
    — Playing ‘prepaid-enter-dest.gsm’ (language ‘fr’)
    — Playing ‘prepaid-you-have’ (escape_digits=#) (sample_offset 0)
    == Manager ‘admin’ logged on from 127.0.0.1
    — Playing ‘digits/80.slin’ (language ‘fr’)
    — Playing ‘digits/13.slin’ (language ‘fr’)
    == Manager ‘admin’ logged off from 127.0.0.1
    — Playing ‘prepaid-minutes’ (escape_digits=#) (sample_offset 0)
    — AGI Script Executing Application: (DIAL) Options: (SIP/10.10.12.86/00590xxxxxxx,HRrL(5580000:61000:30000))
    — Limit Data for this call:
    == Using SIP RTP TOS bits 184
    == Using SIP RTP CoS mark 5
    == Using SIP VRTP TOS bits 136
    == Using SIP VRTP CoS mark 6
    — Called 10.10.12.86/00590590xxxxx
    — Got SIP response 482 “Loop Detected” back from 10.10.12.86
    — Now forwarding SIP/callwithus-00000006 to ‘Local/[email protected]’ (thanks to SIP/10.10.10.86-00000007)
    — Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Received incoming SIP connection from unknown peer to 00590xxxxxx”) in new stack
    — Executing [[email protected]:2] Set(“Local/[email protected];2”, “DID=00590xxxxx”) in new stack
    — Executing [[email protected]:3] Goto(“Local/[email protected];2”, “s,1”) in new stack
    — Goto (from-sip-external,s,1)
    — Executing [[email protected]:1] GotoIf(“Local/[email protected];2”, “1?from-trunk,00590xxxxx,1”) in new stack
    — Goto (from-trunk,00590xxxxx,1)
    — Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Catch-All DID Match – Found 00590xxxxx – You probably want a DID for this.”) in new stack
    — Executing [[email protected]:2] Goto(“Local/[email protected];2”, “ext-did,s,1”) in new stack
    — Goto (ext-did,s,1)
    — Executing [[email protected]:1] Set(“Local/[email protected];2”, “__FROM_DID=s”) in new stack
    — Executing [[email protected]:2] Gosub(“Local/[email protected];2”, “app-blacklist-check,s,1”) in new stack
    — Executing [[email protected]:1] GotoIf(“Local/[email protected];2”, “0?blacklisted”) in new stack
    — Executing [[email protected]:2] Return(“Local/[email protected];2”, “”) in new stack
    — Executing [[email protected]:3] ExecIf(“Local/[email protected];2”, “0 ?Set(CALLERID(name)=33xxxxx)”) in new stack
    — Executing [[email protected]:4] Set(“Local/[email protected];2”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
    — Executing [[email protected]:5] Set(“Local/[email protected];2”, “CALLERPRES()=allowed_not_screened”) in new stack
    — Executing [[email protected]:6] Goto(“Local/[email protected];2”, “custom-a2billing,s,1”) in new stack
    — Goto (custom-a2billing,s,1)
    — Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “A2Billing Start”) in new stack
    — Executing [[email protected]:2] Answer(“Local/[email protected];2”, “”) in new stack
    — Local/[email protected];1 answered SIP/callwithus-00000006
    — Executing [[email protected]:3] Wait(“Local/[email protected];2”, “2”) in new stack
    — Executing [[email protected]:4] AGI(“Local/[email protected];2”, “a2billing.php,1”) in new stack
    — Launched AGI Script /var/lib/asterisk/agi-bin/a2billing.php
    — Playing ‘prepaid-you-have’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/3.slin’ (language ‘fr’)
    — Playing ‘euros’ (escape_digits=#) (sample_offset 0)
    — Playing ‘vm-and’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/60.slin’ (language ‘fr’)
    — Playing ‘digits/11.slin’ (language ‘fr’)
    — Playing ‘prepaid-cents’ (escape_digits=#) (sample_offset 0)
    — Playing ‘prepaid-enter-dest.gsm’ (language ‘fr’)
    — Playing ‘prepaid-enter-dest.gsm’ (language ‘fr’)
    — Playing ‘prepaid-final’ (escape_digits=#) (sample_offset 0)
    == Spawn extension (custom-a2billing, s, 4) exited non-zero on ‘Local/[email protected];2’
    — Playing ‘prepaid-you-have’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/3.slin’ (language ‘fr’)
    — Playing ‘euros’ (escape_digits=#) (sample_offset 0)
    == Manager ‘admin’ logged on from 127.0.0.1
    — Playing ‘vm-and’ (escape_digits=#) (sample_offset 0)
    — Playing ‘digits/80.slin’ (language ‘fr’)
    == Manager ‘admin’ logged off from 127.0.0.1
    — Playing ‘digits/8.slin’ (language ‘fr’)
    — Playing ‘prepaid-cents’ (escape_digits=#) (sample_offset 0)
    == Manager ‘admin’ logged on from 127.0.0.1
    — Playing ‘prepaid-enter-dest.gsm’ (language ‘fr’)

  3. matt Post author

    I’d check under agi-conf1 settings that you have use_dnid set to no, not yes

  4. Najib

    Hi Matt,

    This is stripping away + sign from a DDI… But how do I strip away “+” (plus sign) from dialed/called numbers. Most phones have international numbers saved with a “+” sign in their address books, and while calling from a Mobile Soft-phone that number gets sent to the server with the +. How can we make sure those calls still work?

    I tried adding + into Global-list> international_prefixes, but it doesn’t work that way.

    Please advise.

    Thank you

    Najib

  5. matt Post author

    Hi Najib

    You should be able to do this by editing the context that the a2billing customer is using. So check the a2billing sip account settings and look at CONTEXT. On a SysAdminMan server this would be a2billing-sip. So then you’d edit that context and add some lines to match numbers starting with a + and remove it.

Comments are closed.