Skip to content

Commit

Permalink
add option to remove any digits on trunk remove prefix, ex: XX will r…
Browse files Browse the repository at this point in the history
…emove the first 2 digit.
  • Loading branch information
magnussolution committed Apr 22, 2022
1 parent 81c2dd4 commit fccf2e6
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion protected/commands/MassiveCallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function run($args)
$extension = $destination;

//retiro e adiciono os prefixos do tronco
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removeprefix));
}

Expand Down
2 changes: 1 addition & 1 deletion protected/commands/Start0800CallBackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function run($args)
$removeprefix = $modelTrunk->removeprefix;
$prefix = $modelTrunk->trunkprefix;

if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removeprefix));
}

Expand Down
2 changes: 1 addition & 1 deletion protected/components/SendCreditDingConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static function getProducts($provider_name)
public function getProviderCode($number)
{
$removeprefix = '00';
if (strncmp($number, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($number, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$number = substr($number, strlen($removeprefix));
}
$ch = curl_init();
Expand Down
2 changes: 1 addition & 1 deletion protected/components/SmsSend.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static function send($modelUser, $destination, $text, $id_phonenumber = 0
$buyRate = isset($modelRateProvider[0]['buyrate']) ? $modelRateProvider[0]['buyrate'] : null;

//retiro e adiciono os prefixos do tronco
if (strncmp($destination, $removePrefix, strlen($removePrefix)) == 0) {
if (strncmp($destination, $removePrefix, strlen($removePrefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removePrefix));
}

Expand Down
2 changes: 1 addition & 1 deletion protected/controllers/Call0800WebController.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function actionCallback()

$yournumber = $yournumber;

if (strncmp($yournumber, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($yournumber, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$yournumber = substr($yournumber, strlen($removeprefix));
}

Expand Down
2 changes: 1 addition & 1 deletion protected/controllers/SmsCallbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function actionRead($asJson = true, $condition = null)
$removeprefix = $modelTrunk->removeprefix;
$prefix = $modelTrunk->trunkprefix;

if (strncmp($callerid, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($callerid, $removeprefix, strlen($removeprefix)) == 0 || || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$callerid = substr($callerid, strlen($removeprefix));
}

Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/CalcAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public function sendCall($agi, $destination, &$MAGNUS, $typecall = 0)
public function sendCalltoTrunk($MAGNUS, $agi, $destination, $prefix, $tech, $ipaddress, $removeprefix, $timeout
, $addparameter, $inuse, $maxuse, $allow_error) {

if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removeprefix));
}

Expand Down
4 changes: 2 additions & 2 deletions resources/asterisk/CallbackAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function callbackCID($agi, $MAGNUS, $CalcAgi, $DidAgi)
$removeprefix = $CalcAgi->tariffObj[0]['rc_removeprefix'];
$prefix = $CalcAgi->tariffObj[0]['rc_trunkprefix'];

if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removeprefix));
}

Expand Down Expand Up @@ -128,7 +128,7 @@ public function callback0800($agi, $MAGNUS, $CalcAgi, $DidAgi)
$destination = $MAGNUS->CallerID;

$removeprefix = $MAGNUS->config['global']['callback_remove_prefix'];
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0 || substr(strtoupper($removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($removeprefix));
}

Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/DidAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function call_did(&$agi, &$MAGNUS, &$CalcAgi, $destinationIvr = false)
$modelTrunk = $agi->query($sql)->fetch(PDO::FETCH_OBJ);

//retiro e adiciono os prefixos do tronco
if (strncmp($destination, $modelTrunk->removeprefix, strlen($modelTrunk->removeprefix)) == 0) {
if (strncmp($destination, $modelTrunk->removeprefix, strlen($modelTrunk->removeprefix)) == 0 || substr(strtoupper($modelTrunk->removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($modelTrunk->removeprefix));
}
$destination = $modelTrunk->trunkprefix . $destination;
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/MassiveCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public function send($agi, &$MAGNUS, &$CalcAgi)
}

//retiro e adiciono os prefixos do tronco
if (strncmp($destination, $modelTrunk->removeprefix, strlen($modelTrunk->removeprefix)) == 0) {
if (strncmp($destination, $modelTrunk->removeprefix, strlen($modelTrunk->removeprefix)) == 0 || substr(strtoupper($modelTrunk->removeprefix), 0, 1) == 'X') {
$destination = substr($destination, strlen($modelTrunk->removeprefix));
}
$destination = $modelTrunk->trunkprefix . $destination;
Expand Down

0 comments on commit fccf2e6

Please sign in to comment.