If POSTPAID peer calls a local non-free DID user and the credit is already in negative, the timeout value is not calculated correctly and therefore sends an incorrect timeout value in the dial string.
For example if the postpaid balance is -10.00 and the credit limit is 7 the credit is calculated to be -3.00
This user is not supposed to make calls. This is the current code to check this condition. As you can see it will pass because -3 is not less than -7 (note the minus sign before $this-credit limit)
Code:
if ($this->credit <= -$this->creditlimit) {
This code fixes the problem by resolving to true to enter the if block in the case of no credit.
Code:
if ($this->credit <= 0) {
This same peer is always able to call the local DID user once the credit is negative and there is a credit limit configured.
After fixing this problem and giving the user some credit, you find that the peer cannot make any calls because it has a parallel bug later in the code.
There are some other fixes in the included attached file for sign up form to preserve the values entered when they get the captcha wrong.
How to install this code:
1. Extract a fresh copy of version 1.9.4 to a folder.
2. Download this patch below and put it in the same folder
3. Change to the folder , eg; cd Star2Billing
4. Execute the patch command: patch -p1 < star194.txt
You can then use this patched copy of 1.9.4. If you move or copy this folder you must be aware of the symbolic links to the lib directory.