A2Billing is a telecom switch and billing system capable of providing and billing a range of telecom products and services to customers such as calling card products, residential and wholesale VoIP termination, DID resale and callback services.
If a customer has $1 balance with a 300 free seconds package offer and dials a destination costing 0.14USD/min ( 60 seconds billing increment), his $callduration calculated by Class.RateEngine.php will be 420 seconds ( 7 minutes ).
So his $cost will be - 3.15 USD. Now when his balance is updated at the end of the call, he will end up with a balance of -2.15 USD. This is wrong.
We need to first subtract the 300 free seconds from $callduration before calculating the cost of the call. So i added the if statement to do that.
If a customer has $1 balance with a 300 free seconds package offer and dials a destination costing 0.14USD/min ( 60 seconds billing increment), his $callduration calculated by Class.RateEngine.php will be 420 seconds ( 7 minutes ).
So his $cost will be - 3.15 USD. Now when his balance is updated at the end of the call, he will end up with a balance of -2.15 USD. This is wrong.
We need to first subtract the 300 free seconds from $callduration before calculating the cost of the call. So i added the if statement to do that.