I want to put billing increment in this function..
if call is 1.40 (100seconds) long then this function should charge
for 2 min (according to 1 min [60 sec] billing increment)...
and if call is 10 seconds long...then it should charge for 1 min...
=================================
sub calccost() {
my ($adjconn, $adjcost, $answeredtime, $increment) = @_;
my $cost;
$increment = 60; #Added by sadaat-Handle Billing Increment
my $adjtime = eval { $adjtime = int((($answeredtime - $numdata->{includedseconds}) + $increment - 1) / $increment) * $increment;
return $adjtime };
if ($adjtime < 0) {
$adjtime = 0;
}
print STDERR "Adjusted time is $adjtime, cost is $adjcost with $adjconn fee\n";
$cost = ($adjcost * $adjtime / 60) + $adjconn; #Changed
# eval { $cost = int($adjcost * $adjtime / 60) };
# $cost += $adjconn;
print STDERR "Total cost is $cost\n";
return $cost;
}