Bug fix.
- fix bug on install realtime. - Add realtime diagmostic.
This commit is contained in:
parent
5bd0d2b124
commit
bfeb9e4785
|
@ -92,6 +92,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path
|
||||
private $pagedata = null;
|
||||
private $sccp_driver_ver = '11.3';
|
||||
public $sccp_manager_ver = '13.0.0.4';
|
||||
private $tftpLang = array();
|
||||
// private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
||||
private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
||||
|
|
|
@ -14,7 +14,7 @@ class extconfigs {
|
|||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
$Ver = '13.0.3';
|
||||
return Array('Version' => $Ver,
|
||||
'about' => 'Default Setings and Enums ver: ' . $Ver);
|
||||
}
|
||||
|
@ -349,5 +349,79 @@ class extconfigs {
|
|||
|
||||
return $base_config;
|
||||
}
|
||||
|
||||
public function validate_RealTime() {
|
||||
global $amp_conf;
|
||||
$res = Array();
|
||||
|
||||
$cnf_int = \FreePBX::Config();
|
||||
$cnf_wr = \FreePBX::WriteConfig();
|
||||
$cnf_read = \FreePBX::LoadConfig();
|
||||
$def_config = array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig', 'sccpline' => ' mysql,sccp,sccpline');
|
||||
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
|
||||
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
|
||||
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
|
||||
$def_bd_sec = 'sccp';
|
||||
|
||||
$dir = $cnf_int->get('ASTETCDIR');
|
||||
$res_conf_sql = ini_get('pdo_mysql.default_socket');
|
||||
$res_conf_old = '';
|
||||
$res_conf = '';
|
||||
$ext_conf = '';
|
||||
|
||||
if (file_exists($dir . '/extconfig.conf')) {
|
||||
$ext_conf = $cnf_read->getConfig('extconfig.conf');
|
||||
if (empty($ext_conf['settings']['sccpdevice'])) {
|
||||
$res['extconfig'] = ' Options "Sccpdevice" not config ';
|
||||
}
|
||||
if (empty($ext_conf['settings']['sccpline'])) {
|
||||
$res['extconfig'] .= ' Options "Sccpline" not config ';
|
||||
}
|
||||
if (empty($res['extconfig'])) {
|
||||
$res['extconfig'] = 'OK';
|
||||
}
|
||||
} else {
|
||||
$res['extconfig'] = 'File extconfig.conf not exist';
|
||||
}
|
||||
|
||||
if (!empty($res_conf_sql)) {
|
||||
if (file_exists($res_conf_sql)) {
|
||||
$def_bd_config['dbsock'] = $res_conf_sql;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir . '/res_mysql.conf')) {
|
||||
$res_conf = $cnf_read->getConfig('res_mysql.conf');
|
||||
if (empty($res_conf[$def_bd_sec])) {
|
||||
$res['mysqlconfig'] = 'Not Config in file: res_mysql.conf';
|
||||
} else {
|
||||
if ($res_conf[$def_bd_sec]['dbsock'] != $def_bd_config['dbsock']) {
|
||||
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_mysql.conf';
|
||||
}
|
||||
}
|
||||
if (empty($res['mysqlconfig'])) {
|
||||
$res['mysqlconfig'] = 'OK';
|
||||
}
|
||||
}
|
||||
if (file_exists($dir . '/res_config_mysql.conf')) {
|
||||
$res_conf = $cnf_read->getConfig('res_config_mysql.conf');
|
||||
if (empty($res_conf[$def_bd_sec])) {
|
||||
$res['mysqlconfig'] = 'Not Config in file: res_config_mysql.conf';
|
||||
} else {
|
||||
if ($res_conf[$def_bd_sec]['dbsock'] != $def_bd_config['dbsock']) {
|
||||
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_config_mysql.conf';
|
||||
}
|
||||
}
|
||||
if (empty($res['mysqlconfig'])) {
|
||||
$res['mysqlconfig'] = 'OK';
|
||||
}
|
||||
|
||||
}
|
||||
if (empty($res['mysqlconfig'])) {
|
||||
$res['mysqlconfig'] = 'Realtime Error: not found res_config_mysql.conf or res_mysql.conf configutation on the path :'. $dir ;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class srvinterface {
|
|||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
$Ver = '13.0.3';
|
||||
return Array('Version' => $Ver,
|
||||
'about' => 'Server interface data ver: ' . $Ver);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ class srvinterface {
|
|||
'reset_phone' => array('cmd' => "sccp reset ", 'param' => 'name'), // Жесткая перезагрузка
|
||||
'reload_phone' => array('cmd' => "sccp reload device ", 'param' => 'name'),
|
||||
'reset_token' => array('cmd' => "sccp tokenack ", 'param' => 'name'),
|
||||
'get_realtime_status' => array('cmd' => "realtime mysql status", 'param' => ''),
|
||||
);
|
||||
$result = true;
|
||||
if (!empty($params['cmd'])) {
|
||||
|
@ -174,6 +175,22 @@ class srvinterface {
|
|||
return $ast_key;
|
||||
}
|
||||
|
||||
public function sccp_realtime_status() {
|
||||
$ast_res = array();
|
||||
$ast_out = $this->sccp_core_commands(array('cmd'=>'get_realtime_status'));
|
||||
$ast_out = preg_split("/[\n]/", $ast_out['data']);
|
||||
if (strpos($ast_out[0], 'Privilege') !== false){
|
||||
$ast_out[0] = "";
|
||||
}
|
||||
foreach ($ast_out as $line) {
|
||||
if (strlen($line) > 3) {
|
||||
$ast_key = strstr(trim($line), ' ', true);
|
||||
$ast_res[$ast_key] = array('message' => $line, 'status'=> strpos($line, 'connected') ? 'OK' : 'ERROR');
|
||||
}
|
||||
}
|
||||
return $ast_res;
|
||||
}
|
||||
|
||||
// !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ?
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class xmlinterface {
|
|||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
$Ver = '13.0.3';
|
||||
return Array('Version' => $Ver,
|
||||
'about' => 'Create XML data interface ver: ' . $Ver);
|
||||
}
|
||||
|
|
|
@ -656,7 +656,6 @@ function Setup_RealTime() {
|
|||
|
||||
$dir = $cnf_int->get('ASTETCDIR');
|
||||
$res_conf_sql = ini_get('pdo_mysql.default_socket');
|
||||
$res_conf_old = '';
|
||||
$res_conf = '';
|
||||
$ext_conf = '';
|
||||
if (file_exists($dir . '/extconfig.conf')) {
|
||||
|
@ -698,14 +697,14 @@ function Setup_RealTime() {
|
|||
}
|
||||
if (file_exists($dir . '/res_config_mysql.conf')) {
|
||||
$res_conf = $cnf_read->getConfig('res_config_mysql.conf');
|
||||
if (empty($res_conf_old[$def_bd_sec])) {
|
||||
if (empty($res_conf[$def_bd_sec])) {
|
||||
$res_conf[$def_bd_sec] = $def_bd_config;
|
||||
}
|
||||
$cnf_wr->writeConfig('res_config_mysql.conf', $res_conf, false);
|
||||
}
|
||||
if (empty($res_conf)) {
|
||||
$res_conf[$def_bd_sec] = $def_bd_config;
|
||||
$res_conf['general']['dbsock'] = $def_bd_config['dbsock'];
|
||||
// $res_conf['general']['dbsock'] = $def_bd_config['dbsock'];
|
||||
$cnf_wr->writeConfig('res_config_mysql.conf', $res_conf, false);
|
||||
}
|
||||
$cnf_wr->writeConfig('extconfig.conf', $ext_conf, false);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
$core = $this->srvinterface->getSCCPVersion();
|
||||
$ast_realtime = $this->srvinterface->sccp_realtime_status();
|
||||
$conf_realtime = $this->extconfigs->validate_RealTime();
|
||||
$info = array();
|
||||
$info['srvinterface'] = $this->srvinterface->info();
|
||||
$info['extconfigs'] = $this->extconfigs->info();
|
||||
|
@ -35,16 +37,50 @@ if (!empty($this->sccpvalues['SccpDBmodel'])) {
|
|||
$info['Сompatible']['about'] = '<div class="alert signature alert-danger"> Reinstall SCCP manager required</div>';
|
||||
}
|
||||
}
|
||||
if (empty($ast_realtime)) {
|
||||
$info['RealTime'] = array('Version' => 'Error', 'about'=> '<div class="alert signature alert-danger"> No found Real Time connections</div>');
|
||||
} else {
|
||||
$rt_info = '';
|
||||
$rt_sccp = 'Failed';
|
||||
foreach ($ast_realtime as $key => $value) {
|
||||
if ($key == 'sccp') {
|
||||
if ($value['status'] == 'OK') {
|
||||
$rt_sccp = 'TEST OK';
|
||||
$rt_info .= 'SCCP conettions found';
|
||||
} else {
|
||||
$rt_sccp = 'SCCP ERROR';
|
||||
$rt_info .= '<div class="alert signature alert-danger"> Error : '. $value['message']. '</div>';
|
||||
}
|
||||
} else if ($value['status'] == 'ERROR') {
|
||||
$rt_info .= '<div> Found error in realtime sectoin ['.$key.'] : '. $value['message']. '</div>';
|
||||
}
|
||||
}
|
||||
$info['RealTime'] = array('Version' => $rt_sccp, 'about'=> $rt_info);
|
||||
}
|
||||
if (empty($conf_realtime)) {
|
||||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> '<div class="alert signature alert-danger"> No found Real Time Configs</div>');
|
||||
} else {
|
||||
$rt_info = '';
|
||||
foreach ($conf_realtime as $key => $value) {
|
||||
if ($value != 'OK') {
|
||||
$rt_info .= '<div> Found error in section '.$key.' :'. $value. '</div>';
|
||||
}
|
||||
}
|
||||
if (!empty($rt_info)) {
|
||||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> $rt_info);
|
||||
}
|
||||
}
|
||||
/*
|
||||
print_r("<br> Request:<br><pre>");
|
||||
$json = '';
|
||||
print_r("<br>");
|
||||
print_r("<br>");
|
||||
print_r("<br>");
|
||||
print_r($this->srvinterface->sccp_realtime_status());
|
||||
print_r("DIRECT START");
|
||||
print_r("<br>");
|
||||
print_r($this->srvinterface->t_get_meta_data());
|
||||
|
||||
// print_r($this->srvinterface->t_get_meta_data());
|
||||
print_r($this->extconfigs->validate_RealTime());
|
||||
print("</pre>");
|
||||
*/
|
||||
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
||||
|
@ -75,7 +111,7 @@ if (!empty($this->class_error)) {
|
|||
<div class="fpbx-container container-fluid">
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<h2>Sccp Manager Info </h2>
|
||||
<h2>Sccp Manager V.<?php print_r($this->sccp_manager_ver); ?> Info </h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
|
Loading…
Reference in a new issue