asterisk2billing.org
http://forum.asterisk2billing.org/

Bug fixes + improvements A2B 1.9.4
http://forum.asterisk2billing.org/viewtopic.php?f=34&t=9308
Page 1 of 1

Author:  vulcan [ Sun Nov 13, 2011 1:06 am ]
Post subject:  Bug fixes + improvements A2B 1.9.4

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.

Attachments:
File comment: Install this patch second
star194b.txt [1.14 KiB]
Downloaded 610 times
File comment: Install this patch first
star194.txt [6.97 KiB]
Downloaded 598 times

Author:  ubunter [ Fri Jan 13, 2012 7:38 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

Hi Vulcan,

This thread as 9308 is after the thread http://forum.asterisk2billing.org/viewtopic.php?f=35&t=9302 where you have patched a2billing to control the balance.
I don't see this script including that patch, so, after patching hear, have to follow the other as another update, right?

Just wanted to be sure, as I don't see the reference to that issue in this patch!

Regards,

Author:  vulcan [ Fri Jan 13, 2012 9:51 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

This thread 9308 patch fixes all the bugs I've found so far in a2b. That is all you need. It must be installed to a fresh copy of A2B 1.9.4 before any other changes to the code. I understand you have already patched a fresh copy of A2B. Use that patched copy. This patch, in addition to fixing the bugs, does a few minor enhancements.

9302 viewtopic.php?f=35&t=9302 is not necessary. It just acts as a cop to make sure the credit limit is not exceeded by running as a cron job and constantly checking on asterisk. I did not create a patch for this change. It has to be done manually based on the instructions.

Author:  vulcan [ Tue Jan 24, 2012 7:09 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

UPDATE!!
Uploaded a second patch that fixes the first patch. Patches are to be installed in the sequence given.


Reason:
The first patch did not fix the problem with postpaid credit verification entirely. The solution was to simply compare the credit. eg;
Code:
if ( $this->credit <= 0) {

Author:  ubunter [ Mon Jan 30, 2012 2:25 pm ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

Hi Vulcan,
After this patch, I'm just looking into our system, and I just found some accounts with negative balance 50 or 60 cents making some calls in the last few days, where last call was within 2 or 3 cents per minutes, I mean, the call wasn't interrupted, even within 20 mints after going into negative balance...
I'm just checking the cron, it's working and running each 30 seconds, no errors, but calls wasn't interrupted, strangely...

Regards,

Author:  vulcan [ Mon Jan 30, 2012 3:50 pm ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

you mentioned four subjects. Consider the first three.


Patch - which one(s)?
credit overun - when , what date?
Cron - which name and version?

Author:  ubunter [ Tue Jan 31, 2012 1:06 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

Sorry, I mean, the previous patch, referring in this thread, patching Class.A2Billing.php...:)

Author:  vulcan [ Tue Jan 31, 2012 3:50 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

Can you be more specific? there are two pacthes posted. Can you also answer the other two questions? You had a bad dial string up until recently. Your bad dial string did not produce a timeout value.

Author:  ubunter [ Tue Jan 31, 2012 11:44 am ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

vulcan wrote:
Can you be more specific? there are two pacthes posted. Can you also answer the other two questions? You had a bad dial string up until recently. Your bad dial string did not produce a timeout value.



Hello again Vulcan,
I'm referring to the first patch, into the prepaid service, i haven't implemented your last proposition for the postpaid as we don't use it...

Regarding to the dialcommand, I turn to this:
Quote:
|60|IWXoL(%timeout%:60000:30000)


As you recommend, and the negative balance, was reproduced after this modification...

Even, i'm thinking, and looking around to modify this dialcommand, as the agi script is failing in handle the DIALSTATUS application, and not sending on time the missed calls to the voice mail... but this is other issue far away from billing which we're discussing in this thread...

Regards,

Author:  vulcan [ Tue Jan 31, 2012 7:37 pm ]
Post subject:  Re: Bug fixes + improvements A2B 1.9.4

Both patches relate to postpaid credit verification. Prepaid is unchanged.

When you make a claim, you should provide call logs as proof or a way to reproduce it. Show the dial string sent to asterisk with the timeout value, call log and credit remaining.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/