Cleaned up messages
Improved message readability. Atom removed extraneous white spaces and lines
This commit is contained in:
parent
2f69bdb3fa
commit
6ccc9bbccb
|
@ -12,7 +12,7 @@ namespace FreePBX\modules\Sccp_manager\aminterface;
|
||||||
|
|
||||||
class AMIException extends \Exception
|
class AMIException extends \Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Message
|
abstract class Message
|
||||||
|
|
|
@ -72,7 +72,6 @@ abstract class Response extends IncomingMessage
|
||||||
$this->setKey('ActionId', $actionId);
|
$this->setKey('ActionId', $actionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getVariable($_rawContent, $_fields = '')
|
public function getVariable($_rawContent, $_fields = '')
|
||||||
{
|
{
|
||||||
$lines = explode(Message::EOL, $_rawContent);
|
$lines = explode(Message::EOL, $_rawContent);
|
||||||
|
@ -119,7 +118,6 @@ class Login_Response extends Response
|
||||||
class Command_Response extends Response
|
class Command_Response extends Response
|
||||||
{
|
{
|
||||||
private $_temptable;
|
private $_temptable;
|
||||||
|
|
||||||
public function __construct($rawContent)
|
public function __construct($rawContent)
|
||||||
{
|
{
|
||||||
// print_r('<br>---- r --<br>');
|
// print_r('<br>---- r --<br>');
|
||||||
|
@ -127,7 +125,6 @@ class Command_Response extends Response
|
||||||
// print_r('<br>---- re --<br>');
|
// print_r('<br>---- re --<br>');
|
||||||
$this->_temptable = array();
|
$this->_temptable = array();
|
||||||
parent::__construct($rawContent);
|
parent::__construct($rawContent);
|
||||||
|
|
||||||
$lines = explode(Message::EOL, $rawContent);
|
$lines = explode(Message::EOL, $rawContent);
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
$content = explode(':', $line);
|
$content = explode(':', $line);
|
||||||
|
@ -148,7 +145,7 @@ class Command_Response extends Response
|
||||||
if (!empty($this->_temptable)) {
|
if (!empty($this->_temptable)) {
|
||||||
$this->setKey('output', 'array');
|
$this->setKey('output', 'array');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_completed = $this->isSuccess();
|
$this->_completed = $this->isSuccess();
|
||||||
// return $this->isSuccess();
|
// return $this->isSuccess();
|
||||||
}
|
}
|
||||||
|
@ -165,7 +162,7 @@ class Command_Response extends Response
|
||||||
|
|
||||||
class SCCPGeneric_Response extends Response
|
class SCCPGeneric_Response extends Response
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $_tables;
|
protected $_tables;
|
||||||
private $_temptable;
|
private $_temptable;
|
||||||
|
|
||||||
|
@ -208,7 +205,7 @@ class SCCPGeneric_Response extends Response
|
||||||
$this->_completed = true;
|
$this->_completed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function ConvertTableData($_tablename, $_fkey, $_fields)
|
protected function ConvertTableData($_tablename, $_fkey, $_fields)
|
||||||
{
|
{
|
||||||
$_rawtable = $this->Table2Array($_tablename);
|
$_rawtable = $this->Table2Array($_tablename);
|
||||||
|
@ -278,8 +275,8 @@ class SCCPGeneric_Response extends Response
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function hasTable()
|
public function hasTable()
|
||||||
{
|
{
|
||||||
if (is_array($this->_tables)) {
|
if (is_array($this->_tables)) {
|
||||||
|
@ -291,7 +288,7 @@ class SCCPGeneric_Response extends Response
|
||||||
{
|
{
|
||||||
return (is_array($this->_tables)) ? array_keys($this->_tables) : null;
|
return (is_array($this->_tables)) ? array_keys($this->_tables) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Table2Array($tablename = '')
|
public function Table2Array($tablename = '')
|
||||||
{
|
{
|
||||||
$result =array();
|
$result =array();
|
||||||
|
@ -324,7 +321,7 @@ class SCCPGeneric_Response extends Response
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable($tablename)
|
public function getTable($tablename)
|
||||||
{
|
{
|
||||||
if ($this->hasTable() && array_key_exists($tablename, $this->_tables)) {
|
if ($this->hasTable() && array_key_exists($tablename, $this->_tables)) {
|
||||||
|
@ -349,7 +346,7 @@ class SCCPGeneric_Response extends Response
|
||||||
// $this->getVariable($rawContent, $_fields);
|
// $this->getVariable($rawContent, $_fields);
|
||||||
$this->_completed = !$this->isList();
|
$this->_completed = !$this->isList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult()
|
public function getResult()
|
||||||
{
|
{
|
||||||
if ($this->getKey('JSON') != null) {
|
if ($this->getKey('JSON') != null) {
|
||||||
|
|
|
@ -55,8 +55,8 @@ class aminterface
|
||||||
$this->_connect_state = false;
|
$this->_connect_state = false;
|
||||||
$this->_error = array();
|
$this->_error = array();
|
||||||
$this->_config = array('host' => 'localhost', 'user' => '', 'pass' => '', 'port' => '5038', 'tsoket' => 'tcp://', 'timeout' => 30, 'enabled' => false);
|
$this->_config = array('host' => 'localhost', 'user' => '', 'pass' => '', 'port' => '5038', 'tsoket' => 'tcp://', 'timeout' => 30, 'enabled' => false);
|
||||||
|
|
||||||
|
|
||||||
$this->_eventListeners = array();
|
$this->_eventListeners = array();
|
||||||
// $this->_eventFactory = new EventFactoryImpl(\Logger::getLogger('EventFactory'));
|
// $this->_eventFactory = new EventFactoryImpl(\Logger::getLogger('EventFactory'));
|
||||||
// $this->_responseFactory = new ResponseFactoryImpl(\Logger::getLogger('ResponseFactory'));
|
// $this->_responseFactory = new ResponseFactoryImpl(\Logger::getLogger('ResponseFactory'));
|
||||||
|
@ -259,7 +259,7 @@ class aminterface
|
||||||
$response = $this->findResponse($event);
|
$response = $this->findResponse($event);
|
||||||
// print_r($response);
|
// print_r($response);
|
||||||
// print_r('<br>--- E2 Response Type 2 ----------<br>');
|
// print_r('<br>--- E2 Response Type 2 ----------<br>');
|
||||||
|
|
||||||
if ($response === false || $response->isComplete()) {
|
if ($response === false || $response->isComplete()) {
|
||||||
$this->dispatch($event); // не работает
|
$this->dispatch($event); // не работает
|
||||||
} else {
|
} else {
|
||||||
|
@ -409,7 +409,7 @@ class aminterface
|
||||||
$listener = $data[0];
|
$listener = $data[0];
|
||||||
$predicate = $data[1];
|
$predicate = $data[1];
|
||||||
print_r($data);
|
print_r($data);
|
||||||
|
|
||||||
if (is_callable($predicate) && !call_user_func($predicate, $message)) {
|
if (is_callable($predicate) && !call_user_func($predicate, $message)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ class extconfigs
|
||||||
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
|
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
|
||||||
$tmp_ofset = $tmp_dt->getOffset();
|
$tmp_ofset = $tmp_dt->getOffset();
|
||||||
return $tmp_ofset / 60;
|
return $tmp_ofset / 60;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'sccp_timezone': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
|
case 'sccp_timezone': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
if (empty($index)) {
|
if (empty($index)) {
|
||||||
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class extconfigs
|
||||||
return $this->get_cisco_time_zone($index);
|
return $this->get_cisco_time_zone($index);
|
||||||
} else {
|
} else {
|
||||||
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
|
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
|
||||||
|
|
||||||
$tz_tmp = array();
|
$tz_tmp = array();
|
||||||
foreach ($timezone_abbreviations as $subArray) {
|
foreach ($timezone_abbreviations as $subArray) {
|
||||||
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
|
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
|
||||||
|
@ -109,7 +109,7 @@ class extconfigs
|
||||||
|
|
||||||
private function get_cisco_time_zone($tzc)
|
private function get_cisco_time_zone($tzc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
|
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
|
||||||
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||||
return array();
|
return array();
|
||||||
|
@ -463,14 +463,14 @@ class extconfigs
|
||||||
$res['extconfig'] = 'OK';
|
$res['extconfig'] = 'OK';
|
||||||
|
|
||||||
if (empty($res['sccpdevice'])) {
|
if (empty($res['sccpdevice'])) {
|
||||||
$res['extconfig'] = ' Options "Sccpdevice" not config ';
|
$res['extconfig'] = ' Option "Sccpdevice" is not configured ';
|
||||||
}
|
}
|
||||||
if (empty($res['sccpline'])) {
|
if (empty($res['sccpline'])) {
|
||||||
$res['extconfig'] = ' Options "Sccpline" not config ';
|
$res['extconfig'] = ' Option "Sccpline" is not configured ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($res['extconfigfile'])) {
|
if (empty($res['extconfigfile'])) {
|
||||||
$res['extconfig'] = 'File extconfig.conf not exist';
|
$res['extconfig'] = 'File extconfig.conf does not exist';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -482,10 +482,10 @@ class extconfigs
|
||||||
if (file_exists($dir . '/res_mysql.conf')) {
|
if (file_exists($dir . '/res_mysql.conf')) {
|
||||||
$res_conf = $cnf_read->getConfig('res_mysql.conf');
|
$res_conf = $cnf_read->getConfig('res_mysql.conf');
|
||||||
if (empty($res_conf[$realm])) {
|
if (empty($res_conf[$realm])) {
|
||||||
$res['mysqlconfig'] = 'Not Config in file: res_mysql.conf';
|
$res['mysqlconfig'] = 'Config not found in file: res_mysql.conf';
|
||||||
} else {
|
} else {
|
||||||
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
|
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
|
||||||
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_mysql.conf';
|
$res['mysqlconfig'] = 'Mysql Socket Error in file: res_mysql.conf';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($res['mysqlconfig'])) {
|
if (empty($res['mysqlconfig'])) {
|
||||||
|
@ -499,7 +499,7 @@ class extconfigs
|
||||||
$res['mysqlconfig'] = 'Not Config in file: res_config_mysql.conf';
|
$res['mysqlconfig'] = 'Not Config in file: res_config_mysql.conf';
|
||||||
} else {
|
} else {
|
||||||
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
|
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
|
||||||
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_config_mysql.conf';
|
$res['mysqlconfig'] = 'Mysql Socket Error in file: res_config_mysql.conf';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($res['mysqlconfig'])) {
|
if (empty($res['mysqlconfig'])) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ $ast_realtime = $this->srvinterface->sccp_realtime_status();
|
||||||
|
|
||||||
$ast_realm = (empty($ast_realtime['sccp']) ? '' : 'sccp');
|
$ast_realm = (empty($ast_realtime['sccp']) ? '' : 'sccp');
|
||||||
|
|
||||||
|
// if there are multiple connections, this will only return the first.
|
||||||
foreach ($ast_realtime as $key => $value) {
|
foreach ($ast_realtime as $key => $value) {
|
||||||
if (empty($ast_realm)) {
|
if (empty($ast_realm)) {
|
||||||
if ($value['status'] == 'OK') {
|
if ($value['status'] == 'OK') {
|
||||||
|
@ -61,7 +62,7 @@ if ($db_Schema == 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($ast_realtime)) {
|
if (empty($ast_realtime)) {
|
||||||
$info['RealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> No found Real Time connections</div>');
|
$info['RealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> No RealTime connections found</div>');
|
||||||
} else {
|
} else {
|
||||||
$rt_info = '';
|
$rt_info = '';
|
||||||
$rt_sccp = 'Failed';
|
$rt_sccp = 'Failed';
|
||||||
|
@ -82,7 +83,7 @@ if (empty($ast_realtime)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf_realtime)) {
|
if (empty($conf_realtime)) {
|
||||||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> No found Real Time Configs</div>');
|
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> Realtime configuration was not found</div>');
|
||||||
} else {
|
} else {
|
||||||
$rt_info = '';
|
$rt_info = '';
|
||||||
foreach ($conf_realtime as $key => $value) {
|
foreach ($conf_realtime as $key => $value) {
|
||||||
|
@ -135,7 +136,7 @@ if ($test_any == 1) {
|
||||||
//print_r(array_column($timezone_abbreviations, 'timezone_id'));
|
//print_r(array_column($timezone_abbreviations, 'timezone_id'));
|
||||||
print_r($Ts_set);
|
print_r($Ts_set);
|
||||||
$tz_tmp = array();
|
$tz_tmp = array();
|
||||||
|
|
||||||
foreach ($timezone_abbreviations as $subArray) {
|
foreach ($timezone_abbreviations as $subArray) {
|
||||||
$dddd = array_search($Ts_set, array_column($subArray, 'timezone_id'));
|
$dddd = array_search($Ts_set, array_column($subArray, 'timezone_id'));
|
||||||
if (!empty($dddd)) {
|
if (!empty($dddd)) {
|
||||||
|
@ -157,7 +158,7 @@ if ($test_any == 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_r("<br>");
|
print_r("<br>");
|
||||||
//print_r($time_set);
|
//print_r($time_set);
|
||||||
print_r($this->sccpvalues['ntp_timezone']);
|
print_r($this->sccpvalues['ntp_timezone']);
|
||||||
|
@ -443,12 +444,12 @@ print(" ");
|
||||||
//print_r($this->dbinterface->info());
|
//print_r($this->dbinterface->info());
|
||||||
|
|
||||||
if (!empty($this->info_warning)) {
|
if (!empty($this->info_warning)) {
|
||||||
?>
|
?>
|
||||||
<div class="fpbx-container container-fluid">
|
<div class="fpbx-container container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2 style="border:2px solid Tomato;color:Tomato;" >Sccp Manager Warning</h2>
|
<h2 style="border:2px solid Tomato;color:Tomato;" >Sccp Manager Warning</h2>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<br> There are Warning in the SCCP Module:<br><pre>
|
<br> There are Warning in the SCCP Module:<br><pre>
|
||||||
<?php
|
<?php
|
||||||
foreach ($this->info_warning as $key => $value) {
|
foreach ($this->info_warning as $key => $value) {
|
||||||
|
@ -472,12 +473,12 @@ if (!empty($this->info_warning)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->class_error)) {
|
if (!empty($this->class_error)) {
|
||||||
?>
|
?>
|
||||||
<div class="fpbx-container container-fluid">
|
<div class="fpbx-container container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2 style="border:2px solid Tomato;color:Tomato;" >Diagnostic information about SCCP Manager errors</h2>
|
<h2 style="border:2px solid Tomato;color:Tomato;" >Diagnostic information about SCCP Manager errors</h2>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<br> There is an error in the :<br><pre>
|
<br> There is an error in the :<br><pre>
|
||||||
<?php print_r($this->class_error); ?>
|
<?php print_r($this->class_error); ?>
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -493,7 +494,7 @@ if (!empty($this->class_error)) {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2>Sccp Manager V.<?php print_r($this->sccp_manager_ver); ?> Info </h2>
|
<h2>Sccp Manager V.<?php print_r($this->sccp_manager_ver); ?> Info </h2>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -517,4 +518,3 @@ foreach ($info as $key => $value) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo $this->showGroup('sccp_info', 0); ?>
|
<?php echo $this->showGroup('sccp_info', 0); ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue