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

Restricted numbers - failing for all on removeinterprefix
http://forum.asterisk2billing.org/viewtopic.php?f=34&t=9516
Page 1 of 1

Author:  werner [ Fri Jan 27, 2012 4:06 pm ]
Post subject:  Restricted numbers - failing for all on removeinterprefix

Hi Guys,

Just wanted to report a bug which I believe is still present even on the latest code on git.

it is related to this bug http://www.asterisk2billing.org/cgi-bin ... ticket/837 and the fix presented.

If customer A has restricted numbers set, and customer B has restricted numbers set, then you both sets of restricted numbers applied to both customers. The fix in ticket 837 resolved that.

BUT,

if you have removeinterprefix set (i.e. remove 00 before matching rate), then the behaviour, even after the fix in ticket 837 was still broken,

original code from 837 fix
$QUERY = "SELECT * FROM cc_restricted_phonenumber WHERE id_card='".$this->id_card."' AND '".$this->destination."' LIKE number";
if ($this->removeinterprefix) {
$QUERY .= " OR '". $this -> apply_rules ($this->destination)."' LIKE number;

it breaks after the OR statement and forgets (again) to check card id.

The code I am proposing:
$QUERY = "SELECT * FROM cc_restricted_phonenumber WHERE (id_card='".$this->id_card."' AND '".$this->destination."' LIKE number)";
if ($this->removeinterprefix) {
$QUERY .= " OR (id_card='".$this->id_card."' AND '". $this -> apply_rules ($this->destination)."' LIKE number)";

I will test this later, but I believe it will fix this issue.

Author:  werner [ Sun Jan 29, 2012 4:08 pm ]
Post subject:  Re: Restricted numbers - failing for all on removeinterprefix

ok, implemented this fix and it is working for me...individual customers now get individual account restricted numbers even when removeinterprefix is set to yes
8)

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