Diederik de Groot <dkgroot@talon.nl> 03.11.2017
- Update README.md - Commented out astman_retrieveJSFromMetaData in install.php (was moved to srvinterface) - Addd/Updated some !TODO! entries - Spelling: - devise -> device - Compatable/Comable -> Compatible - Templet -> Template - buton -> button - Templatee -> Template - format style PHP
This commit is contained in:
parent
9a18a0940b
commit
e416b55654
|
@ -16,10 +16,10 @@
|
|||
* + Model Information
|
||||
* + Device Right Menu
|
||||
|
||||
<!-- Dial Templates are not really needed for skinny, skinny get's direct feed back from asterisk per digit -->
|
||||
<!-- If your dialplan is finite (completely fixed length (depends on your country dialplan) dialplan, then dial templates are not required) -->
|
||||
<!-- As far as i know FreePBX does also attempt to build a finite dialplan -->
|
||||
<!-- Having to maintain both an asterisk dialplan and these skinny dial templates is annoying -->
|
||||
<!-- Dial Templates are not really needed for skinny, skinny get's direct feed back from asterisk per digit -->
|
||||
<!-- If your dialplan is finite (completely fixed length (depends on your country dialplan) dialplan, then dial templates are not required) -->
|
||||
<!-- As far as i know FreePBX does also attempt to build a finite dialplan -->
|
||||
<!-- Having to maintain both an asterisk dialplan and these skinny dial templates is annoying -->
|
||||
|
||||
* + Dial Templates + Configuration
|
||||
* + Dial Templates in Global Configuration ( Enabled / Disabled ; default template )
|
||||
|
@ -76,7 +76,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
// const General - teplet.xml = '20';
|
||||
// const General - system_path = '2';
|
||||
// const General - don't store = '99';
|
||||
|
||||
// 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 $pagedata = null;
|
||||
|
@ -84,7 +83,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
private $tftpLang = array();
|
||||
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
||||
private $val_null = 'NONE'; /// REPLACE to null Field
|
||||
|
||||
public $sccp_model_list = array();
|
||||
private $cnf_wr = null;
|
||||
public $sccppath = array();
|
||||
|
@ -104,18 +102,18 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->v = new \Respect\Validation\Validator();
|
||||
|
||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager";
|
||||
if(class_exists($driverNamespace,false)) {
|
||||
foreach(glob(__DIR__."/Sccp_manager.inc/*.class.php") as $driver) {
|
||||
if(preg_match("/\/([a-z1-9]*)\.class\.php$/i",$driver,$matches)) {
|
||||
if (class_exists($driverNamespace, false)) {
|
||||
foreach (glob(__DIR__ . "/Sccp_manager.inc/*.class.php") as $driver) {
|
||||
if (preg_match("/\/([a-z1-9]*)\.class\.php$/i", $driver, $matches)) {
|
||||
$name = $matches[1];
|
||||
$class = $driverNamespace . "\\" . $name;
|
||||
if(!class_exists($class,false)) {
|
||||
if (!class_exists($class, false)) {
|
||||
include($driver);
|
||||
}
|
||||
if(class_exists($class,false)) {
|
||||
if (class_exists($class, false)) {
|
||||
$this->$name = new $class();
|
||||
} else {
|
||||
throw new \Exception("Invalid Class inside in the include folder".print_r($freepbx));
|
||||
throw new \Exception("Invalid Class inside in the include folder" . print_r($freepbx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
|
||||
// Load Advanced Form Constuctor Data
|
||||
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v'.$this->sccpvalues['sccp_compatible']['data'];
|
||||
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v' . $this->sccpvalues['sccp_compatible']['data'];
|
||||
if (!file_exists($xml_vars)) {
|
||||
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml';
|
||||
}
|
||||
|
@ -145,6 +143,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
/*
|
||||
* Generate Input elements in Html Code from sccpgeneral.xml
|
||||
*/
|
||||
|
||||
public function ShowGroup($grup_name, $heder_show, $form_prefix = 'sccp', $form_values = null) {
|
||||
$htmlret = "";
|
||||
if (empty($form_values)) {
|
||||
|
@ -167,6 +166,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
/*
|
||||
* Load config vars from base array
|
||||
*/
|
||||
|
||||
public function initVarfromDefs() {
|
||||
foreach ($this->extconfigs->getextConfig('sccpDefaults') as $key => $value) {
|
||||
if (empty($this->sccpvalues[$key])) {
|
||||
|
@ -178,6 +178,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
/*
|
||||
* Load config vars from xml
|
||||
*/
|
||||
|
||||
public function initVarfromXml() {
|
||||
if ((array) $this->xml_data) {
|
||||
foreach ($this->xml_data->xpath('//page_group') as $item) {
|
||||
|
@ -232,26 +233,31 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
|
||||
/* unused */
|
||||
|
||||
public function doConfigPageInit($page) {
|
||||
$this->doGeneralPost();
|
||||
}
|
||||
|
||||
/* unused */
|
||||
|
||||
public function install() {
|
||||
|
||||
}
|
||||
|
||||
/* unused */
|
||||
|
||||
public function uninstall() {
|
||||
|
||||
}
|
||||
|
||||
/* unused */
|
||||
|
||||
public function backup() {
|
||||
|
||||
}
|
||||
|
||||
/* unused */
|
||||
|
||||
public function restore($backup) {
|
||||
|
||||
}
|
||||
|
@ -579,7 +585,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (!empty($request['dialplan'])) {
|
||||
$get_file = $request['dialplan'];
|
||||
$res = $this->del_DialPlant($get_file);
|
||||
return array('status' => true, 'message' => 'Dial Template has been deleted ! ', 'table_reload'=>true);
|
||||
return array('status' => true, 'message' => 'Dial Template has been deleted ! ', 'table_reload' => true);
|
||||
} else {
|
||||
return array('status' => false, 'message' => print_r($res));
|
||||
}
|
||||
|
@ -630,9 +636,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$dev_list = $this->srvinterface->sccp_get_active_device();
|
||||
foreach ($dev_list as $key => $data) {
|
||||
if ($cmd_id == 'reset_token') {
|
||||
if (($data['token'] == 'Rej') || ($data['status'] == 'Token ') ) {
|
||||
if (($data['token'] == 'Rej') || ($data['status'] == 'Token ')) {
|
||||
$res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $key));
|
||||
$msg .= 'Send Token reset to :'. $key .' ';
|
||||
$msg .= 'Send Token reset to :' . $key . ' ';
|
||||
}
|
||||
} else {
|
||||
$res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $key));
|
||||
|
@ -678,7 +684,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$save_settings = array();
|
||||
if (!empty($request['model'])) {
|
||||
foreach ($request['model'] as $idv) {
|
||||
$this->dbinterface ->sccp_save_db('sccpdevmodel', array('model' => $idv, 'enabled' => $model_set), 'update', "model");
|
||||
$this->dbinterface->sccp_save_db('sccpdevmodel', array('model' => $idv, 'enabled' => $model_set), 'update', "model");
|
||||
}
|
||||
}
|
||||
return array('status' => true, 'table_reload' => true);
|
||||
|
@ -772,7 +778,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$dev_id['status'] = $staus[$id_name]['status'];
|
||||
$dev_id['address'] = $staus[$id_name]['address'];
|
||||
$dev_id['new_hw'] = 'N';
|
||||
$staus[$id_name]['news'] ='N';
|
||||
$staus[$id_name]['news'] = 'N';
|
||||
} else {
|
||||
$dev_id['description'] = '- -';
|
||||
$dev_id['status'] = 'not connected';
|
||||
|
@ -788,18 +794,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$dev_data = $this->srvinterface->sccp_getdevice_info($id_name);
|
||||
if (!empty($dev_data['SCCP_Vendor']['model_id'])) {
|
||||
// $dev_data = $this->sccp_getdevice_info($id_name);
|
||||
$dev_addon= $dev_data['SCCP_Vendor']['model_addon'];
|
||||
$dev_addon = $dev_data['SCCP_Vendor']['model_addon'];
|
||||
if (empty($dev_addon)) {
|
||||
$dev_addon = null;
|
||||
}
|
||||
$dev_schema = $this-> getSccp_model_information('byciscoid', false, "all", array('model' =>$dev_data['SCCP_Vendor']['model_id']));
|
||||
$dev_schema = $this->getSccp_model_information('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id']));
|
||||
$result[] = array('name' => $id_name, 'mac' => $id_name, 'button' => '---', 'type' => $dev_schema[0]['model'], 'new_hw' => 'Y',
|
||||
'description' => '*NEW* '.$dev_ids['descr'], 'status' => '*NEW* '.$dev_ids['status'], 'address' => $dev_ids['address'],
|
||||
'description' => '*NEW* ' . $dev_ids['descr'], 'status' => '*NEW* ' . $dev_ids['status'], 'address' => $dev_ids['address'],
|
||||
'addon' => $dev_addon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $result;
|
||||
break;
|
||||
|
@ -811,7 +816,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
return $result;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,6 +830,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* * Save Hardware Device Information to Db + ???? Create / update XML Profile
|
||||
*
|
||||
*/
|
||||
|
||||
function save_hw_phone($get_settings, $validateonly = false) {
|
||||
$hdr_prefix = 'sccp_hw_';
|
||||
$hdr_arprefix = 'sccp_hw-ar_';
|
||||
|
@ -877,7 +882,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
if (!empty($get_settings[$hdr_arprefix . $key])) {
|
||||
$arr_data = '';
|
||||
foreach ($get_settings[$hdr_arprefix. $key] as $vkey => $vval) {
|
||||
foreach ($get_settings[$hdr_arprefix . $key] as $vkey => $vval) {
|
||||
$tmp_data = '';
|
||||
foreach ($vval as $vkey => $vval) {
|
||||
$tmp_data .= $vval . '/';
|
||||
|
@ -889,7 +894,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$arr_data = substr($arr_data, 0, -1);
|
||||
$value = $arr_data;
|
||||
}
|
||||
|
||||
}
|
||||
if (!empty($value)) {
|
||||
$save_settings[$key] = $value;
|
||||
|
@ -902,11 +906,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
|
||||
$max_btn = ((!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 100));
|
||||
$last_btn = $max_btn;
|
||||
for ($it = $max_btn; $it >=0; $it--) {
|
||||
for ($it = $max_btn; $it >= 0; $it--) {
|
||||
if (!empty($get_settings['button' . $it . '_type'])) {
|
||||
$last_btn = $it;
|
||||
$btn_t = $get_settings['button' . $it . '_type'];
|
||||
if ($btn_t != 'empty'){
|
||||
if ($btn_t != 'empty') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -938,7 +942,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
case 'monitor':
|
||||
$btn_t = 'speeddial';
|
||||
$btn_opt = (string) $get_settings['button' . $it . '_line'];
|
||||
$db_res = $this-> dbinterface->get_db_SccpTableData('SccpExtension', array('name' => $btn_opt));
|
||||
$db_res = $this->dbinterface->get_db_SccpTableData('SccpExtension', array('name' => $btn_opt));
|
||||
$btn_n = $db_res[0]['label'];
|
||||
$btn_opt .= ',' . $btn_opt . $this->hint_context;
|
||||
break;
|
||||
|
@ -968,7 +972,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
case 'adv.line':
|
||||
$btn_t = 'line';
|
||||
$btn_n = (string) $get_settings['button' . $it . '_line'];
|
||||
$btn_n .= '@'.(string)$get_settings['button' . $it . '_advline'];
|
||||
$btn_n .= '@' . (string) $get_settings['button' . $it . '_advline'];
|
||||
$btn_opt = (string) $get_settings['button' . $it . '_advopt'];
|
||||
|
||||
break;
|
||||
|
@ -998,7 +1002,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
|
||||
// Sace Buttons config
|
||||
$this->dbinterface ->sccp_save_db("sccpbuttons", $save_buttons, $update_hw, '', $name_dev);
|
||||
$this->dbinterface->sccp_save_db("sccpbuttons", $save_buttons, $update_hw, '', $name_dev);
|
||||
|
||||
// Create Device XML
|
||||
$this->sccp_create_device_XML($name_dev);
|
||||
|
@ -1068,9 +1072,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
case 'sccp_ntp_timezone':
|
||||
$tz_id = $value;
|
||||
$TZdata = $this-> extconfigs->getextConfig('sccp_timezone',$tz_id);
|
||||
if (!empty($TZdata)){
|
||||
$save_settings[] = array('keyword' => 'tzoffset', 'data' => ($TZdata['offset']/60),
|
||||
$TZdata = $this->extconfigs->getextConfig('sccp_timezone', $tz_id);
|
||||
if (!empty($TZdata)) {
|
||||
$save_settings[] = array('keyword' => 'tzoffset', 'data' => ($TZdata['offset'] / 60),
|
||||
'seq' => '98',
|
||||
'type' => '2');
|
||||
}
|
||||
|
@ -1093,7 +1097,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->sccpvalues[$var['keyword']] = array('keyword' => $var['keyword'], 'data' => $var['data'], 'seq' => $var['seq'], 'type' => $var['type']);
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
function sccp_get_keysetdata($name) {
|
||||
|
@ -1406,6 +1409,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
/*
|
||||
* Check tftp/xml file path and permissions
|
||||
*/
|
||||
|
||||
private function init_tftp_lang_path() {
|
||||
$dir = $this->sccppath["tftp_path"];
|
||||
foreach ($this->extconfigs->getextConfig('sccp_lang') as $lang_key => $lang_value) {
|
||||
|
@ -1422,6 +1426,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Check file paths and permissions
|
||||
*/
|
||||
/* !TODO!: This function is getting a little big. Might be possible to sperate tftp work into it's own file/class */
|
||||
|
||||
function init_sccp_path() {
|
||||
global $db;
|
||||
global $amp_conf;
|
||||
|
@ -1446,8 +1451,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
if (empty($this->sccppath["tftp_path"])) {
|
||||
if (file_exists($this->extconfigs->getextConfig('sccpDefaults',"tftp_path"))) {
|
||||
$this->sccppath["tftp_path"] = $this->extconfigs->getextConfig('sccpDefaults',"tftp_path");
|
||||
if (file_exists($this->extconfigs->getextConfig('sccpDefaults', "tftp_path"))) {
|
||||
$this->sccppath["tftp_path"] = $this->extconfigs->getextConfig('sccpDefaults', "tftp_path");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1491,15 +1496,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (empty($driver['sccp']['Version'])) {
|
||||
$driver_replace = 'yes';
|
||||
} else {
|
||||
if ($driver['sccp']['Version'] != $this->sccp_driver_ver){
|
||||
if ($driver['sccp']['Version'] != $this->sccp_driver_ver) {
|
||||
$driver_replace = 'yes';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
|
||||
if (!file_exists($dst) || $driver_replace =='yes') {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst).'.v'.$this->sccpvalues['sccp_compatible']['data'];
|
||||
if (!file_exists($dst) || $driver_replace == 'yes') {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $this->sccpvalues['sccp_compatible']['data'];
|
||||
if (file_exists($src_path)) {
|
||||
copy($src_path, $dst);
|
||||
} else {
|
||||
|
@ -1508,8 +1513,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
} else {
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!file_exists($this->sccppath["sccp_conf"])) { // System re Config
|
||||
|
@ -1538,24 +1541,25 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
*/
|
||||
/* !TODO!: please use DialPlan instead of DP */
|
||||
/* !TODO!: I think Dialplan stuff can be removed or at least commented out */
|
||||
|
||||
function get_DP_list() {
|
||||
$dir = $this->sccppath["tftp_DP"].'/*.xml';
|
||||
$base_len = strlen($this->sccppath["tftp_DP"])+ 1;
|
||||
$dir = $this->sccppath["tftp_DP"] . '/*.xml';
|
||||
$base_len = strlen($this->sccppath["tftp_DP"]) + 1;
|
||||
$res = glob($dir);
|
||||
$dp_list = array();
|
||||
foreach ($res as $key => $value) {
|
||||
$res[$key] = array('id'=> substr($value,$base_len,-4), 'file' => substr($value,$base_len));
|
||||
$res[$key] = array('id' => substr($value, $base_len, -4), 'file' => substr($value, $base_len));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function get_DialPlan($get_file) {
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml';
|
||||
$file = $this->sccppath["tftp_DP"] . '/' . $get_file . '.xml';
|
||||
if (file_exists($file)) {
|
||||
// $load_xml_data = simplexml_load_file($file);
|
||||
|
||||
$fileContents= file_get_contents($file);
|
||||
$fileContents = file_get_contents($file);
|
||||
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
|
||||
$fileContents = trim(str_replace('"', "'", $fileContents));
|
||||
$fileContents = strtolower($fileContents);
|
||||
|
@ -1566,7 +1570,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
function del_DialPlan($get_file) {
|
||||
if (!empty($get_file)) {
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml';
|
||||
$file = $this->sccppath["tftp_DP"] . '/' . $get_file . '.xml';
|
||||
if (file_exists($file)) {
|
||||
$res = unlink($file);
|
||||
}
|
||||
|
@ -1574,47 +1578,50 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
|
||||
function save_DialPlan($get_settings) {
|
||||
$xmlstr = "<DIALTEMPLATE>\n";
|
||||
$dialFelds = array('match','timeout','rewrite','tone'); //str -to lo !
|
||||
$dialFelds = array('match', 'timeout', 'rewrite', 'tone'); //str -to lo !
|
||||
|
||||
$hdr_prefix = 'sccp_dial_';
|
||||
$hdr_arprefix = 'sccp_dial-ar_';
|
||||
$save_data = array();
|
||||
$integer_msg = _("%s must be a non-negative integer");
|
||||
$errors = array();
|
||||
foreach ($get_settings[$hdr_arprefix.'dialtemplate'] as $key => $value) {
|
||||
foreach ($get_settings[$hdr_arprefix . 'dialtemplate'] as $key => $value) {
|
||||
$xmlstr .= '<TEMPLATE';
|
||||
if (!empty($value['match'])) {
|
||||
foreach ($dialFelds as $fld){
|
||||
if (isset($value[$fld]) ) {
|
||||
foreach ($dialFelds as $fld) {
|
||||
if (isset($value[$fld])) {
|
||||
if ($value[$fld] == 'empty' || $value[$fld] == '') {
|
||||
//
|
||||
} else {
|
||||
$xmlstr .= ' '.$fld.'="'.(string)$value[$fld].'"';
|
||||
$xmlstr .= ' ' . $fld . '="' . (string) $value[$fld] . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors = array('Fields need to match !!');
|
||||
|
||||
}
|
||||
$xmlstr .= "/>\n";
|
||||
}
|
||||
$xmlstr .= '</DIALTEMPLATE>';
|
||||
if (!empty($get_settings['idtemplate'])) {
|
||||
if ($get_settings['idtemplate'] == '*new*') {
|
||||
if (!empty($get_settings[$hdr_prefix.'dialtemplate_name'])) {
|
||||
$put_file = (string)$get_settings[$hdr_prefix.'dialtemplate_name'];
|
||||
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
|
||||
} else $put_file = (string)$get_settings['idtemplate'];
|
||||
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
|
||||
if (!empty($get_settings[$hdr_prefix . 'dialtemplate_name'])) {
|
||||
$put_file = (string) $get_settings[$hdr_prefix . 'dialtemplate_name'];
|
||||
} else {
|
||||
$errors = array('Fields Dial Plan Name is requered !!');
|
||||
}
|
||||
} else
|
||||
$put_file = (string) $get_settings['idtemplate'];
|
||||
} else {
|
||||
$errors = array('Fields Dial Plan Name is requered !!');
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
// $put_file = 'test';
|
||||
$put_file = str_replace(array("\n", "\r", "\t","/","\\",".",","), '', $put_file);
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$put_file.'.xml';
|
||||
$put_file = str_replace(array("\n", "\r", "\t", "/", "\\", ".", ","), '', $put_file);
|
||||
$file = $this->sccppath["tftp_DP"] . '/' . $put_file . '.xml';
|
||||
file_put_contents($file, $xmlstr);
|
||||
}
|
||||
|
||||
|
@ -1626,7 +1633,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* sccp_db_save_setting(empty) - Save All settings from $sccpvalues
|
||||
*/
|
||||
|
||||
|
||||
private function sccp_db_save_setting($save_value = array()) {
|
||||
global $db;
|
||||
global $amp_conf;
|
||||
|
@ -1666,7 +1672,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
$this->xmlinterface->create_default_XML($this->sccppath["tftp_path"], $data_value, $model_information, $lang_data);
|
||||
|
||||
/*
|
||||
/*
|
||||
$def_xml_fields = array('authenticationURL', 'informationURL', 'messagesURL', 'servicesURL', 'directoryURL', 'proxyServerURL', 'idleTimeout', 'idleURL');
|
||||
$def_xml_locale = array('userLocale', 'networkLocaleInfo', 'networkLocale');
|
||||
$xml_name = $this->sccppath["tftp_path"] . '/XMLDefault.cnf.xml';
|
||||
|
@ -1722,11 +1728,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
} else {
|
||||
$lang = $this->sccpvalues['devlang']['data'];
|
||||
}
|
||||
// configs->getConfig('sccp_lang')
|
||||
// configs->getConfig('sccp_lang')
|
||||
$lang_arr = $this->extconfigs->getextConfig('sccp_lang',$lang);
|
||||
$xnode->name = $lang_arr['locale'];
|
||||
$xnode->langCode = $$lang_arr['code'];
|
||||
// $this -> replaceSimpleXmlNode($xml_work->$key,$xnode);
|
||||
// $this -> replaceSimpleXmlNode($xml_work->$key,$xnode);
|
||||
break;
|
||||
case 'networkLocale':
|
||||
$lang_arr = $this->extconfigs->getextConfig('sccp_lang',$this->sccpvalues['netlang']['data']);
|
||||
|
@ -1750,7 +1756,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
//
|
||||
//
|
||||
//
|
||||
// die(print_r($xml_work));
|
||||
// die(print_r($xml_work));
|
||||
}
|
||||
*
|
||||
*/
|
||||
|
@ -1771,7 +1777,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
foreach ($this->sccpvalues as $key => $value) {
|
||||
$data_value[$key] = $value['data'];
|
||||
}
|
||||
$data_value['ntp_timezone_id'] = $this-> extconfigs->getextConfig('sccp_timezone',$data_value['ntp_timezone']);
|
||||
$data_value['ntp_timezone_id'] = $this->extconfigs->getextConfig('sccp_timezone', $data_value['ntp_timezone']);
|
||||
$data_value['server_if_list'] = $this->getIP_information();
|
||||
|
||||
$dev_config['addon_info'] = array();
|
||||
|
@ -1827,11 +1833,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
|
||||
foreach ($xml_work as $key => $data) {
|
||||
// Set System global Values
|
||||
// Set System global Values
|
||||
if (!empty($var_xml_general_fields[$key])) {
|
||||
$xml_work->$key = $this->sccpvalues[$var_xml_general_fields[$key]]['data'];
|
||||
}
|
||||
// Set section Values
|
||||
// Set section Values
|
||||
$xml_node = $xml_work->$key;
|
||||
switch ($key) {
|
||||
case 'devicePool':
|
||||
|
@ -1868,11 +1874,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$xnode -> isSecure = $this->sccpvalues['srst_isSecure']['data'];
|
||||
|
||||
$srst_fld = array('srst_ip' => array('ipAddr','port') );
|
||||
// $srst_fld = array('srst_ip' => array('ipAddr','port') , 'srst_sip' => array('sipIpAddr','sipPort') );
|
||||
// $srst_fld = array('srst_ip' => array('ipAddr','port') , 'srst_sip' => array('sipIpAddr','sipPort') );
|
||||
foreach ($srst_fld as $srst_pro => $srs_put){
|
||||
$srst_data = explode(';', $this->sccpvalues[$srst_pro]['data']);
|
||||
$si = 1;
|
||||
// $xnode['test'] = $srst_data[0];
|
||||
// $xnode['test'] = $srst_data[0];
|
||||
foreach ($srst_data as $value) {
|
||||
$srs_val = explode('/',$value);
|
||||
$nod = $srs_put[0].$si;
|
||||
|
@ -1901,8 +1907,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (!empty($value[0])) {
|
||||
if (!in_array($value[0], array('0.0.0.0', '127.0.0.1'), true)) {
|
||||
$xnode_obj = clone $xnode->member;
|
||||
// $xnode_obj = $xnode -> member;
|
||||
// $xnode_obj = $xnode -> addChild($xnode->member);
|
||||
// $xnode_obj = $xnode -> member;
|
||||
// $xnode_obj = $xnode -> addChild($xnode->member);
|
||||
$xnode_obj['priority'] = $ifc;
|
||||
//$xnode_obj = &$xnode -> member -> callManager;
|
||||
$xnode_obj->callManager->name = $this->sccpvalues['servername']['data'];
|
||||
|
@ -1941,12 +1947,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
foreach ($hw_addon as $key) {
|
||||
$hw_inf = $this->getSccp_model_information('byid', false, "all", array('model' => $key));
|
||||
$xnode_obj = $xnode->addChild('addOnModule');
|
||||
// if $hw_inf['loadimage']
|
||||
// if $hw_inf['loadimage']
|
||||
$xnode_obj->addAttribute('idx', $ti);
|
||||
$xnode_obj->addChild('loadInformation', $hw_inf[0]['loadimage']);
|
||||
$ti ++;
|
||||
}
|
||||
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
|
||||
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
|
||||
}
|
||||
break;
|
||||
case 'userLocale':
|
||||
|
@ -1958,11 +1964,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$hwlang = explode(':', $var_hw_config["_hwlang"]);
|
||||
}
|
||||
if (($key == 'networkLocaleInfo') || ($key == 'networkLocale')) {
|
||||
// $lang=$this->sccpvalues['netlang']['data'];
|
||||
// $lang=$this->sccpvalues['netlang']['data'];
|
||||
$lang = (empty($hwlang[0])) ? $this->sccpvalues['netlang']['data'] : $hwlang[0];
|
||||
} else {
|
||||
$lang = (empty($hwlang[1])) ? $this->sccpvalues['devlang']['data'] : $hwlang[1];
|
||||
// $lang=$this->sccpvalues['devlang']['data'];
|
||||
// $lang=$this->sccpvalues['devlang']['data'];
|
||||
}
|
||||
if (($lang !='null') && (!empty(trim($lang)))) {
|
||||
if ($key == 'networkLocale') {
|
||||
|
@ -1979,19 +1985,19 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$xml_work->$key ='';
|
||||
}
|
||||
break;
|
||||
// Move all set to $var_xml_general_vars
|
||||
// case 'mobility':
|
||||
// case 'capfList':
|
||||
// break;
|
||||
// case 'phoneServices':
|
||||
// break;
|
||||
// $xml_work->$key = '';
|
||||
// Move all set to $var_xml_general_vars
|
||||
// case 'mobility':
|
||||
// case 'capfList':
|
||||
// break;
|
||||
// case 'phoneServices':
|
||||
// break;
|
||||
// $xml_work->$key = '';
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($xml_work);
|
||||
// print_r($xml_work);
|
||||
$xml_work->asXml($xml_name); // Save
|
||||
} else {
|
||||
die('Error Hardware template :' . $xml_template . ' not found');
|
||||
|
@ -2005,11 +2011,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (empty($dev_id)) {
|
||||
return false;
|
||||
}
|
||||
if ($dev_id =='all') {
|
||||
if ($dev_id == 'all') {
|
||||
$xml_name = $this->sccppath["tftp_path"] . '/SEP*.cnf.xml';
|
||||
array_map("unlink", glob($xml_name));
|
||||
} else {
|
||||
if (!strpos($dev_id,'SEP')) {
|
||||
if (!strpos($dev_id, 'SEP')) {
|
||||
return false;
|
||||
}
|
||||
$xml_name = $this->sccppath["tftp_path"] . '/' . $dev_id . '.cnf.xml';
|
||||
|
@ -2019,9 +2025,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sccp_create_sccp_init() {
|
||||
// Make sccp.conf data
|
||||
// [general]
|
||||
|
@ -2057,7 +2060,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$dir = $this->sccppath["tftp_path"];
|
||||
$dir_tepl = $this->sccppath["tftp_templates"];
|
||||
|
||||
$raw_settings = $this-> dbinterface -> getDb_model_info($get, $format_list, $filter) ;
|
||||
$raw_settings = $this->dbinterface->getDb_model_info($get, $format_list, $filter);
|
||||
|
||||
if ($validate) {
|
||||
for ($i = 0; $i < count($raw_settings); $i++) {
|
||||
|
@ -2098,7 +2101,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $raw_settings;
|
||||
}
|
||||
|
||||
|
||||
function getIP_information() {
|
||||
$interfaces['auto'] = array('0.0.0.0', 'All', '0');
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
/**
|
||||
*
|
||||
* Core Comsnd Interface
|
||||
*
|
||||
|
@ -7,21 +8,25 @@
|
|||
*/
|
||||
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
|
||||
class dbinterface {
|
||||
|
||||
private $val_null = 'NONE'; /// REPLACE to null Field
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
return Array('Version' => $Ver,
|
||||
'about' =>'Data access interface ver: '.$Ver);
|
||||
'about' => 'Data access interface ver: ' . $Ver);
|
||||
}
|
||||
|
||||
/*
|
||||
* Core Access Function
|
||||
*/
|
||||
|
||||
public function get_db_SccpTableData($dataid, $data = array()) {
|
||||
if ($dataid == '') {
|
||||
return False;
|
||||
|
@ -76,6 +81,7 @@ class dbinterface {
|
|||
/*
|
||||
* Get Sccp Device Model information
|
||||
*/
|
||||
|
||||
function getDb_model_info($get = "all", $format_list = "all", $filter = array()) {
|
||||
global $db;
|
||||
switch ($format_list) {
|
||||
|
@ -93,7 +99,7 @@ class dbinterface {
|
|||
case "byciscoid":
|
||||
if (!empty($filter)) {
|
||||
if (!empty($filter['model'])) {
|
||||
if (strpos($filter['model'],'loadInformation')) {
|
||||
if (strpos($filter['model'], 'loadInformation')) {
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='" . $filter['model'] . "') ORDER BY model ";
|
||||
} else {
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='loadInformation" . $filter['model'] . "') ORDER BY model ";
|
||||
|
@ -204,4 +210,5 @@ class dbinterface {
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
|
||||
class extconfigs {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
@ -11,7 +15,7 @@ class extconfigs {
|
|||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
return Array('Version' => $Ver,
|
||||
'about' =>'Default Setings and Enums ver: '.$Ver);
|
||||
'about' => 'Default Setings and Enums ver: ' . $Ver);
|
||||
}
|
||||
|
||||
public function getextConfig($id = '', $index = '') {
|
||||
|
@ -28,14 +32,14 @@ class extconfigs {
|
|||
case 'sccp_timezone':
|
||||
$result = array();
|
||||
foreach ($this->cisco_timezone as $key => $value) {
|
||||
$cisco_code = $key .' Standard'.((empty($value['daylight']))? '': '/'.$value['daylight']).' Time';
|
||||
$cisco_code = $key . ' Standard' . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']) . ' Time';
|
||||
if (isset($value['cisco_code'])) {
|
||||
$cisco_code = (empty($value['cisco_code']))? $cisco_code : $value['cisco_code'];
|
||||
$cisco_code = (empty($value['cisco_code'])) ? $cisco_code : $value['cisco_code'];
|
||||
}
|
||||
$result[$key] = array('offset' => $value['offset'], 'daylight' => $value['daylight'], 'cisco_code' =>$cisco_code);
|
||||
$result[$key] = array('offset' => $value['offset'], 'daylight' => $value['daylight'], 'cisco_code' => $cisco_code);
|
||||
}
|
||||
break;
|
||||
/* case 'cisco_time':
|
||||
/* case 'cisco_time':
|
||||
$result = array();
|
||||
foreach ($this->cisco_timezone as $key => $value) {
|
||||
$result[] = array('id'=> ($value['offset']/60) ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
|
||||
|
@ -45,7 +49,7 @@ class extconfigs {
|
|||
case 'cisco_timezone':
|
||||
$result = array();
|
||||
foreach ($this->cisco_timezone as $key => $value) {
|
||||
$result[] = array('id'=> $key ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
|
||||
$result[] = array('id' => $key, 'val' => $key . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']));
|
||||
// $result[$key] =$key.((empty($value['daylight']))? '': '/'.$value['daylight']);
|
||||
}
|
||||
break;
|
||||
|
@ -81,7 +85,6 @@ class extconfigs {
|
|||
"linetable" => 'sccpline',
|
||||
"tftp_path" => '/tftpboot'
|
||||
);
|
||||
|
||||
private $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,dnd,pickup,gpickup,private',
|
||||
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert',
|
||||
'onhold' => 'resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme',
|
||||
|
@ -137,7 +140,6 @@ class extconfigs {
|
|||
'zh_CN' => array('code' => 'cn', 'language' => 'Chinese', 'locale' => 'Chinese_China'),
|
||||
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan')
|
||||
);
|
||||
|
||||
private $cisco_timezone = array(
|
||||
'Dateline' => array('offset' => '-720', 'daylight' => ''),
|
||||
'Samoa' => array('offset' => '-660', 'daylight' => ''),
|
||||
|
@ -172,7 +174,7 @@ class extconfigs {
|
|||
'South Africa' => array('offset' => '120', 'daylight' => ''),
|
||||
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
|
||||
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
|
||||
/* Russion Regions */
|
||||
/* Russion Regions */
|
||||
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'),
|
||||
'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
|
||||
'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
|
||||
|
@ -187,7 +189,6 @@ class extconfigs {
|
|||
'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
|
||||
'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
|
||||
/* EnD - Russion Regions */
|
||||
|
||||
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
|
||||
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
|
||||
'Arabian' => array('offset' => '240', 'daylight' => ''),
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
/**
|
||||
*
|
||||
* Core Comsnd Interface
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* !TODO!: Re-Indent this file */
|
||||
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
|
||||
class srvinterface {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
return Array('Version' => $Ver,
|
||||
'about' =>'Server interface data ver: '.$Ver);
|
||||
'about' => 'Server interface data ver: ' . $Ver);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Core Access Function
|
||||
*/
|
||||
|
||||
public function sccp_core_commands($params = array()) {
|
||||
global $astman;
|
||||
$cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''),
|
||||
|
@ -41,7 +45,7 @@ class srvinterface {
|
|||
$id_param = $cmd_list[$id_cmd]['param'];
|
||||
if (!empty($id_param)) {
|
||||
if (!empty($params[$id_param])) {
|
||||
$result = $astman->Command($cmd_list[$id_cmd]['cmd'] .' '. $params[$id_param]);
|
||||
$result = $astman->Command($cmd_list[$id_cmd]['cmd'] . ' ' . $params[$id_param]);
|
||||
}
|
||||
} else {
|
||||
$result = $astman->Command($cmd_list[$id_cmd]['cmd']);
|
||||
|
@ -79,15 +83,15 @@ class srvinterface {
|
|||
return array();
|
||||
}
|
||||
$res = $this->sccp_core_commands(array('cmd' => 'get_dev_info', 'name' => $dev_id));
|
||||
$res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string)$res['data']));
|
||||
if (strpos($res1,'MAC-Address')) {
|
||||
$res2 = substr($res1,0,strpos($res1,'+--- Buttons '));
|
||||
$res1 = explode(';',substr($res2,strpos($res2,'MAC-Address')));
|
||||
foreach ($res1 as $data ){
|
||||
$res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string) $res['data']));
|
||||
if (strpos($res1, 'MAC-Address')) {
|
||||
$res2 = substr($res1, 0, strpos($res1, '+--- Buttons '));
|
||||
$res1 = explode(';', substr($res2, strpos($res2, 'MAC-Address')));
|
||||
foreach ($res1 as $data) {
|
||||
if (!empty($data)) {
|
||||
$tmp = explode(':',$data);
|
||||
$data_key =str_replace(array(" ", "-", "\t"), '_', trim($tmp[0]));
|
||||
$res3[$data_key] =$tmp[1];
|
||||
$tmp = explode(':', $data);
|
||||
$data_key = str_replace(array(" ", "-", "\t"), '_', trim($tmp[0]));
|
||||
$res3[$data_key] = $tmp[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,9 +102,9 @@ class srvinterface {
|
|||
} else {
|
||||
$res2 = '';
|
||||
}
|
||||
$res3['SCCP_Vendor']= Array('vendor' => strtok($res1,' '),'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2,' '), 'model_addon' => strtok(' '));
|
||||
if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor']=='Undefined'){
|
||||
$res3['SCCP_Vendor']= Array('vendor' => 'Undefined','model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']);
|
||||
$res3['SCCP_Vendor'] = Array('vendor' => strtok($res1, ' '), 'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2, ' '), 'model_addon' => strtok(' '));
|
||||
if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor'] == 'Undefined') {
|
||||
$res3['SCCP_Vendor'] = Array('vendor' => 'Undefined', 'model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']);
|
||||
// return $res4;
|
||||
// return array();
|
||||
}
|
||||
|
@ -110,7 +114,8 @@ class srvinterface {
|
|||
}
|
||||
}
|
||||
|
||||
/* Current not use */
|
||||
/* Current not use */
|
||||
|
||||
public function sccp_list_hints() {
|
||||
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints'));
|
||||
$ast_out = preg_split("/[\n]/", $ast_out['data']);
|
||||
|
@ -136,11 +141,12 @@ class srvinterface {
|
|||
return $ast_key;
|
||||
}
|
||||
|
||||
/* !TODO!: install.php is still using the other version number*/
|
||||
/* !TODO!: install.php is still using the other version number */
|
||||
|
||||
public function get_compatible_sccp() {
|
||||
$res = $this-> getChanSCCPVersion();
|
||||
$res = $this->getChanSCCPVersion();
|
||||
if (empty($res)) {
|
||||
$res = $this-> getChanSCCPVersion();
|
||||
$res = $this->getChanSCCPVersion();
|
||||
}
|
||||
if (empty($res)) {
|
||||
return 0;
|
||||
|
@ -153,26 +159,26 @@ class srvinterface {
|
|||
// return $res["vCode"];
|
||||
}
|
||||
|
||||
/* !TODO!: Multiple Version functions (choose one)*/
|
||||
/* !TODO!: Multiple Version functions (choose one) */
|
||||
/* !TODO!: private ? */
|
||||
|
||||
function getCoreSCCPVersion() {
|
||||
$result = array();
|
||||
$ast_out = $this->sccp_version();
|
||||
$result["Version"] = $ast_out[0];
|
||||
$version_parts=explode(".", $ast_out[0]);
|
||||
$version_parts = explode(".", $ast_out[0]);
|
||||
$result["vCode"] = implode('', $version_parts);
|
||||
if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){
|
||||
if (!empty($ast_out[1]) && $ast_out[1] == 'develop') {
|
||||
$result["develop"] = $ast_out[1];
|
||||
$res = 10;
|
||||
if (base_convert($ast_out[3],16,10) == base_convert('702487a',16,10)) { /* !TODO!: This does not work as you might expect */
|
||||
if (base_convert($ast_out[3], 16, 10) == base_convert('702487a', 16, 10)) { /* !TODO!: This does not work as you might expect */
|
||||
$result["vCode"] = 431;
|
||||
}
|
||||
if (base_convert($ast_out[3],16,10) >= "10403") { // new method, RevisionNum is incremental
|
||||
if (base_convert($ast_out[3], 16, 10) >= "10403") { // new method, RevisionNum is incremental
|
||||
$result["vCode"] = 432;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/* !TODO!: Old Method */
|
||||
|
@ -187,8 +193,9 @@ class srvinterface {
|
|||
}
|
||||
}
|
||||
|
||||
/* !TODO!: Multiple Version functions (choose one :-)*/
|
||||
/* !TODO!: Multiple Version functions (choose one :-) */
|
||||
/* !TODO!: private ? */
|
||||
|
||||
function getChanSCCPVersion() {
|
||||
global $astman;
|
||||
$result = array();
|
||||
|
@ -196,9 +203,9 @@ class srvinterface {
|
|||
return $result;
|
||||
}
|
||||
$metadata = $this->astman_retrieveJSFromMetaData("");
|
||||
if ($metadata && array_key_exists("Version",$metadata)) {
|
||||
if ($metadata && array_key_exists("Version", $metadata)) {
|
||||
$result["Version"] = $metadata["Version"];
|
||||
$version_parts=explode(".", $metadata["Version"]);
|
||||
$version_parts = explode(".", $metadata["Version"]);
|
||||
$result["vCode"] = 0;
|
||||
|
||||
# not sure about this sccp_ver numbering. Might be better to just check "Version" and Revision
|
||||
|
@ -228,29 +235,29 @@ class srvinterface {
|
|||
}
|
||||
*/
|
||||
|
||||
/* Revision got replaced by RevisionHash in 10404 (using the hash does not work)*/
|
||||
if (array_key_exists("Revision",$metadata)) {
|
||||
if (base_convert($metadata["Revision"],16,10) == base_convert('702487a',16,10)) {
|
||||
/* Revision got replaced by RevisionHash in 10404 (using the hash does not work) */
|
||||
if (array_key_exists("Revision", $metadata)) {
|
||||
if (base_convert($metadata["Revision"], 16, 10) == base_convert('702487a', 16, 10)) {
|
||||
$result["vCode"] = 431;
|
||||
}
|
||||
if (base_convert($metadata["Revision"],16,10) >= "10403") {
|
||||
if (base_convert($metadata["Revision"], 16, 10) >= "10403") {
|
||||
$result["vCode"] = 431;
|
||||
}
|
||||
}
|
||||
if (array_key_exists("RevisionNum",$metadata)) {
|
||||
$result["RevisionNum"]=$metadata["RevisionNum"];
|
||||
if (array_key_exists("RevisionNum", $metadata)) {
|
||||
$result["RevisionNum"] = $metadata["RevisionNum"];
|
||||
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
|
||||
$result["vCode"] = 432;
|
||||
}
|
||||
}
|
||||
if (array_key_exists("ConfigureEnabled",$metadata)) {
|
||||
if (array_key_exists("ConfigureEnabled", $metadata)) {
|
||||
$result["futures"] = implode(';', $metadata["ConfigureEnabled"]);
|
||||
}
|
||||
} else {
|
||||
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_list_keysets() {
|
||||
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey'));
|
||||
|
@ -308,12 +315,11 @@ class srvinterface {
|
|||
list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
|
||||
|
||||
// list ($descr, $adress, $devname, $status, $junk) = $line_arr;
|
||||
|
||||
// if (strlen($ast_key[$devname]) < 1) {
|
||||
if (strlen($devname) > 1) {
|
||||
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
if (isset($ast_key[$devname])) {
|
||||
if (strlen($ast_key[$devname]) < 1) {
|
||||
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $descr);
|
||||
|
@ -327,7 +333,8 @@ class srvinterface {
|
|||
}
|
||||
return $ast_key;
|
||||
}
|
||||
/*
|
||||
|
||||
/*
|
||||
* Replace sccp_core_commands($params = array()) {
|
||||
*/
|
||||
|
||||
|
@ -340,7 +347,7 @@ class srvinterface {
|
|||
$response = $astman->send_request('SCCPConfigMetaData', $params);
|
||||
if ($response["Response"] == "Success") {
|
||||
//outn(_("JSON-content:").$response["JSON"]);
|
||||
$decode=json_decode($response["JSON"], true);
|
||||
$decode = json_decode($response["JSON"], true);
|
||||
return $decode;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -1,26 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
/**
|
||||
*
|
||||
* Core Comsnd Interface
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* !TODO!: Would you like to use my XSD file to check if the provided template file is a correct cisco cnf.xml file ? */
|
||||
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
|
||||
class xmlinterface {
|
||||
|
||||
private $val_null = 'NONE'; /// REPLACE to null Field
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '13.0.2';
|
||||
return Array('Version' => $Ver,
|
||||
'about' =>'Create XML data interface ver: '.$Ver);
|
||||
'about' => 'Create XML data interface ver: ' . $Ver);
|
||||
}
|
||||
|
||||
|
||||
function create_default_XML($data_path = '', $data_values= array(), $model_information =array(), $lang_info =array()) {
|
||||
function create_default_XML($data_path = '', $data_values = array(), $model_information = array(), $lang_info = array()) {
|
||||
if (empty($data_path) || empty($data_values)) {
|
||||
return;
|
||||
}
|
||||
|
@ -112,15 +116,14 @@ class xmlinterface {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function create_SEP_XML($data_path = '', $data_values= array(), $dev_config = array(), $dev_id = '',$lang_info =array()) {
|
||||
function create_SEP_XML($data_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array()) {
|
||||
|
||||
$var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL',
|
||||
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
|
||||
'idleURL' => 'dev_idleURL', 'sshUserId' => 'dev_sshUserId', 'sshPassword' => 'dev_sshPassword', 'deviceProtocol' => 'dev_deviceProtocol'
|
||||
);
|
||||
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList'=> 'null', 'mobility' => 'null',
|
||||
'phoneServices' =>'null', 'certHash' =>'null',
|
||||
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
|
||||
'phoneServices' => 'null', 'certHash' => 'null',
|
||||
'deviceSecurityMode' => '1');
|
||||
|
||||
if (empty($dev_id)) {
|
||||
|
@ -168,7 +171,7 @@ class xmlinterface {
|
|||
$xnode = &$xml_node->$dkey;
|
||||
$tz_id = $data_values['ntp_timezone'];
|
||||
$TZdata = $data_values['ntp_timezone_id'];
|
||||
if (empty($TZdata)){
|
||||
if (empty($TZdata)) {
|
||||
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
|
||||
}
|
||||
$xnode->name = $tz_id;
|
||||
|
@ -189,36 +192,36 @@ class xmlinterface {
|
|||
break;
|
||||
}
|
||||
$xnode = &$xml_node->$dkey;
|
||||
$xnode -> name = $data_values['srst_Name'];
|
||||
$xnode -> srstOption = $data_values['srst_Option'];
|
||||
$xnode -> userModifiable = $data_values['srst_userModifiable'];
|
||||
$xnode -> isSecure = $data_values['srst_isSecure'];
|
||||
$xnode->name = $data_values['srst_Name'];
|
||||
$xnode->srstOption = $data_values['srst_Option'];
|
||||
$xnode->userModifiable = $data_values['srst_userModifiable'];
|
||||
$xnode->isSecure = $data_values['srst_isSecure'];
|
||||
|
||||
$srst_fld = array('srst_ip' => array('ipAddr','port') );
|
||||
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
|
||||
// $srst_fld = array('srst_ip' => array('ipAddr','port') , 'srst_sip' => array('sipIpAddr','sipPort') );
|
||||
foreach ($srst_fld as $srst_pro => $srs_put){
|
||||
foreach ($srst_fld as $srst_pro => $srs_put) {
|
||||
$srst_data = explode(';', $data_values[$srst_pro]);
|
||||
$si = 1;
|
||||
// $xnode['test'] = $srst_data[0];
|
||||
foreach ($srst_data as $value) {
|
||||
$srs_val = explode('/',$value);
|
||||
$nod = $srs_put[0].$si;
|
||||
$xnode -> $nod = $srs_val[0];
|
||||
$nod = $srs_put[1].$si;
|
||||
$xnode -> $nod = $srs_val[1];
|
||||
$srs_val = explode('/', $value);
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = $srs_val[0];
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = $srs_val[1];
|
||||
$si ++;
|
||||
}
|
||||
while ($si < 4) {
|
||||
$nod = $srs_put[0].$si;
|
||||
$xnode -> $nod = '';
|
||||
$nod = $srs_put[1].$si;
|
||||
$xnode -> $nod = '';
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = '';
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = '';
|
||||
$si ++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'connectionMonitorDuration':
|
||||
$xml_node->$dkey = strval(intval(intval($data_values['keepalive'])* 0.75));
|
||||
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
|
||||
break;
|
||||
case 'callManagerGroup':
|
||||
$xnode = &$xml_node->$dkey->members;
|
||||
|
@ -286,7 +289,7 @@ class xmlinterface {
|
|||
} else {
|
||||
$lang = (empty($hwlang[1])) ? $data_values['devlang'] : $hwlang[1];
|
||||
}
|
||||
if (($lang !='null') && (!empty(trim($lang)))) {
|
||||
if (($lang != 'null') && (!empty(trim($lang)))) {
|
||||
if ($key == 'networkLocale') {
|
||||
$xml_work->$key = $lang;
|
||||
} else {
|
||||
|
@ -297,7 +300,7 @@ class xmlinterface {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$xml_work->$key ='';
|
||||
$xml_work->$key = '';
|
||||
}
|
||||
break;
|
||||
// Move all set to $var_xml_general_vars
|
||||
|
@ -320,8 +323,6 @@ class xmlinterface {
|
|||
return time();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement) {
|
||||
$dom = dom_import_simplexml($xml);
|
||||
$import = $dom->ownerDocument->importNode(
|
||||
|
@ -340,6 +341,4 @@ class xmlinterface {
|
|||
$dom->parentNode->appendChild($import->cloneNode(true));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
// vim: set ai ts=4 sw=4 ft=php:
|
||||
// Version for SCCP Manager 13.0.0.A
|
||||
namespace FreePBX\modules\Core\Drivers;
|
||||
|
|
360
install.php
360
install.php
|
@ -12,72 +12,69 @@ global $srvinterface;
|
|||
|
||||
|
||||
$class = "\\FreePBX\\Modules\\Sccp_manager\\srvinterface";
|
||||
if(!class_exists($class,false)) {
|
||||
include(__DIR__."/Sccp_manager.inc/srvinterface.class.php");
|
||||
if (!class_exists($class, false)) {
|
||||
include(__DIR__ . "/Sccp_manager.inc/srvinterface.class.php");
|
||||
}
|
||||
if(class_exists($class,false)) {
|
||||
if (class_exists($class, false)) {
|
||||
$srvinterface = new $class();
|
||||
}
|
||||
|
||||
function Get_DB_config($sccp_compatible) {
|
||||
$db_config_v0 = array(
|
||||
$db_config_v0 = array(
|
||||
'sccpdevmodel' => array(
|
||||
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL")
|
||||
),
|
||||
'sccpdevice' => array(
|
||||
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
|
||||
//'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
|
||||
'transfer' =>array('def_modify' => "on"),
|
||||
'cfwdall' =>array('def_modify' => "on"),
|
||||
'cfwdbusy' =>array('def_modify' => "on"),
|
||||
'directrtp' =>array('def_modify' => "off"),
|
||||
'dndFeature' =>array('def_modify' => "on"),
|
||||
'earlyrtp' =>array('def_modify' => "on"),
|
||||
'audio_tos'=>array('def_modify' => "0xB8"),
|
||||
'audio_cos'=>array('def_modify' => "6"),
|
||||
'video_tos'=>array('def_modify' => "0x88"),
|
||||
'video_cos'=>array('def_modify' => "5"),
|
||||
|
||||
'mwilamp' =>array('def_modify' => "on"),
|
||||
'mwioncall' =>array('def_modify' => "on"),
|
||||
'private' =>array('def_modify' => "on"),
|
||||
'privacy' =>array('def_modify' => "off"),
|
||||
'nat' =>array('def_modify' => "auto"),
|
||||
'softkeyset' =>array('def_modify' => "softkeyset")
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'transfer' => array('def_modify' => "on"),
|
||||
'cfwdall' => array('def_modify' => "on"),
|
||||
'cfwdbusy' => array('def_modify' => "on"),
|
||||
'directrtp' => array('def_modify' => "off"),
|
||||
'dndFeature' => array('def_modify' => "on"),
|
||||
'earlyrtp' => array('def_modify' => "on"),
|
||||
'audio_tos' => array('def_modify' => "0xB8"),
|
||||
'audio_cos' => array('def_modify' => "6"),
|
||||
'video_tos' => array('def_modify' => "0x88"),
|
||||
'video_cos' => array('def_modify' => "5"),
|
||||
'mwilamp' => array('def_modify' => "on"),
|
||||
'mwioncall' => array('def_modify' => "on"),
|
||||
'private' => array('def_modify' => "on"),
|
||||
'privacy' => array('def_modify' => "off"),
|
||||
'nat' => array('def_modify' => "auto"),
|
||||
'softkeyset' => array('def_modify' => "softkeyset")
|
||||
),
|
||||
|
||||
'sccpline' => array(
|
||||
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'incominglimit' =>array('def_modify' => "2"),
|
||||
'transfer' =>array('def_modify' => "on"),
|
||||
'vmnum' =>array('def_modify' => "*97"),
|
||||
'musicclass' =>array('def_modify' => "default"),
|
||||
'echocancel' =>array('def_modify' => "on"),
|
||||
'silencesuppression' =>array('def_modify' => "off"),
|
||||
'id' =>array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' =>"NULL"),
|
||||
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
||||
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' => array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'incominglimit' => array('def_modify' => "2"),
|
||||
'transfer' => array('def_modify' => "on"),
|
||||
'vmnum' => array('def_modify' => "*97"),
|
||||
'musicclass' => array('def_modify' => "default"),
|
||||
'echocancel' => array('def_modify' => "on"),
|
||||
'silencesuppression' => array('def_modify' => "off"),
|
||||
'id' => array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' => "NULL"),
|
||||
'dnd' => array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' => "reject")
|
||||
)
|
||||
);
|
||||
/* Old */
|
||||
$db_config_v5 = array(
|
||||
);
|
||||
/* Old */
|
||||
$db_config_v5 = array(
|
||||
'sccpdevmodel' => array(
|
||||
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL")
|
||||
),
|
||||
'sccpdevice' => array(
|
||||
'pickupexten' => array('rename' => "directed_pickup"),
|
||||
|
@ -89,62 +86,58 @@ $db_config_v5 = array(
|
|||
'hwlang' => array('rename' => "_hwlang"),
|
||||
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
|
||||
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
|
||||
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
'dtmfmode' => array('drop' => "yes"),
|
||||
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
|
||||
'transfer' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'cfwdall' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'cfwdbusy' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'directrtp' =>array('create' => 'VARCHAR(3) DEFAULT "off"','modify' => "VARCHAR(3)",'def_modify' => "off"),
|
||||
'dndFeature' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'earlyrtp' =>array('create' => 'VARCHAR(10) DEFAULT "progress"','modify' => "VARCHAR(10)",'def_modify' => "progress"),
|
||||
'audio_tos' =>array('def_modify' => "0xB8"),
|
||||
'audio_cos' =>array('def_modify' => "6"),
|
||||
'video_tos' =>array('def_modify' => "0x88"),
|
||||
'video_cos' =>array('def_modify' => "5"),
|
||||
'trustphoneip'=>array('drop' => "yes"),
|
||||
|
||||
'mwilamp' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'mwioncall' =>array('create' => 'VARCHAR(5) DEFAULT "off"','modify' => "VARCHAR(5)",'def_modify' => "off"),
|
||||
'private' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
|
||||
'privacy' =>array('create' => 'VARCHAR(100) DEFAULT "full"','modify' => "VARCHAR(5)",'def_modify' => "full"),
|
||||
'nat' =>array('create' => 'VARCHAR(7) DEFAULT "auto"','modify' => "VARCHAR(7)",'def_modify' => "auto"),
|
||||
'softkeyset' =>array('def_modify' => "softkeyset")
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'transfer' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'cfwdall' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'cfwdbusy' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'directrtp' => array('create' => 'VARCHAR(3) DEFAULT "off"', 'modify' => "VARCHAR(3)", 'def_modify' => "off"),
|
||||
'dndFeature' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'earlyrtp' => array('create' => 'VARCHAR(10) DEFAULT "progress"', 'modify' => "VARCHAR(10)", 'def_modify' => "progress"),
|
||||
'audio_tos' => array('def_modify' => "0xB8"),
|
||||
'audio_cos' => array('def_modify' => "6"),
|
||||
'video_tos' => array('def_modify' => "0x88"),
|
||||
'video_cos' => array('def_modify' => "5"),
|
||||
'trustphoneip' => array('drop' => "yes"),
|
||||
'mwilamp' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'mwioncall' => array('create' => 'VARCHAR(5) DEFAULT "off"', 'modify' => "VARCHAR(5)", 'def_modify' => "off"),
|
||||
'private' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
|
||||
'privacy' => array('create' => 'VARCHAR(100) DEFAULT "full"', 'modify' => "VARCHAR(5)", 'def_modify' => "full"),
|
||||
'nat' => array('create' => 'VARCHAR(7) DEFAULT "auto"', 'modify' => "VARCHAR(7)", 'def_modify' => "auto"),
|
||||
'softkeyset' => array('def_modify' => "softkeyset")
|
||||
),
|
||||
'sccpline' => array(
|
||||
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' => array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'rtptos' => array('drop' => "yes"),
|
||||
'audio_tos' => array('drop' => "yes"),
|
||||
'audio_cos' => array('drop' => "yes"),
|
||||
'video_tos' => array('drop' => "yes"),
|
||||
'video_cos' => array('drop' => "yes"),
|
||||
'incominglimit' =>array('def_modify' => "2"),
|
||||
'transfer' =>array('def_modify' => "on"),
|
||||
'vmnum' =>array('def_modify' => "*97"),
|
||||
'musicclass' =>array('def_modify' => "default"),
|
||||
'echocancel' =>array('def_modify' => "on"),
|
||||
'silencesuppression' =>array('def_modify' => "off"),
|
||||
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
||||
'incominglimit' => array('def_modify' => "2"),
|
||||
'transfer' => array('def_modify' => "on"),
|
||||
'vmnum' => array('def_modify' => "*97"),
|
||||
'musicclass' => array('def_modify' => "default"),
|
||||
'echocancel' => array('def_modify' => "on"),
|
||||
'silencesuppression' => array('def_modify' => "off"),
|
||||
'dnd' => array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' => "reject")
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
$db_config_v3 = array(
|
||||
$db_config_v3 = array(
|
||||
'sccpdevmodel' => array(
|
||||
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL")
|
||||
),
|
||||
'sccpdevice' => array(
|
||||
'pickupexten' => array('rename' => "directed_pickup"),
|
||||
|
@ -156,67 +149,60 @@ $db_config_v3 = array(
|
|||
'hwlang' => array('rename' => "_hwlang"),
|
||||
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
|
||||
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
|
||||
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
'dtmfmode' => array('drop' => "yes"),
|
||||
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
|
||||
|
||||
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'cfwdall' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'cfwdbusy' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'directrtp' =>array('create' => "enum('on','off') NULL default NULL",'modify' => "enum('on','off')"),
|
||||
'dndFeature' =>array('create' => "enum('on','off') NULL default NULL",'modify' => "enum('on','off')"),
|
||||
'earlyrtp' =>array('create' => "ENUM('immediate','offHook','dialing','ringout','progress','none') NULL default NULL",'modify' => "ENUM('immediate','offHook','dialing','ringout','progress','none')"),
|
||||
'audio_tos'=>array('def_modify' => "0xB8"),
|
||||
'audio_cos'=>array('def_modify' => "6"),
|
||||
'video_tos'=>array('def_modify' => "0x88"),
|
||||
'video_cos'=>array('def_modify' => "5"),
|
||||
'trustphoneip'=>array('drop' => "yes"),
|
||||
|
||||
'mwilamp' =>array('create' => "enum('on','off','wink','flash','blink') NULL default 'on'" ,'modify' => "enum('on','off','wink','flash','blink')"),
|
||||
'mwioncall' =>array('create' => "enum('on','off') NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'private' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"), // Что-то лишенне
|
||||
'privacy' =>array('create' => "enum('full','on','off') NOT NULL default 'full'",'modify' => "enum('full','on','off')"), // Что-то лишенне
|
||||
'nat' =>array('create' => "enum('on','off','auto') NULL default NULL",'modify' => "enum('on','off','auto')"),
|
||||
'conf_allow' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'conf_play_part_announce' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'conf_mute_on_entry' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
|
||||
'conf_show_conflist' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
|
||||
'type' =>array('create' => 'VARCHAR(15) NULL DEFAULT NULL','modify' => "VARCHAR(15)"),
|
||||
'imageversion' =>array('create' => 'VARCHAR(31) NULL DEFAULT NULL','modify' => "VARCHAR(31)"),
|
||||
|
||||
'softkeyset' =>array('def_modify' => "softkeyset")
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
|
||||
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
|
||||
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'cfwdall' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'cfwdbusy' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'directrtp' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
|
||||
'dndFeature' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
|
||||
'earlyrtp' => array('create' => "ENUM('immediate','offHook','dialing','ringout','progress','none') NULL default NULL", 'modify' => "ENUM('immediate','offHook','dialing','ringout','progress','none')"),
|
||||
'audio_tos' => array('def_modify' => "0xB8"),
|
||||
'audio_cos' => array('def_modify' => "6"),
|
||||
'video_tos' => array('def_modify' => "0x88"),
|
||||
'video_cos' => array('def_modify' => "5"),
|
||||
'trustphoneip' => array('drop' => "yes"),
|
||||
'mwilamp' => array('create' => "enum('on','off','wink','flash','blink') NULL default 'on'", 'modify' => "enum('on','off','wink','flash','blink')"),
|
||||
'mwioncall' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'private' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), // Что-то лишенне
|
||||
'privacy' => array('create' => "enum('full','on','off') NOT NULL default 'full'", 'modify' => "enum('full','on','off')"), // Что-то лишенне
|
||||
'nat' => array('create' => "enum('on','off','auto') NULL default NULL", 'modify' => "enum('on','off','auto')"),
|
||||
'conf_allow' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'conf_play_part_announce' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'conf_mute_on_entry' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'conf_show_conflist' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'type' => array('create' => 'VARCHAR(15) NULL DEFAULT NULL', 'modify' => "VARCHAR(15)"),
|
||||
'imageversion' => array('create' => 'VARCHAR(31) NULL DEFAULT NULL', 'modify' => "VARCHAR(31)"),
|
||||
'softkeyset' => array('def_modify' => "softkeyset")
|
||||
),
|
||||
'sccpline' => array(
|
||||
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' => array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
|
||||
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
|
||||
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
|
||||
'rtptos' => array('drop' => "yes"),
|
||||
'audio_tos' => array('drop' => "yes"),
|
||||
'audio_cos' => array('drop' => "yes"),
|
||||
'video_tos' => array('drop' => "yes"),
|
||||
'video_cos' => array('drop' => "yes"),
|
||||
'incominglimit' =>array('create' => "INT(11) DEFAULT '6'", 'modify' =>'INT(11)', 'def_modify' => "6"),
|
||||
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
|
||||
'vmnum' =>array('def_modify' => "*97"),
|
||||
'musicclass' =>array('def_modify' => "default"),
|
||||
'id' =>array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)",'index' =>'id'),
|
||||
'incominglimit' => array('create' => "INT(11) DEFAULT '6'", 'modify' => 'INT(11)', 'def_modify' => "6"),
|
||||
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
|
||||
'vmnum' => array('def_modify' => "*97"),
|
||||
'musicclass' => array('def_modify' => "default"),
|
||||
'id' => array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)", 'index' => 'id'),
|
||||
// 'id' =>array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' =>"NULL"),
|
||||
|
||||
'echocancel' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
|
||||
'silencesuppression' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
|
||||
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' =>"reject")
|
||||
'echocancel' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'silencesuppression' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' => "reject")
|
||||
)
|
||||
);
|
||||
);
|
||||
if ($sccp_compatible >= 430) {
|
||||
return $db_config_v3;
|
||||
} else {
|
||||
|
@ -242,16 +228,17 @@ function CheckSCCPManagerDBTables($table_req) {
|
|||
//print_r("none, creating table :". $value);
|
||||
outn(_("Can't find table: " . $value));
|
||||
outn(_("Please goto the chan-sccp/conf directory and create the DB schema manually (See wiki)"));
|
||||
die_freepbx("!!!! Installation error: Can not find required ".$value." table !!!!!!\n");
|
||||
die_freepbx("!!!! Installation error: Can not find required " . $value . " table !!!!!!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* notused */
|
||||
|
||||
function CheckPermissions() {
|
||||
outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
|
||||
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)){
|
||||
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)) {
|
||||
die_freepbx('Please (re-)check permissions by running "amportal chown. Installation Failed"');
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +263,7 @@ function CheckAsteriskVersion() {
|
|||
}
|
||||
|
||||
function CheckChanSCCPCompatible() {
|
||||
global $srvinterface,$astman;
|
||||
global $srvinterface, $astman;
|
||||
if (!$astman) {
|
||||
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
||||
}
|
||||
|
@ -285,7 +272,6 @@ function CheckChanSCCPCompatible() {
|
|||
return $sccp_compatible;
|
||||
}
|
||||
|
||||
|
||||
function InstallDB_sccpsettings() {
|
||||
global $db;
|
||||
outn("<li>" . _("Creating sccpsettings table...") . "</li>");
|
||||
|
@ -334,12 +320,12 @@ function InstallDB_updateSchema($db_config) {
|
|||
outn("<li>" . _("Modify Database schema") . "</li>");
|
||||
foreach ($db_config as $tabl_name => &$tab_modify) {
|
||||
// 0 - name 1-type 4- default
|
||||
$sql = "DESCRIBE ".$tabl_name."";
|
||||
$db_result= $db->getAll($sql);
|
||||
$sql = "DESCRIBE " . $tabl_name . "";
|
||||
$db_result = $db->getAll($sql);
|
||||
if (DB::IsError($db_result)) {
|
||||
die_freepbx("Can not add get informations from ".$tabl_name." table\n");
|
||||
die_freepbx("Can not add get informations from " . $tabl_name . " table\n");
|
||||
}
|
||||
foreach ($db_result as $tabl_data){
|
||||
foreach ($db_result as $tabl_data) {
|
||||
$fld_id = $tabl_data[0];
|
||||
if (!empty($tab_modify[$fld_id])) {
|
||||
$db_config[$tabl_name][$fld_id]['status'] = 'yes';
|
||||
|
@ -349,7 +335,7 @@ function InstallDB_updateSchema($db_config) {
|
|||
}
|
||||
}
|
||||
if (!empty($tab_modify[$fld_id]['modify'])) {
|
||||
if ( strtoupper ($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) {
|
||||
if (strtoupper($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) {
|
||||
$db_config[$tabl_name][$fld_id]['mod_stat'] = 'no';
|
||||
}
|
||||
}
|
||||
|
@ -360,32 +346,32 @@ function InstallDB_updateSchema($db_config) {
|
|||
}
|
||||
}
|
||||
}
|
||||
$sql_create ='';
|
||||
$sql_modify ='';
|
||||
$sql_update ='';
|
||||
$sql_create = '';
|
||||
$sql_modify = '';
|
||||
$sql_update = '';
|
||||
|
||||
foreach ($tab_modify as $row_fld => $row_data){
|
||||
foreach ($tab_modify as $row_fld => $row_data) {
|
||||
if (empty($row_data['status'])) {
|
||||
if (!empty($row_data['create'])) {
|
||||
$sql_create .='ADD COLUMN `'.$row_fld.'` '. $row_data['create'].', ';
|
||||
$sql_create .= 'ADD COLUMN `' . $row_fld . '` ' . $row_data['create'] . ', ';
|
||||
$count_modify ++;
|
||||
}
|
||||
} else {
|
||||
if (!empty($row_data['rename'])) {
|
||||
$sql_modify .= 'CHANGE COLUMN `'.$row_fld.'` `'. $row_data['rename'].'` '.$row_data['create'].', ';
|
||||
$sql_modify .= 'CHANGE COLUMN `' . $row_fld . '` `' . $row_data['rename'] . '` ' . $row_data['create'] . ', ';
|
||||
$count_modify ++;
|
||||
}
|
||||
if (!empty($row_data['modify'])) {
|
||||
if (empty($row_data['mod_stat'])) {
|
||||
if (!empty($row_data['create'])) {
|
||||
// $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['create'].", ";
|
||||
$sql_modify .= "MODIFY COLUMN `".$row_fld."` ".$row_data['create'].", ";
|
||||
$sql_modify .= "MODIFY COLUMN `" . $row_fld . "` " . $row_data['create'] . ", ";
|
||||
} else {
|
||||
// $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', ";
|
||||
$sql_modify .= "MODIFY COLUMN `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', ";
|
||||
$sql_modify .= "MODIFY COLUMN `" . $row_fld . "` " . $row_data['modify'] . " DEFAULT '" . $row_data['def_modify'] . "', ";
|
||||
}
|
||||
if (strpos($row_data['modify'],'enum') !== false ) {
|
||||
$sql_update .= "UPDATE ".$tabl_name." set `".$row_fld."`=case when lower(`".$row_fld."`) in ('yes','true','1') then 'on' when lower(`".$row_fld."`) in ('no', 'false', '0') then 'off' else `".$row_fld."` end; ";
|
||||
if (strpos($row_data['modify'], 'enum') !== false) {
|
||||
$sql_update .= "UPDATE " . $tabl_name . " set `" . $row_fld . "`=case when lower(`" . $row_fld . "`) in ('yes','true','1') then 'on' when lower(`" . $row_fld . "`) in ('no', 'false', '0') then 'off' else `" . $row_fld . "` end; ";
|
||||
}
|
||||
$row_data['def_mod_stat'] = 'no';
|
||||
$count_modify ++;
|
||||
|
@ -393,24 +379,23 @@ function InstallDB_updateSchema($db_config) {
|
|||
}
|
||||
if (!empty($row_data['def_modify'])) {
|
||||
if (empty($row_data['def_mod_stat'])) {
|
||||
$sql_modify .= "ALTER COLUMN `".$row_fld."` SET DEFAULT '".$row_data['def_modify']."', ";
|
||||
$sql_modify .= "ALTER COLUMN `" . $row_fld . "` SET DEFAULT '" . $row_data['def_modify'] . "', ";
|
||||
$count_modify ++;
|
||||
}
|
||||
}
|
||||
if (!empty($row_data['drop'])) {
|
||||
$sql_create .='DROP COLUMN `'.$row_fld.'`, ';
|
||||
$sql_create .= 'DROP COLUMN `' . $row_fld . '`, ';
|
||||
$count_modify ++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!empty($sql_update)) {
|
||||
$sql_update = 'BEGIN; '.$sql_update.' COMMIT;';
|
||||
$sql_update = 'BEGIN; ' . $sql_update . ' COMMIT;';
|
||||
sql($sql_update);
|
||||
$affected_rows = $db->affectedRows();
|
||||
// $check = $db->query($sql_update);
|
||||
// $db->closeCursor();
|
||||
outn("<li>" . _("Update table row :").$affected_rows. "</li>");
|
||||
outn("<li>" . _("Update table row :") . $affected_rows . "</li>");
|
||||
// if (db::IsError($check)) {
|
||||
// die_freepbx("Can not update ".$tabl_name." table sql: ".$sql_update."n");
|
||||
// die_freepbx("Can not update ".$tabl_name." table\n");
|
||||
|
@ -418,26 +403,26 @@ function InstallDB_updateSchema($db_config) {
|
|||
}
|
||||
|
||||
if (!empty($sql_create)) {
|
||||
outn("<li>" . _("Create New table"). "</li>");
|
||||
$sql_create = "ALTER TABLE `".$tabl_name."` ". substr($sql_create,0,-2);
|
||||
outn("<li>" . _("Create New table") . "</li>");
|
||||
$sql_create = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_create, 0, -2);
|
||||
$check = $db->query($sql_create);
|
||||
if (db::IsError($check)) {
|
||||
die_freepbx("Can not create ".$tabl_name." table sql: ".$sql_create."n");
|
||||
die_freepbx("Can not create " . $tabl_name . " table sql: " . $sql_create . "n");
|
||||
}
|
||||
}
|
||||
if (!empty($sql_modify)) {
|
||||
outn("<li>" . _("Modify table"). "</li>");
|
||||
outn("<li>" . _("Modify table") . "</li>");
|
||||
|
||||
$sql_modify = "ALTER TABLE `".$tabl_name."` ". substr($sql_modify,0,-2).';';
|
||||
$sql_modify = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_modify, 0, -2) . ';';
|
||||
$check = $db->query($sql_modify);
|
||||
if (db::IsError($check)) {
|
||||
out("<li>" . print_r($check,1). "</li>");
|
||||
die("Can not modify ".$tabl_name." table sql: ".$sql_modify."n");
|
||||
die_freepbx("Can not modify ".$tabl_name." table sql: ".$sql_modify."n");
|
||||
out("<li>" . print_r($check, 1) . "</li>");
|
||||
die("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
||||
die_freepbx("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
|
||||
}
|
||||
}
|
||||
}
|
||||
outn("<li>" . _("Total modify count :") .$count_modify. "</li>");
|
||||
outn("<li>" . _("Total modify count :") . $count_modify . "</li>");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -498,7 +483,7 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
|
|||
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
|
||||
$sql = "";
|
||||
if ($sccp_compatible < 431) {
|
||||
$sql= "
|
||||
$sql = "
|
||||
CREATE OR REPLACE
|
||||
ALGORITHM = MERGE
|
||||
VIEW sccpdeviceconfig AS
|
||||
|
@ -545,7 +530,7 @@ function Setup_RealTime() {
|
|||
$cnf_int = \FreePBX::Config();
|
||||
$cnf_wr = \FreePBX::WriteConfig();
|
||||
$cnf_read = \FreePBX::LoadConfig();
|
||||
$def_config =array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig','sccpline' => ' mysql,sccp,sccpline');
|
||||
$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');
|
||||
|
@ -556,7 +541,7 @@ function Setup_RealTime() {
|
|||
$res_conf_old = '';
|
||||
$res_conf = '';
|
||||
$ext_conf = '';
|
||||
if (file_exists($dir. '/extconfig.conf')) {
|
||||
if (file_exists($dir . '/extconfig.conf')) {
|
||||
$ext_conf = $cnf_read->getConfig('extconfig.conf');
|
||||
}
|
||||
|
||||
|
@ -564,44 +549,43 @@ function Setup_RealTime() {
|
|||
$tmp = array();
|
||||
if (!empty($ext_conf['settings']['sccpdevice'])) {
|
||||
$tmp = explode(',', $ext_conf['settings']['sccpdevice']);
|
||||
$def_config['sccpdevice']=$ext_conf['settings']['sccpdevice'];
|
||||
$def_config['sccpdevice'] = $ext_conf['settings']['sccpdevice'];
|
||||
}
|
||||
if (!empty($ext_conf['settings']['sccpline'])) {
|
||||
if (empty($tmp)){
|
||||
if (empty($tmp)) {
|
||||
$tmp = explode(',', $ext_conf['settings']['sccpline']);
|
||||
$tmp[2] ='sccpdevice';
|
||||
$def_config['sccpdevice']= implode(',', $tmp);
|
||||
$tmp[2] = 'sccpdevice';
|
||||
$def_config['sccpdevice'] = implode(',', $tmp);
|
||||
}
|
||||
$def_config['sccpline']=$ext_conf['settings']['sccpline'];
|
||||
$def_config['sccpline'] = $ext_conf['settings']['sccpline'];
|
||||
}
|
||||
if (!empty($tmp)){
|
||||
if (!empty($tmp)) {
|
||||
$def_bd_sec = $tmp[1];
|
||||
}
|
||||
}
|
||||
$ext_conf['settings']['sccpdevice'] = $def_config['sccpdevice'];
|
||||
$ext_conf['settings']['sccpline'] = $def_config['sccpline'];
|
||||
|
||||
if (file_exists($dir. '/res_mysql.conf')) {
|
||||
if (file_exists($dir . '/res_mysql.conf')) {
|
||||
$res_conf = $cnf_read->getConfig('res_mysql.conf');
|
||||
if (empty($res_conf[$def_bd_sec])) {
|
||||
$res_conf[$def_bd_sec] = $def_bd_config;
|
||||
}
|
||||
$cnf_wr -> writeConfig('res_mysql.conf', $res_conf,false);
|
||||
$cnf_wr->writeConfig('res_mysql.conf', $res_conf, false);
|
||||
}
|
||||
if (file_exists($dir. '/res_config_mysql.conf')) {
|
||||
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])) {
|
||||
$res_conf[$def_bd_sec] = $def_bd_config;
|
||||
}
|
||||
$cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false);
|
||||
$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'] = $res_conf[$def_bd_sec]['dbsock'];
|
||||
$cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false);
|
||||
$cnf_wr->writeConfig('res_config_mysql.conf', $res_conf, false);
|
||||
}
|
||||
$cnf_wr -> writeConfig('extconfig.conf', $ext_conf,false);
|
||||
|
||||
$cnf_wr->writeConfig('extconfig.conf', $ext_conf, false);
|
||||
}
|
||||
|
||||
CheckSCCPManagerDBTables($table_req);
|
||||
|
|
Loading…
Reference in a new issue