Begin resample Sccp_manager

changed the suffix of the configuration file name
This commit is contained in:
PhantomVl 2017-10-25 19:42:45 +03:00
parent 24e0f2404c
commit 7154b908b7
6 changed files with 25 additions and 23 deletions

View file

@ -68,7 +68,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path // private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path
private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path
private $pagedata = null; private $pagedata = null;
private $sccp_driver_ver = '11.21'; private $sccp_driver_ver = '11.2';
private $tftpLang = array(); private $tftpLang = array();
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
private $val_null = 'NONE'; /// REPLACE to null Field private $val_null = 'NONE'; /// REPLACE to null Field
@ -120,7 +120,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// Load Advanced Form Constuctor Data // Load Advanced Form Constuctor Data
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v'.$this->sccpvalues['sccp_comatable']['data']; $xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v'.$this->sccpvalues['sccp_compatible']['data'];
if (!file_exists($xml_vars)) { if (!file_exists($xml_vars)) {
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml'; $xml_vars = __DIR__ . '/conf/sccpgeneral.xml';
} }
@ -1451,8 +1451,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
copy($filename, $dst_path . basename($filename)); copy($filename, $dst_path . basename($filename));
} }
} }
$this->sccpvalues['sccp_comatable'] = array('keyword' => 'sccp_comatable', 'data' => $this->srvinterface->get_comatable_sccp(), 'type' => '1', 'seq' => '99');
// $this->sccpvalues['sccp_comatable'] = '11'; $this->sccpvalues['sccp_compatible'] = array('keyword' => 'compatible', 'data' => $this->srvinterface->get_compatible_sccp(), 'type' => '1', 'seq' => '99');
// $this->sccpvalues['sccp_compatible'] = '11';
$driver = $this->FreePBX->Core->getAllDriversInfo(); $driver = $this->FreePBX->Core->getAllDriversInfo();
$driver_replace = ''; $driver_replace = '';
@ -1470,7 +1471,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php'; $dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
if (!file_exists($dst) || $driver_replace =='yes') { if (!file_exists($dst) || $driver_replace =='yes') {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst).'.v'.$this->sccpvalues['sccp_comatable']['data']; $src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst).'.v'.$this->sccpvalues['sccp_compatible']['data'];
if (file_exists($src_path)) { if (file_exists($src_path)) {
copy($src_path, $dst); copy($src_path, $dst);
} else { } else {
@ -1951,7 +1952,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case "netlang": // Remove Key case "netlang": // Remove Key
case "devlang": case "devlang":
case "tftp_path": case "tftp_path":
case "sccp_comatable": case "sccp_compatible":
break; break;
default: default:
$this->sccp_conf_init['general'][$key] = $value['data']; $this->sccp_conf_init['general'][$key] = $value['data'];

View file

@ -125,8 +125,8 @@ class srvinterface {
} }
return $ast_key; return $ast_key;
} }
public function get_comatable_sccp() { public function get_compatible_sccp() {
$res = $this-> getChanSCCPVersion(); $res = $this-> getChanSCCPVersion();
if (empty($res)) { if (empty($res)) {
$res = $this-> getChanSCCPVersion(); $res = $this-> getChanSCCPVersion();
@ -135,9 +135,9 @@ class srvinterface {
return 0; return 0;
} }
if ($res["vCode"] >= 431) { if ($res["vCode"] >= 431) {
return '4.3.1'; return 431;
} else { } else {
return '4.3.0'; return 430;
} }
// return $res["vCode"]; // return $res["vCode"];
} }
@ -222,6 +222,7 @@ class srvinterface {
} }
} }
if (array_key_exists("RevisionNum",$metadata)) { if (array_key_exists("RevisionNum",$metadata)) {
$result["RevisionNum"]=$metadata["RevisionNum"];
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
$result["vCode"] = 432; $result["vCode"] = 432;
} }

View file

@ -31,7 +31,7 @@ and open the template in the editor. Base Version before all crash :-)
</page_group> </page_group>
<page_group name="sccp_general"> <page_group name="sccp_general">
<label>SCCP Server config</label> <label>SCCP Server config v431</label>
<item type="IE" id="2"><label>SCCP Server Name</label> <item type="IE" id="2"><label>SCCP Server Name</label>
<input> <input>

View file

@ -40,7 +40,7 @@ function astman_retrieveJSFromMetaData($astman, $segment = "") {
} }
} }
function Get_DB_config($sccp_comatable) { function Get_DB_config($sccp_compatible) {
$db_config_v0 = array( $db_config_v0 = array(
'sccpdevmodel' => array( 'sccpdevmodel' => array(
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"), 'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
@ -238,7 +238,7 @@ $db_config_v3 = array(
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' =>"reject") 'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' =>"reject")
) )
); );
if ($sccp_comatable >= 11) { if ($sccp_compatible >= 430) {
return $db_config_v3; return $db_config_v3;
} else { } else {
return $db_config_v0; return $db_config_v0;
@ -250,7 +250,7 @@ $autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENG
$table_req = array('sccpdevice', 'sccpline', 'buttonconfig'); $table_req = array('sccpdevice', 'sccpline', 'buttonconfig');
$ss = FreePBX::create()->Sccp_manager; $ss = FreePBX::create()->Sccp_manager;
$astman = FreePBX::create()->astman; $astman = FreePBX::create()->astman;
$sccp_comatable = 0; $sccp_compatible = 0;
//$db_config = $db_config_v0; //$db_config = $db_config_v0;
$db_config = ''; $db_config = '';
@ -300,9 +300,9 @@ function CheckChanSCCPСomatable() {
if (!$astman) { if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed'); ie_freepbx('No asterisk manager connection provided!. Installation Failed');
} }
$sccp_comatable = $srvinterface->get_comatable_sccp(); $sccp_compatible = $srvinterface->get_compatible_sccp();
outn("<li>" . _("Sccp model Compatable code : ") . $sccp_comatable . "</li>"); outn("<li>" . _("Sccp model Compatable code : ") . $sccp_compatible . "</li>");
return $sccp_comatable; return $sccp_compatible;
} }
@ -556,11 +556,11 @@ function InstallDB_createButtonConfigTrigger() {
return true; return true;
} }
function InstallDB_CreateSccpDeviceConfigView($sccp_comatable) { function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
global $db; global $db;
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>"); outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
$sql = ""; $sql = "";
if ($sccp_comatable < 11) { if ($sccp_compatible < 431) {
$sql= " $sql= "
CREATE OR REPLACE CREATE OR REPLACE
ALGORITHM = MERGE ALGORITHM = MERGE
@ -670,15 +670,15 @@ function Setup_RealTime() {
CheckSCCPManagerDBTables($table_req); CheckSCCPManagerDBTables($table_req);
CheckPermissions(); CheckPermissions();
CheckAsteriskVersion(); CheckAsteriskVersion();
$sccp_comatable = CheckChanSCCPСomatable(); $sccp_compatible = CheckChanSCCPСomatable();
$db_config = Get_DB_config($sccp_comatable); $db_config = Get_DB_config($sccp_compatible);
InstallDB_sccpsettings(); InstallDB_sccpsettings();
InstallDB_sccpdevmodel(); InstallDB_sccpdevmodel();
InstallDB_updateSchema($db_config); InstallDB_updateSchema($db_config);
InstallDB_fillsccpdevmodel(); InstallDB_fillsccpdevmodel();
InstallDB_updateSccpDevice(); InstallDB_updateSccpDevice();
InstallDB_createButtonConfigTrigger(); InstallDB_createButtonConfigTrigger();
InstallDB_CreateSccpDeviceConfigView($sccp_comatable); InstallDB_CreateSccpDeviceConfigView($sccp_compatible);
Setup_RealTime(); Setup_RealTime();
outn("<br>"); outn("<br>");

View file

@ -5,7 +5,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
// vim: set ai ts=4 sw=4 ft=phtml: // vim: set ai ts=4 sw=4 ft=phtml:
// print_r($this->sccpvalues['sccp_comatable']); // print_r($this->sccpvalues['sccp_compatible']);
// print_r($this->sccpvalues); // print_r($this->sccpvalues);
// $id_name = 'SEP000A8A5C5F25'; // $id_name = 'SEP000A8A5C5F25';
// print_r($this->srvinterface->getChanSCCPVersion()); // print_r($this->srvinterface->getChanSCCPVersion());