Skip to content

Commit

Permalink
fix OpsnSips issue
Browse files Browse the repository at this point in the history
  • Loading branch information
callcenter-magnus committed Oct 30, 2023
1 parent 9ab2c41 commit 355a2b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
17 changes: 9 additions & 8 deletions protected/commands/SipProxyAccountsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function run($args)
$modelServers = Servers::model()->findAll('type = "asterisk" AND status IN (1,3,4) AND weight > 0');
foreach ($modelServers as $key => $server) {
if ($server->last_call_id > 0) {
$modelCall = Call::model()->findBySql('SELECT id,starttime FROM pkg_cdr WHERE id > :key1 AND id_server = :key ORDER BY id DESC LIMIT 1', array(
$modelCall = Call::model()->findBySql('SELECT id,starttime FROM pkg_cdr WHERE id > :key1 AND id_server = :key ORDER BY id DESC LIMIT 1', [
'key' => $server->id,
':key1' => $server->last_call_id,
));
]);
} else {
$modelCall = Call::model()->findBySql('SELECT id,starttime FROM pkg_cdr WHERE starttime > :key1 AND id_server = :key LIMIT 1', array(
$modelCall = Call::model()->findBySql('SELECT id,starttime FROM pkg_cdr WHERE starttime > :key1 AND id_server = :key LIMIT 1', [
'key' => $server->id,
':key1' => date('Y-m-d'),
));
]);
}
if (isset($modelCall->id)) {
$server->last_call = $modelCall->starttime;
Expand Down Expand Up @@ -63,7 +63,7 @@ public function run($args)
} else if (preg_match("/\|/", $server->description)) {
$remoteProxyIP = explode("|", $server->description);
$remoteProxyIP = end($remoteProxyIP);
if (!filter_var($remoteProxyIP, FILTER_VALIDATE_IP)) {
if ( ! filter_var($remoteProxyIP, FILTER_VALIDATE_IP)) {
$remoteProxyIP = $hostname;
}
} else {
Expand Down Expand Up @@ -99,6 +99,10 @@ public function run($args)
} catch (Exception $e) {
//
}

foreach ($modelTrunk as $key => $trunk) {
$sqlproxyadd .= "('0', '$trunk->host','0', '" . $trunk->trunkcode . '|' . $trunk->trunkcode . '|500|0|' . $techprefix_length . "'),";
}
foreach ($modelSip as $key => $sip) {

if ($sip->host == 'dynamic') {
Expand All @@ -107,9 +111,6 @@ public function run($args)
$sqlproxyadd .= "('0', '$sip->host','0', '" . $sip->idUser->username . '|' . $sip->name . '|' . $sip->idUser->cpslimit . '|' . $sip->techprefix . '|' . $techprefix_length . "'),";
}
}
foreach ($modelTrunk as $key => $trunk) {
$sqlproxyadd .= "('0', '$trunk->host','0', '" . $trunk->trunkcode . '|' . $trunk->trunkcode . '|500|0|' . $techprefix_length . "'),";
}

foreach ($modelDid as $key => $did) {
if (isset($did->idServer->name)) {
Expand Down

0 comments on commit 355a2b4

Please sign in to comment.