Question : Asterisk CDR "billsec" problem

I have a prepaid calling cards scenario that is facing billing problems. Below are the details:

I have a toll free number (1800) connected to a PSTN. The PSTN is connected to Cisco Voice Gateway AS5400 via E1 PRI.

Calls coming from the 1800 goes to the Cisco Gateway which, based on a dial-peer, will send calls to an Asterisk server (version 1.2.22).

Asterisk receives calls from the Cisco Gateway and matches a dial plan in the extensions.conf.

The first thing to be executed is an AGI perl script that welcomes the caller and asks him to enter PIN number. After the PIN, the script asks the caller to enter destination number and to press #. The script will finish and exits. The next thing to be executed is the function Dial() that sends the call to a softswitch in order to terminate the call.

In the AGI perl script I have to Answer() the channel in order to hear announcements. The reason I use Answer() is that calls coming from local PSTNs do not support early media and so without Answer() announcements can not be heard.

Asnwer() function will open the channel and so billsec will start to count. This is wrong because I want to charge customer once the called side answers the phone and not from the moment the IVR starts to play.

Trying to solve this, I came into ForkCDR(). I use the ForkCDR() with option a. This would result in two entries of CDRs. The second entry will have duration and billsec parameters correctly. The first entry will have duration and billsec equal to ZERO.

I use an AGI perl script for the billing. This script uses the first entry with billsec equal to ZERO and so it does not charge the customer when the calls pass through.

How can I tell the script to take the last entry in the CDR list?

I am trying to solve this problem for more than two weeks now with no luck.

Please HELP.

Answer : Asterisk CDR "billsec" problem

Why don't you try to use ResetCDR() instead of ForkCDR().

ResetCDR() will result in only one entry and will also solve your problem.

Take a look at the link below:

http://www.voip-info.org/wiki/view/Asterisk+cmd+ResetCDR

You may have to use option "v".

Good luck.
Random Solutions  
 
programming4us programming4us