Skip to content

Commit

Permalink
improve dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
magnussolution committed Jul 3, 2023
1 parent 63db46a commit 95811a4
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 29 deletions.
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion classic/src/view/sip/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}, {
Expand Down
10 changes: 8 additions & 2 deletions protected/commands/StatusSystemCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions protected/components/AsteriskAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 10 additions & 8 deletions protected/controllers/ServersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions resources/locale/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -1180,5 +1180,4 @@ Locale.load({
'success': 'Erfolg',
'to refill': 'zum aufladen',
'week': 'Woche',

});
3 changes: 1 addition & 2 deletions resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': '',
Expand Down Expand Up @@ -1127,5 +1127,4 @@ Locale.load({
'name': '',
'to refill': '',
'week': '',

});
3 changes: 1 addition & 2 deletions resources/locale/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -1150,5 +1150,4 @@ Locale.load({
'name': 'nombre',
'to refill': 'para recargar',
'week': 'semana',

});
3 changes: 1 addition & 2 deletions resources/locale/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -1158,5 +1158,4 @@ Locale.load({
'success': 'Succès',
'to refill': 'recharger',
'week': 'semaine',

});
3 changes: 1 addition & 2 deletions resources/locale/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -1158,5 +1158,4 @@ Locale.load({
'success': 'successo',
'to refill': 'per ricaricare',
'week': 'settimana',

});
3 changes: 1 addition & 2 deletions resources/locale/pt_BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -1174,5 +1174,4 @@ Locale.load({
'success': 'sucesso',
'to refill': 'para recarregar',
'week': 'semana',

});

0 comments on commit 95811a4

Please sign in to comment.