The callback divides the credit by 2. This makes a2billing announce and apply a call duration that is half of what it is supposed to be.
The guilty code is
// DIVIDE THE AMOUNT OF CREDIT BY 2 IN ORDER TO AVOID NEGATIVE BALANCE ...
$orig_credit = $A2B -> credit;
$A2B -> credit = $A2B->credit / 2;
I wonder what we a supposed to say to customers to convince them that they can only use half of their remaining balance at a time.
I have to point out that the negative balance scenario was no longer due to a2billing after the last fix. Before the last fix, the negative balance was due to the fact that a2billing was not including the rate of the 1st leg in the calculation of the call duration. That has been fixed since then.
Personnally, 98% (instead of 0% before) of our calls are being disconnected right on time and no negative balance is being observed. If some users are experiencing negative balance, we should investigate if in fact they are using an up to date version of a2billing and we should clearly identify the possible causes of the problem.
I believe that dividing the balance per 2 is not a good solution at all and it lets all the customers unsatisfied. Besides, if the balance can indeed go negative, what should prevent it from going too negative and eating the other half of the balance and beyond?
I volunteer my time to work with whoever reported the problem in order to try to identify the real cause of the problem.