Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Wed Sep 18, 2019 10:03 pm
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Bug in min_duration_2bill + fix
PostPosted: Thu Jul 24, 2008 2:47 am 
Offline

Joined: Thu Jul 24, 2008 12:28 am
Posts: 1
Hi All,

I noticed that when a call is less than initialblock it is still billed at the billingblock rate :
for example,
Initialblock = 60
billingblock = 120

call duration = 32

this call should be billed as Initialblock = 60 , but now with the curent code it is billed at 120 = 2 minutes.

The problem is in Class.RateEngine.php file in this section:
inside the function rate_engine_calculcost(....
Code:
// 2 KIND OF CALCULATION : PROGRESSIVE RATE & FLAT RATE
// IF FLAT RATE
if (empty($chargea) || $chargea==0 || empty($timechargea) || $timechargea==0 ){
         
if ($billingblock>0) {   //  <<------- This is where the error is
$mod_sec = $callduration % $billingblock; 
if ($mod_sec>0) $callduration += ($billingblock - $mod_sec);
}
$cost -= ($callduration/60) * $rateinitial;



To fix it you only need to change this line
Code:
if ($billingblock>0) {
to
Code:
if (($callduration > $initblock) && ($billingblock > 0)) {


By adding this line you make sure that you do not add any increment to the calls that have durations less then or equal to initialblock.


same thing applies to
Code:
// CALCULATION BUYRATE COST
$buyratecallduration = $callduration;
      
$buyratecost =0;
if ($buyratecallduration<$buyrateinitblock) $buyratecallduration=$buyrateinitblock;
if ($buyrateincrement > 0) {   // <---------------ERROR in here
$mod_sec = $buyratecallduration % $buyrateincrement;
if ($mod_sec>0) $buyratecallduration += ($buyrateincrement - $mod_sec);
}
      
$buyratecost -= ($buyratecallduration/60) * $buyrate;


to fix it
change this
Code:
if ($buyrateincrement > 0) {

to
Code:
if (($buyratecallduration>$buyrateinitblock) && ($buyrateincrement > 0) {

this
Thank you,

Added after 1 hours 51 minutes:

Hi,

Today I have been looking at the code of ClassRateEngine.php and debugging.

I found that if you have this case:
min_duration_2bill = 10 ( or any other number > 0 )
( if there was a problem or the call is less then 10 seconds I don't want to bill the client)

BUT I want to know how much it is costing me, and when i generate a report in order to compare my buycost with my provider's bill, I want them to match.

After fixing the bug, you will have a much more accurate Profit estimate
- assuming the rest of the code that I havn't checked yet is good ;)

The curent code does not bill the client and sets the buycost to zero.

I prefer to keep my buycost as it is and not zero, this way I know how much it is costing me to keep that min_duration_2bill > 0

Look for this code

Code:
$buycost = 0;
if ($doibill==0 || $sessiontime < $A2B->agiconfig['min_duration_2bill'])  $cost = 0;      
  else{
   $cost = $this -> lastcost;
   $buycost = abs($this -> lastbuycost);
}


and change the first line to
Code:
$buycost = abs($this -> lastbuycost);



thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 02, 2008 9:25 am 
Offline

Joined: Fri Aug 08, 2008 12:24 pm
Posts: 81
Location: newark, DE
Good Information, I currently have minimum duration and billing increment all set to zero. I wanted to change them to 6 seconds to save some money. Can someone please explain to me fully how they're related and exactly what they're supposed to do?

Is it a problem now that they're set to 0 on the buyers side and sellers side. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group