asterisk2billing.org
http://forum.asterisk2billing.org/

Charging for ANSWERED calls
http://forum.asterisk2billing.org/viewtopic.php?f=18&t=8962
Page 1 of 1

Author:  marcin [ Sat Jun 25, 2011 3:45 pm ]
Post subject:  Charging for ANSWERED calls

I have many user abusing the system and making calls with 0 duration to expensive destinations.
My carriers are changing me for the calls, but a2b is showing ANSWERED with 00:00 duration and my treat.
I attempted to patch the code but without success.

This is my attempt
in Class.RateEngine.php

section: /*
* RATE ENGINE - UPDATE SYSTEM (DURATIONCALL)
* Calcul the duration allowed for the caller to this number
*/


} else {
$sessiontime = $this -> answeredtime;
$dialstatus = $this -> dialstatus;

if ($this->dialstatus == "ANSWER" && $sessiontime = 0) {
$sessiontime = $sessiontime + 1;
$this -> answeredtime = $sessiontime;
$sessiontime = $this -> answeredtime;
}

}
What I am trying to do is add 1 second to answered time when dial status is answered and call duration is 0 to trigger billing but so far without a success.

Any help would be appreciated.

Author:  jroper [ Sun Jun 26, 2011 7:03 am ]
Post subject:  Re: Charging for ANSWERED calls

Hi

Have you worked out the mechanism by which you are being defrauded?

Joe

Author:  marcin [ Sun Jun 26, 2011 3:04 pm ]
Post subject:  Re: Charging for ANSWERED calls

Not yet, but the primary destinations are Honduras mobile and Guatemala mobile. I see 100s of these calls per week and my carriers are charging for them with duration of 1 sec. I can only guess that some of the numbers may be PPC destinations.

Author:  jroper [ Sun Jun 26, 2011 3:20 pm ]
Post subject:  Re: Charging for ANSWERED calls

Hi

You are going to have to work out the method of fraud, then we can advise the best way of defending against it,

Joe

Author:  marcin [ Fri Jul 08, 2011 2:28 pm ]
Post subject:  Re: Charging for ANSWERED calls

Sure. the problem is that A2B is not charging for answered calls that are shorter then 1 sec..

Anyone?
I will be happy to pay for a patch that will trigger billing for 1 second on every answered call with the call duration 0.

PM me please .
I am loosing too much money.

Author:  jroper [ Fri Jul 08, 2011 3:22 pm ]
Post subject:  Re: Charging for ANSWERED calls

Hi

To confirm, you are showing a call of less than one second, which is not being billed, but you are showing a disposition of answer, is that correct?

Your carrier is showing a corresponding call, and the duration for which you are only being charged for one second.

Please confirm that the amount of time you are recording and the amount of time your carrier is recording is not wildly different.

If this is the case, you can in the rate tables, set a min duration to bill, you can also set a minimum charge, providing the call is show as answered by A2Billing.

Joe

Author:  marcin [ Fri Jul 08, 2011 3:37 pm ]
Post subject:  Re: Charging for ANSWERED calls

Yes, Yes and Yes.

setting a minimum charge creates a problem:
Customer will see a duration 0.00 and a charge for a call in a call log.

I have try every possible setting available form admin interface and I continue to see answered calls with 0.00 duration and buy/sell 0.000 0.000

Carrier is charging for answered call a minimium billing block: 1 sec, 6 sec or 30 sec but I end-up giving it for free.

Author:  jroper [ Fri Jul 08, 2011 3:43 pm ]
Post subject:  Re: Charging for ANSWERED calls

Hi

I would suggest that you do use a minimum charge, you can defend this with your customer on the basis that the call was answered, simply that rounding causes the call to be shown as 00:00 rather than 00:01.

Yours

Joe

Author:  marcin [ Fri Jul 08, 2011 6:07 pm ]
Post subject:  Re: Charging for ANSWERED calls

I tested the minimum charge and the call is not being charged.
The log indicated answered duration 00:00 and buy/sell 0.00/0.00.

My offer stands:
I will pay for writing the patch for me to add 1 second to duration and trigger charge for the call if status is answered and duration = 0

Marcin

Author:  marcin [ Sat Jul 09, 2011 2:20 am ]
Post subject:  Re: Charging for ANSWERED calls (resolved)

In last 24 hours I had over 3000 calls answered with duration 0 and not charged to a customer.

The problem is Asterisk reporting of agi var ANSWEREDTIME and the way the a2b is interpreting it.
This is my fix in Class.RateEngine.php around line 1300.


$answeredtime = $agi->get_variable("ANSWEREDTIME");

$zumzum = $answeredtime['data'];
if ($zumzum == 0)
$newtime = 1;
else
$newtime = $answeredtime['data'];
$this -> real_answeredtime = $this -> answeredtime = $newtime;

// $this -> real_answeredtime = $this -> answeredtime = $answeredtime['data'];
$dialstatus = $agi->get_variable("DIALSTATUS");
$this -> dialstatus = $dialstatus['data'];

Tested with A2Billing 1.9.4 (Cuprum)

Author:  davidmorris [ Fri Sep 05, 2014 1:31 pm ]
Post subject:  Re: Charging for ANSWERED calls

Hi,

I know this is a very old thread, but my experience may help someone. I was terminating calls to Gambia and found that we were get many many thousands of calls all at 0 or 1 seconds.
To detect what was happening I checked the SIP packets using asterisk cli and type "sip set debug ip xxx.xxx.xxx.xxx" where you insert the IP of your customer instead of xxx.
When the packets come in try to see if you are sending them a SIP OK (means it connected) and then immediately they send to you a SIP BYE message. This is what was happening with me. I spent many weeks trying to debug the problem, and thousands of pounds in revenue. My clients always blamed my switch saying it was not their customer who was sending the BYE packet (although I could see it was). They also tried to say I was using an unsupported codec so when the RTP traffic / media was connected the switches couldn't interpret the media and so hung up (also false).

I had many customers all doing the same, which was because they were reselling my route and eventually somewhere at the top of the chain was someone who just wanted to get live Gamia numbers. That means they generated completely made up numbers, randomised them and then attempted to make VOIP calls to them. If the call connected they hung up and marked it as a live number. If the call didnt connect then they marked it as a dead number. Because they were only paying for 0 or 1 second per live number and not for any dead number then it was a cheap way for them to detect which numbers were live in Gambia.

The problem was so severe that the Gambian government implemented a minimum call duration charge of 60seconds in 2013 for all calls terminating into Gambia.
As soon as that came into effect and I started billing my customers 60s for every 0 or 1 s call then the calls stopped.

Author:  pawel319 [ Fri Nov 21, 2014 9:30 pm ]
Post subject:  Re: Charging for ANSWERED calls

I modified the file: "Class.RateEngine.php" to solve this problem:

at the end of "public function rate_engine_performcall" I was add:
if ($this->answeredtime==0) {$this->answeredtime=1;}

Now it looks like this
Quote:
...
elseif ($this->dialstatus == "ANSWER") {
$A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "-> dialstatus : " . $this->dialstatus . ", answered time is " . $this->answeredtime . " \n");
if ($this->answeredtime==0) {$this->answeredtime=1;} //my change
$A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "poprawnione: -> dialstatus : " . $this->dialstatus . ", answered time is " . $this->answeredtime . " \n"); //debug
}
$this->usedratecard = $k;
$A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[USEDRATECARD=" . $this->usedratecard . "]");

return true;
...


it works for me

Pawel

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/