diff --git a/build/MagnusBilling-current.tar.gz b/build/MagnusBilling-current.tar.gz index 694de3cfd..08d3fa756 100644 Binary files a/build/MagnusBilling-current.tar.gz and b/build/MagnusBilling-current.tar.gz differ diff --git a/classic/src/view/sip/Form.js b/classic/src/view/sip/Form.js index 0f3a89377..5b640485f 100755 --- a/classic/src/view/sip/Form.js +++ b/classic/src/view/sip/Form.js @@ -283,7 +283,7 @@ Ext.define('MBilling.view.sip.Form', { }, { xtype: 'noyescombo', name: 'ringfalse', - fieldLabel: t('Ring false'), + fieldLabel: t('Fake Ring'), value: '0', allowBlank: !App.user.isAdmin }, { diff --git a/protected/commands/StatusSystemCommand.php b/protected/commands/StatusSystemCommand.php index 77f060b3f..98efb9f51 100755 --- a/protected/commands/StatusSystemCommand.php +++ b/protected/commands/StatusSystemCommand.php @@ -22,10 +22,16 @@ class StatusSystemCommand extends ConsoleCommand public function run($args) { - $sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr_failed` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "'"; + $sql = "SELECT id FROM `pkg_cdr_failed` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "' LIMIT 1"; $resultFailed = Yii::app()->db->createCommand($sql)->queryAll(); - $sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "'"; + $sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr_failed` WHERE `id` > " . $resultFailed[0]['id'] + $resultFailed = Yii::app()->db->createCommand($sql)->queryAll(); + + $sql = "SELECT id FROM `pkg_cdr` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "' LIMIT 1"; + $resultAnswered = Yii::app()->db->createCommand($sql)->queryAll(); + + $sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr` WHERE `id` > " . $resultAnswered[0]['id'] $resultAnswered = Yii::app()->db->createCommand($sql)->queryAll(); $result = array_merge($resultFailed, $resultAnswered); diff --git a/protected/components/AsteriskAccess.php b/protected/components/AsteriskAccess.php index 9b1db6710..0a9c30636 100755 --- a/protected/components/AsteriskAccess.php +++ b/protected/components/AsteriskAccess.php @@ -269,7 +269,7 @@ public function writeAsteriskFile($model, $file, $head_field = 'name') } if ($head_field == 'trunkcode') { - $sql = "SELECT * FROM pkg_servers WHERE type != 'mbilling' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type != 'mbilling' AND status IN (1,4) AND host != 'localhost'"; $modelServers = Yii::app()->db->createCommand($sql)->queryAll(); foreach ($modelServers as $key => $data) { @@ -422,7 +422,7 @@ public function groupTrunk($agi, $ipaddress, $maxuse) public static function getSipShowPeers() { - $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'"; $modelServers = Yii::app()->db->createCommand($sql)->queryAll(); array_push($modelServers, array( @@ -466,7 +466,7 @@ public static function getSipShowPeers() public static function getCoreShowCdrChannels() { - $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'"; $modelServers = Yii::app()->db->createCommand($sql)->queryAll(); array_push($modelServers, array( @@ -513,7 +513,7 @@ public static function getCoreShowCdrChannels() public static function getCoreShowChannels() { - $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'"; $modelServers = Yii::app()->db->createCommand($sql)->queryAll(); array_push($modelServers, array( @@ -555,7 +555,7 @@ public static function getCoreShowChannels() public static function getCoreShowChannelsVerbose() { - $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'"; $modelServers = Yii::app()->db->createCommand($sql)->queryAll(); array_push($modelServers, array( @@ -601,7 +601,7 @@ public static function getCoreShowChannel($channel, $agi = null, $server = null) { if ($server == null) { - $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'"; + $sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'"; if (isset($agi->engine)) { $modelServers = $agi->query($sql)->fetchAll(PDO::FETCH_ASSOC); } else { diff --git a/protected/controllers/ServersController.php b/protected/controllers/ServersController.php index fc0f90d1e..50b0c3948 100755 --- a/protected/controllers/ServersController.php +++ b/protected/controllers/ServersController.php @@ -43,16 +43,18 @@ public function setAttributesModels($attributes, $models) 'condition' => 'type = "asterisk" AND status = 1 AND weight > 0', 'order' => 'last_call DESC', ]); - $last_call = date("Y-m-d H:i:s", strtotime("-5 minutes", strtotime($modelServer->last_call))); + if (isset($modelServer->id)) { + $last_call = date("Y-m-d H:i:s", strtotime("-5 minutes", strtotime($modelServer->last_call))); - $pkCount = is_array($attributes) || is_object($attributes) ? $attributes : []; - for ($i = 0; $i < count($pkCount); $i++) { + $pkCount = is_array($attributes) || is_object($attributes) ? $attributes : []; + for ($i = 0; $i < count($pkCount); $i++) { - if ($attributes[$i]['status'] == 4) { - Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 1)); - } - if ($attributes[$i]['type'] == 'asterisk' && $attributes[$i]['status'] > 0 && $attributes[$i]['weight'] > '0' && $attributes[$i]['last_call'] < $last_call) { - Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 4)); + if ($attributes[$i]['status'] == 4) { + Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 1)); + } + if ($attributes[$i]['type'] == 'asterisk' && $attributes[$i]['status'] > 0 && $attributes[$i]['weight'] > '0' && $attributes[$i]['last_call'] < $last_call) { + Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 4)); + } } } return $attributes; diff --git a/resources/locale/de.js b/resources/locale/de.js index 98022ac70..b1d81a7e8 100755 --- a/resources/locale/de.js +++ b/resources/locale/de.js @@ -840,7 +840,7 @@ Locale.load({ 'Return credit after cancellation': '', 'Ring': 'Klingeln', 'Ring all available channels until one answers': 'Alle verfügbaren SIP-Kanäle anrufen, bis einer antwortet', - 'Ring false': 'Ring false', + 'Fake Ring': 'Fake Ring', 'Ring for': 'Ring for', 'Ring interface which was least recently called by this queue': 'Ringschnittstelle, die erst kürzlich von dieser Warteschlange angerufen wurde', 'Ring or playing MOH': 'Rufe an oder spiele MOH ab', @@ -1180,5 +1180,4 @@ Locale.load({ 'success': 'Erfolg', 'to refill': 'zum aufladen', 'week': 'Woche', - }); \ No newline at end of file diff --git a/resources/locale/en.js b/resources/locale/en.js index f41f761da..f9a9dd514 100755 --- a/resources/locale/en.js +++ b/resources/locale/en.js @@ -799,7 +799,7 @@ Locale.load({ 'Return credit after cancellation': '', 'Ring': '', 'Ring all available channels until one answers': '', - 'Ring false': '', + 'Fake Ring': '', 'Ring for': '', 'Ring interface which was least recently called by this queue': '', 'Ring or playing MOH': '', @@ -1127,5 +1127,4 @@ Locale.load({ 'name': '', 'to refill': '', 'week': '', - }); \ No newline at end of file diff --git a/resources/locale/es.js b/resources/locale/es.js index 95eec357b..0c14855de 100755 --- a/resources/locale/es.js +++ b/resources/locale/es.js @@ -819,7 +819,7 @@ Locale.load({ 'Return credit after cancellation': 'Devolucion de crédito después de la baja', 'Ring': 'Sonar', 'Ring all available channels until one answers': 'Hacer sonar todas las cuentas SIP hasta que una conteste', - 'Ring false': 'Ring falso', + 'Fake Ring': 'Ring falso', 'Ring for': 'Sonar por', 'Ring interface which was least recently called by this queue': 'Sonar la cuenta SIP que llamó menos', 'Ring or playing MOH': 'Sonar o executar MOH', @@ -1150,5 +1150,4 @@ Locale.load({ 'name': 'nombre', 'to refill': 'para recargar', 'week': 'semana', - }); \ No newline at end of file diff --git a/resources/locale/fr.js b/resources/locale/fr.js index bf920fddb..746d0b1e1 100755 --- a/resources/locale/fr.js +++ b/resources/locale/fr.js @@ -817,7 +817,7 @@ Locale.load({ 'Return credit after cancellation': '', 'Ring': 'Bague', 'Ring all available channels until one answers': 'à ce que des réponses', - 'Ring false': 'Sonner faux', + 'Fake Ring': 'Sonner faux', 'Ring for': 'Sonnerie pour', 'Ring interface which was least recently called by this queue': 'attente', 'Ring or playing MOH': 'Anneau ou jouer du moh', @@ -1158,5 +1158,4 @@ Locale.load({ 'success': 'Succès', 'to refill': 'recharger', 'week': 'semaine', - }); \ No newline at end of file diff --git a/resources/locale/it.js b/resources/locale/it.js index c1f81271c..4600da8b8 100755 --- a/resources/locale/it.js +++ b/resources/locale/it.js @@ -818,7 +818,7 @@ Locale.load({ 'Return credit after cancellation': '', 'Ring': 'Squillare', 'Ring all available channels until one answers': 'Suonare tutti i canali disponibili fino a quando non risponde', - 'Ring false': 'Anello falso', + 'Fake Ring': 'Anello falso', 'Ring for': 'Anello per', 'Ring interface which was least recently called by this queue': 'Interfaccia ad anello che è stata recentemente recentemente chiamata di recente da questa coda', 'Ring or playing MOH': 'Anello o giocare a moh', @@ -1158,5 +1158,4 @@ Locale.load({ 'success': 'successo', 'to refill': 'per ricaricare', 'week': 'settimana', - }); \ No newline at end of file diff --git a/resources/locale/pt_BR.js b/resources/locale/pt_BR.js index 12c3a67d7..8130162ff 100755 --- a/resources/locale/pt_BR.js +++ b/resources/locale/pt_BR.js @@ -836,7 +836,7 @@ Locale.load({ 'Return credit after cancellation': 'Devolução de crédito ápos cancelamento', 'Ring': 'Chamando', 'Ring all available channels until one answers': 'Tocar todos as contas SIP disponíveis até que um responda', - 'Ring false': 'Ring falso', + 'Fake Ring': 'Ring falso', 'Ring for': 'Chamado por', 'Ring interface which was least recently called by this queue': 'Conta SIP que recebeu menos chamadas nesta fila', 'Ring or playing MOH': 'Chamar ou executar MOH', @@ -1174,5 +1174,4 @@ Locale.load({ 'success': 'sucesso', 'to refill': 'para recarregar', 'week': 'semana', - }); \ No newline at end of file