A2Billing fake ring and incorrect billing for wholesale

A couple of questions I get asked a lot are about A2Billing ‘fake ring’ and the fact that A2Billing starts billing for calls too early (before the call is answered)

Here are some tips for resolving these problems –

Fake ring

As soon as a call (or call request) is passed to A2Billing it is possible for A2Billing to pass back a ringing tone to the caller, while the call is being processed. Most people don’t like this as you can get a situation when the caller hears ringing, and then maybe an engaged or unavailable tone afterwards when the call is actually placed. This can be confusing.

To turn this off means editing the A2Billing dial command. This can be found in the AGI-CONF that you are using. For recent versions of A2Billing you edit this in the GUI, for v1.3 that is included with Elastix you need to edit it in /etc/asterisk/a2billing.conf.

Remove the ‘Rr’ from the dialcommand_param from the AGI-CONF settings like this –

a2billing dialcommand_param

More details about options in the Asterisk ‘dial’ command can be found here – http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial

Incorrect CDR records

When using A2Billing to place SIP or wholesale calls it’s possible that A2Billing will start billing for a call before it is even answered (resulting in incorrect CDR/billing records). The reason that this happens is that Asterisk is answering the call, when it doesn’t need to. It only needs to answer the call if you want to play audio to the caller (balance, time remain etc) but you would not normally do this for SIP/wholesale calls.

If you have this problem there are a few different things to check –

1 – Asterisk dial plan not answering the call

Ensure that in your Asterisk dial plan (this will vary depending how you’ve got A2Billing set up) that the context that SIP calls are getting passed to does not have an ‘Answer’ line in it. The context I use is called ‘a2billing-sip’ and here is the entry in my /etc/asteirsk/extensions_custom.conf –

exten => _X.,1,DeadAGI(a2billing.php|2)
exten => _X.,n,Hangup

Note that this is putting the call through to A2Billing agi-conf2, which will be useful in the next step.

2 -A2Billing is not set to answer the call

In the AGI-CONF that you are using for the SIP calls ensure that ‘answer_call’ is set to no –

answer_call no for SIP calls

3 – Ensure there is no ‘H’ on the Asterisk dial command

As in the fake ring section above I’ve found that having a ‘H’ in the A2Billing dialcommand_param can cause Asterisk to answer the call and cause incorrect billing. If you still have the issue after trying number 1 and 2 above then try taking the ‘H’ out of the dialcommand_param in the AGI-CONF that you are using.

15 thoughts on “A2Billing fake ring and incorrect billing for wholesale

  1. Ali


    I don’t know what to say. i was struggling for a week to find the dialcommand parameters as it wasn’t listed in AGI_conf setting and i just clicked on “Display All” in the bottom to see all those parameters. had to change the pipe to comma as i have asterisk 1.8, and put asterisk version to 1_6 in Agi-Conf cause it seams that A2billing is not recognizing the Asterisk 1.8 yet. also had to remove the ‘R’ ‘r’ and ‘H’ . and all worked.

    appreciate your efforts and I finally made it working with FreePBX 2.9 , asterisk 1.8 and A2billing 1.9.4 all latest versions 🙂

  2. Samuel

    Hello Matt,
    I modified the dialcommand as step one, but it’s not effective, calls still being answered.
    But when i modify the dial plan according to step 2, having the dial plan as:

    exten => _X.,1,AGI(a2billing.php,2)
    exten => _X.,n,Hangup

    a2billing is rebooting the calls as:

    chan_sip.c:21619 handle_request_invite: Call from ‘xxxx’ to extension ‘xxxxxxxxxxx’ rejected because extension not found in context ‘a2billing’.

  3. Samuel

    Hi Matt, do you have any idea to figure out that what I asked for?? Cause for me it’s still giving FAKE, and I’m having problems with the wholesale…

  4. Ahmed

    Hello Matt,
    thanks for all this informations, i made every thing you said, but there is still no success, i am using Elastix 2.0.0 and my problem A2Billing is callculating correct, only one trunk which is installed in africa (Analog) is giving wrong CDR when using this trunk. is there is something elase where i can change? i hope you can give me some tips to solve it

  5. matt Post author

    Unfortunately I’m not sure what the solution would be. For SIP trunks you need to ensure Asterisk does not answer the call, just pass it to the provider. I’m not sure about Analog calls.

  6. Ahmed

    Thank you a lot Matt for your fast answer, ok can you tell me where can i change this configuration in Asterisk files? as i said i am using Elastix 2.0.0 and every call from internal extinsionss are calculated right in the CDR, is there is something what i can change in Asterisk call plane? which file?

  7. Ahmed

    ohhh as i should say, this issue is only for the ouside trunk that i use, even with A2Billing or internal ext. this means that the problem come from Asterisk not from A2Billing by me !! so

  8. matt Post author

    How do your customers connect to the system? Is it via SIP?

    As described above you want to make sure that the context you are using is not answering the call in /etc/asteirsk/extensions_custom.conf

  9. Ahmed

    my cusmters are using sip, from A2Billing (cards), as also internal Ext. i used every thing above, but no success as i told you, i think the problem comes from Asterisk not from A2Billing, but i dont know where to make the changes of the dial Plane in Asterisk to get rid of ‘rR’ because in A2Billing still the same … thank you again for your help

  10. Ahmed

    my dear Matt,
    i tested all the steps above, i think the problem is not in A2Billing, because the issue that i have is also there from the internal exten. in elastix only when i use this sip -:)

  11. Jehanzaib

    Hi folks,

    interesting conversation, i have a quick question if some one can guide me better. i have installed a2billing and everything seems working fine. i am changing a2billing.php. i want to start the dialing at the backend and then play the call minutes ivr. but the dialing should be start as soon as some one diales the number because it takes almost 10 sec to dial out and the minutes remaining ivr usually finishes in 5-6 seconds.

    is anyone can guide me how can i achieve this?

Comments are closed.