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

Callback Time is wrong calculated (no 1.st Leg) - (FIXED)
http://forum.asterisk2billing.org/viewtopic.php?f=16&t=4468
Page 1 of 1

Author:  foxxx [ Fri Oct 24, 2008 10:20 pm ]
Post subject:  Callback Time is wrong calculated (no 1.st Leg) - (FIXED)

Hello Community,

many admins have problems with wrong calltime calculation on callback's (CID, WEB), it even can result in negative users credit ... :evil:

i use the latest stable V 1.3.4 - i have investigated this for many, many hours now ...

i came up with a solution, that works for me ... so far ...

so i will share it here :-) :

-) for 1.st leg, caller need at least 60 sec. to get a callback
around line 454 i changed:

Code:
if ($res_all_calcultimeout) {


to
Code:
if ($res_all_calcultimeout > 60) {


-) remove the dirty calculation (division)
around line 823 i changed:

Code:
$orig_credit = $A2B -> credit;
$A2B -> credit = $A2B->credit / 2;


to

Code:
$orig_credit = $A2B -> credit;
// $A2B -> credit = $A2B->credit / 2;


-) i added this code, so the rateengine can caclulate including the 1.st leg
around line 792 i added:

before this line
Code:
$A2B -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "[CALLBACK]:[GET VARIABLE : CALLED=$called_party | CALLING...


i added my code
Code:
// foxxx | quick and dirty bug fix - to calculate the correct callbacktime (including the first leg)                                     
$RateEngine->Reinit();                                                                                                                   
if ($RateEngine->rate_engine_findrates($A2B, $called_party, $A2B -> config["callback"]['all_callback_tariff'])) {                       
    $agi -> set_variable('RATEINITIAL', round(abs($RateEngine->ratecard_obj[0][12]),4));
    $agi -> set_variable('ANSWEREDTIME', 15); // add 15 seconds from pickup the first leg until ratecalculation
}


:arrow: PS: my line numbers are not exactly the same, because i hacked a lot around

Hope this helps
Greetings from Austria

foxxx

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