Skip to content

Commit

Permalink
fix some issue on DEBIAN 12
Browse files Browse the repository at this point in the history
  • Loading branch information
callcenter-magnus committed Aug 13, 2024
1 parent c110f76 commit 04c6865
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 28 deletions.
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions protected/components/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ public function actionReport()
$sort = $sort ? $firstSort . implode(',', $sort) : null;

$this->sort = $this->replaceOrder();
if ( ! strlen($this->sort)) {
$this->order = $this->attributeOrder;
}

$this->select = $this->getColumnsFromReport($columns, $fieldGroup, 'pdf');

Expand Down
8 changes: 4 additions & 4 deletions protected/controllers/RateProviderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function importRates($values)

}

$sql = "UPDATE pkg_rate_provider t JOIN pkg_prefix p ON t.dialprefix = p.prefix SET t.id_prefix = p.id, t.dialprefix = NULL, t.destination = NULL WHERE dialprefix > 0 AND p.prefix > 0";
$sql = "UPDATE pkg_rate_provider t JOIN pkg_prefix p ON t.dialprefix = p.prefix SET t.id_prefix = p.id, t.dialprefix = NULL, t.destination = NULL WHERE dialprefix IS NOT NULL AND p.prefix > 0";
try {
Yii::app()->db->createCommand($sql)->execute();
} catch (Exception $e) {
Expand All @@ -203,7 +203,7 @@ public function importRates($values)

}

$modelRate = RateProvider::model()->findAll('dialprefix > 0');
$modelRate = RateProvider::model()->findAll('dialprefix IS NOT NULL');
if (isset($modelRate[0]->id)) {
//check if there are more than 2000 new prefix, if yes, import using LOAD DATA.
if (count($modelRate) > 2000) {
Expand All @@ -226,7 +226,7 @@ public function importRates($values)
}
}

$sql = "UPDATE pkg_rate_provider t JOIN pkg_prefix p ON t.dialprefix = p.prefix SET t.id_prefix = p.id, t.dialprefix = NULL, t.destination = NULL WHERE dialprefix > 0";
$sql = "UPDATE pkg_rate_provider t JOIN pkg_prefix p ON t.dialprefix = p.prefix SET t.id_prefix = p.id, t.dialprefix = NULL, t.destination = NULL WHERE dialprefix IS NOT NULL";
try {
Yii::app()->db->createCommand($sql)->execute();
} catch (Exception $e) {
Expand All @@ -238,7 +238,7 @@ public function importRates($values)

}

RateProvider::model()->updateAll(['dialprefix' => null, 'destination' => null], 'dialprefix > 0');
RateProvider::model()->updateAll(['dialprefix' => null, 'destination' => null], 'dialprefix IS NOT NULL');

}

Expand Down
10 changes: 5 additions & 5 deletions resources/asterisk/CallbackAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

class CallbackAgi
{
public function callbackCID($agi, $MAGNUS, $CalcAgi, $DidAgi)
public static function callbackCID($agi, $MAGNUS, $CalcAgi, $DidAgi)
{
$agi->verbose("MAGNUS CID CALLBACK");
$MAGNUS->agiconfig['cid_enable'] = 1;

if ($MAGNUS->dnid == 'failed' || !is_numeric($MAGNUS->dnid)) {
if ($MAGNUS->dnid == 'failed' || ! is_numeric($MAGNUS->dnid)) {
$agi->verbose("Hangup becouse dnid is OutgoingSpoolFailed", 25);
$MAGNUS->hangup($agi);
exit;
Expand Down Expand Up @@ -119,7 +119,7 @@ public function callback0800($agi, $MAGNUS, $CalcAgi, $DidAgi)

$agi->verbose("MAGNUS 0800 CALLBACK");

if ($MAGNUS->dnid == 'failed' || !is_numeric($MAGNUS->dnid)) {
if ($MAGNUS->dnid == 'failed' || ! is_numeric($MAGNUS->dnid)) {
$agi->verbose("Hangup becouse dnid is OutgoingSpoolFailed");
$MAGNUS->hangup($agi);
exit;
Expand All @@ -140,7 +140,7 @@ public function callback0800($agi, $MAGNUS, $CalcAgi, $DidAgi)
$sql = "SELECT * FROM pkg_sip WHERE id_user = " . $DidAgi->modelDestination[0]['id_user'] . " LIMIT 1";
$MAGNUS->modelSip = $agi->query($sql)->fetch(PDO::FETCH_OBJ);

if (!isset($MAGNUS->modelSip->id)) {
if ( ! isset($MAGNUS->modelSip->id)) {
$agi->verbose("Username not have SIP ACCOUNT");
$MAGNUS->hangup($agi);
return;
Expand Down Expand Up @@ -188,7 +188,7 @@ public function callback0800($agi, $MAGNUS, $CalcAgi, $DidAgi)
public static function chargeFistCall($agi, $MAGNUS, $CalcAgi, $sessiontime = 0)
{

if ($MAGNUS->dnid == 'failed' || !is_numeric($MAGNUS->dnid)) {
if ($MAGNUS->dnid == 'failed' || ! is_numeric($MAGNUS->dnid)) {
$agi->verbose("Hangup becouse dnid is OutgoingSpoolFailed", 25);
$MAGNUS->hangup($agi);
exit;
Expand Down
3 changes: 2 additions & 1 deletion resources/asterisk/DidAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ public function call_did(&$agi, &$MAGNUS, &$CalcAgi, $destinationIvr = false)

$MAGNUS->extension = $MAGNUS->destination = $MAGNUS->dnid = $modelSip->name;

$dialResult = SipCallAgi::processCall($MAGNUS, $agi, $CalcAgi, $this->did);
$SipCallAgi = new SipCallAgi();
$dialResult = $SipCallAgi->processCall($MAGNUS, $agi, $CalcAgi, $this->did);

$dialstatus = $dialResult['dialstatus'];
$answeredtime = $dialResult['answeredtime'];
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/IvrAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class IvrAgi
{
public function callIvr(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi = null, $type = 'ivr')
public static function callIvr(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi = null, $type = 'ivr')
{

$agi->verbose("Ivr module", 5);
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/MassiveCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class MassiveCall
{
public function send($agi, &$MAGNUS, &$CalcAgi)
public static function send($agi, &$MAGNUS, &$CalcAgi)
{

require_once 'Tts.php';
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/PickupAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class PickupAgi
{
public function execute(&$agi, &$MAGNUS)
public static function execute(&$agi, &$MAGNUS)
{
$sql = "SELECT * FROM pkg_sip WHERE ( name = '" . substr($MAGNUS->dnid, 2) . "' OR alias = '" . substr($MAGNUS->dnid, 2) . "' ) AND accountcode = '$MAGNUS->accountcode' LIMIT 1";

Expand Down
4 changes: 2 additions & 2 deletions resources/asterisk/PortalDeVozAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class PortalDeVozAgi
{

public function send(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi)
public static function send(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi)
{
$agi->answer();
$agi->verbose('PortalDeVozAgi');
Expand All @@ -31,7 +31,7 @@ public function send(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi)
$sql = "SELECT * FROM pkg_sip WHERE name = '$MAGNUS->dnid' OR alias = '$MAGNUS->dnid' LIMIT 1 ";
$MAGNUS->modelSip = $agi->query($sql)->fetch(PDO::FETCH_OBJ);

if (!isset($MAGNUS->modelSip->id)) {
if ( ! isset($MAGNUS->modelSip->id)) {
$agi->verbose('User no found', 15);
$agi->stream_file('prepaid-invalid-digits', '#');
continue;
Expand Down
4 changes: 2 additions & 2 deletions resources/asterisk/QueueAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class QueueAgi
{
public function callQueue(&$agi, &$MAGNUS, &$CalcAgi, $DidAgi = null, $type = 'queue', $startTime = 0)
public static function callQueue(&$agi, &$MAGNUS, &$CalcAgi, $DidAgi = null, $type = 'queue', $startTime = 0)
{
$agi->verbose("Queue module", 5);
$MAGNUS->sip_account = '';
Expand Down Expand Up @@ -125,7 +125,7 @@ public function callQueue(&$agi, &$MAGNUS, &$CalcAgi, $DidAgi = null, $type = 'q
if ($siptransfer['data'] != 'yes' && $type == 'queue') {

$CalcAgi->real_sessiontime = intval($CalcAgi->sessiontime);
if (!is_null($DidAgi)) {
if ( ! is_null($DidAgi)) {
$DidAgi->billDidCall($agi, $MAGNUS, $CalcAgi->sessiontime, $CalcAgi);
}

Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/SearchTariff.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function find(&$MAGNUS, &$agi)
"ORDER BY LENGTH( prefix ) DESC LIMIT 1";
$result = $agi->query($sql)->fetchAll(PDO::FETCH_ASSOC);

if (!is_array($result) || count($result) == 0) {
if ( ! is_array($result) || count($result) == 0) {
return 0;
}

Expand Down
16 changes: 8 additions & 8 deletions resources/asterisk/SipCallAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class SipCallAgi
{

public function processCall(&$MAGNUS, &$agi, &$CalcAgi, $type = 'normal')
public static function processCall(&$MAGNUS, &$agi, &$CalcAgi, $type = 'normal')
{
if (($MAGNUS->agiconfig['use_dnid'] == 1) && (strlen($MAGNUS->dnid) > 2)) {
$MAGNUS->destination = $MAGNUS->dnid;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function processCall(&$MAGNUS, &$agi, &$CalcAgi, $type = 'normal')

$agi->verbose("[" . $MAGNUS->username . " Friend]:[ANSWEREDTIME=" . $answeredtime . "-DIALSTATUS=" . $dialstatus . "]", 6);

if (!preg_match('/^CANCEL|^ANSWER/', strtoupper($dialstatus))) {
if ( ! preg_match('/^CANCEL|^ANSWER/', strtoupper($dialstatus))) {

$sql = "SELECT * FROM pkg_sip WHERE name = '$MAGNUS->destination' LIMIT 1 ";
$modelSipForward = $agi->query($sql)->fetch(PDO::FETCH_OBJ);
Expand Down Expand Up @@ -107,14 +107,14 @@ public function processCall(&$MAGNUS, &$agi, &$CalcAgi, $type = 'normal')

$MAGNUS->hangup($agi);
} else {
return array(
return [
'dialstatus' => $dialstatus,
'answeredtime' => $answeredtime,
);
];
}
}

public function callForward($MAGNUS, $agi, $CalcAgi, $modelSipForward)
public static function callForward($MAGNUS, $agi, $CalcAgi, $modelSipForward)
{

$forward = explode(("|"), $modelSipForward->forward);
Expand All @@ -137,7 +137,7 @@ public function callForward($MAGNUS, $agi, $CalcAgi, $modelSipForward)
$sql = "SELECT * FROM pkg_sip WHERE sip_group = '$optionValue'";
$modelSip = $agi->query($sql)->fetchAll(PDO::FETCH_OBJ);

if (!isset($modelSip[0]->id)) {
if ( ! isset($modelSip[0]->id)) {
$agi->verbose('GROUP NOT FOUND');
$agi->stream_file('prepaid-invalid-digits', '#');
}
Expand Down Expand Up @@ -195,7 +195,7 @@ public function callForward($MAGNUS, $agi, $CalcAgi, $modelSipForward)

}

public function smsForward($MAGNUS, $agi, $CalcAgi, $optionValue)
public static function smsForward($MAGNUS, $agi, $CalcAgi, $optionValue)
{
$agi->verbose("try send SMS", 5);

Expand Down Expand Up @@ -263,7 +263,7 @@ public function smsForward($MAGNUS, $agi, $CalcAgi, $optionValue)

$agi->verbose($url);

if (!$res = @file_get_contents($url, false)) {
if ( ! $res = @file_get_contents($url, false)) {
$agi->verbose("ERRO SMS -> " . $url);
}

Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/SipTransferAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class SipTransferAgi
{
public function billing(&$MAGNUS, $agi, &$CalcAgi)
public static function billing(&$MAGNUS, $agi, &$CalcAgi)
{
$siptransfer = $agi->get_variable("SIPTRANSFER");
if ($siptransfer['data'] == 'yes') {
Expand Down
35 changes: 34 additions & 1 deletion script/installOpenSips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,40 @@ set cl.column6 warning
set cl.column6.width 0' > /usr/local/etc/sngreprc


echo "local0.* /var/log/opensips.log" >> /etc/rsyslog.conf
echo '
module(load="imuxsock") # provides support for local system logging
module(load="imklog") # provides kernel logging support
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$WorkDirectory /var/spool/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
*.=debug;\
auth,authpriv.none;\
mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail.none -/var/log/messages
*.emerg :omusrmsg:*
local0.* /var/log/opensips.log
' > /etc/rsyslog.conf


systemctl restart rsyslog
systemctl restart opensips

Expand Down
1 change: 1 addition & 0 deletions script/opensips-3.1.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ server_signature=no
server_header="Server: MagnusSipProxy"
user_agent_header="User-Agent: Magnus SipProxy"

#/sbin/opensips -C /etc/opensips/opensips.cfg

######################################################################
## Core Logging Parameters
Expand Down

0 comments on commit 04c6865

Please sign in to comment.