From f157110e8d42951d74479f37a2b264eba5bedd1d Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Thu, 28 Sep 2017 19:41:15 +0300 Subject: [PATCH] Prerelease 28.09.2017 Change Installer Add function control SCCP Version. --- Sccp_manager.class.php | 3 +- conf/Sccp.class.php | 7 +- conf/Sccp.class.php.v11 | 31 ++++++--- install.php | 137 +++++++++++++++++++-------------------- views/server.setting.php | 48 +------------- 5 files changed, 97 insertions(+), 129 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index fa3dde3..699c24a 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -22,6 +22,7 @@ * - WiFi Config (Bulk Deployment Utility for Cisco 7921, 7925, 7926)????? * - Change internal use Field to _Field (new fiture support in chan_sccp ) * + Change Installer ?? (test ) + * + DND Mode * - suport kvstore ????? * - Shared Line ???? * - bug Fix @@ -1085,8 +1086,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } } - $res = 0; - return $res; } diff --git a/conf/Sccp.class.php b/conf/Sccp.class.php index 052cabb..8d39424 100644 --- a/conf/Sccp.class.php +++ b/conf/Sccp.class.php @@ -191,8 +191,11 @@ class Sccp extends \FreePBX\modules\Core\Driver { $select[] = array('value' => 'reject', 'text' => 'Reject'); $select[] = array('value' => 'silent', 'text' => 'Silent'); $select[] = array('value' => 'UserDefined', 'text' => 'UserDefined'); - $tt = _("Do Not Disturb."); - $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'user', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); + $tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'
'. + _("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'
'. + _("Reject - Usesr can only switch off and on (in reject/busy mode)").'
'. + _("Silent - Usesr can only switch off and on (in silent mode)"); + $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); unset($select); $select[] = array('value' => 'yes', 'text' => 'Yes'); diff --git a/conf/Sccp.class.php.v11 b/conf/Sccp.class.php.v11 index 052cabb..17a342f 100644 --- a/conf/Sccp.class.php.v11 +++ b/conf/Sccp.class.php.v11 @@ -52,11 +52,23 @@ class Sccp extends \FreePBX\modules\Core\Driver { $sql = 'INSERT INTO sccpline (name, id'; $sqlv = 'values ("'.$id.'", "'.$id.'"'; foreach($this->data_fld as $key => $val) { - if (!empty($settings[$val]) ) { - if (!empty($settings[$val]['value'])){ + switch ($key) { + case 'dnd': $sql .= ', '.$key; - $sqlv .= ", '".$settings[$val]['value']."' "; - } + if (!empty($settings[$val]['value'])){ + $sqlv .= ", '".$settings[$val]['value']."' "; + } else { + $sqlv .= ", NULL "; + } + break; + default: + if (!empty($settings[$val]) ) { + if (!empty($settings[$val]['value'])){ + $sql .= ', '.$key; + $sqlv .= ", '".$settings[$val]['value']."' "; + } + } + break; } } $sql .= ") ".$sqlv.");"; @@ -137,7 +149,7 @@ class Sccp extends \FreePBX\modules\Core\Driver { "flag" => $flag++ ), "dnd" => array( - "value" => "UserDefined", + "value" => "", "flag" => $flag++ ), "silencesuppression" => array( @@ -190,9 +202,12 @@ class Sccp extends \FreePBX\modules\Core\Driver { $select[] = array('value' => 'off', 'text' => 'Off'); $select[] = array('value' => 'reject', 'text' => 'Reject'); $select[] = array('value' => 'silent', 'text' => 'Silent'); - $select[] = array('value' => 'UserDefined', 'text' => 'UserDefined'); - $tt = _("Do Not Disturb."); - $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'user', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); + $select[] = array('value' => '', 'text' => 'UserDefined'); + $tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'
'. + _("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'
'. + _("Reject - Usesr can only switch off and on (in reject/busy mode)").'
'. + _("Silent - Usesr can only switch off and on (in silent mode)"); + $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); unset($select); $select[] = array('value' => 'yes', 'text' => 'Yes'); diff --git a/install.php b/install.php index 77c6a09..976bc00 100644 --- a/install.php +++ b/install.php @@ -16,46 +16,45 @@ $db_config_v0 = array('sccpdevmodel' => array('enabled' => array('create' => "IN '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'", 'modyfy' => "VARCHAR(10)", 'def_modyfy'=> 'outofband'), - 'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modyfy' => "VARCHAR(100)"), - 'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modyfy' => "VARCHAR(100)"), - 'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modyfy' => "VARCHAR(255)"), - 'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modyfy' => "VARCHAR(255)"), +// '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_modyfy' => "on"), - 'cfwdall' =>array('def_modyfy' => "on"), - 'cfwdbusy' =>array('def_modyfy' => "on"), - 'directrtp' =>array('def_modyfy' => "off"), - 'dndFeature' =>array('def_modyfy' => "on"), - 'earlyrtp' =>array('def_modyfy' => "on"), - 'audio_tos'=>array('def_modyfy' => "0xB8"), - 'audio_cos'=>array('def_modyfy' => "6"), - 'video_tos'=>array('def_modyfy' => "0x88"), - 'video_cos'=>array('def_modyfy' => "5"), + '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_modyfy' => "on"), - 'mwioncall' =>array('def_modyfy' => "on"), - 'private' =>array('def_modyfy' => "on"), - 'privacy' =>array('def_modyfy' => "off"), - 'nat' =>array('def_modyfy' => "auto"), - 'softkeyset' =>array('def_modyfy' => "softkeyset") + '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`", 'modyfy' => "VARCHAR(100)"), - 'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modyfy' => "VARCHAR(100)"), + '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_modyfy' => "2"), - 'transfer' =>array('def_modyfy' => "on"), - 'vmnum' =>array('def_modyfy' => "*97"), - 'musicclass' =>array('def_modyfy' => "default"), - 'echocancel' =>array('def_modyfy' => "on"), - 'silencesuppression' =>array('def_modyfy' => "off"), - 'dndFeature' =>array('create' => 'VARCHAR( 12 ) DEFAULT "on" AFTER `amaflags`', 'modyfy' => "VARCHAR(12)", 'def_modyfy' =>"on"), - 'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modyfy' => "VARCHAR(12)", 'def_modyfy' =>"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") ) ); @@ -75,36 +74,35 @@ $db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "IN '_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'", 'modyfy' => "VARCHAR(10)", 'def_modyfy'=> 'outofband'), +// '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','modyfy' => "VARCHAR(100)"), - 'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modyfy' => "VARCHAR(100)"), - 'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modyfy' => "VARCHAR(255)"), - 'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modyfy' => "VARCHAR(255)"), + '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_modyfy' => "on"), - 'cfwdall' =>array('def_modyfy' => "on"), - 'cfwdbusy' =>array('def_modyfy' => "on"), - 'directrtp' =>array('def_modyfy' => "off"), - 'dndFeature' =>array('def_modyfy' => "on"), - 'earlyrtp' =>array('def_modyfy' => "on"), - 'audio_tos'=>array('def_modyfy' => "0xB8"), - 'audio_cos'=>array('def_modyfy' => "6"), - 'video_tos'=>array('def_modyfy' => "0x88"), - 'video_cos'=>array('def_modyfy' => "5"), + '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"), 'trustphoneip'=>array('drop' => "yes"), - 'mwilamp' =>array('def_modyfy' => "on"), - 'mwioncall' =>array('def_modyfy' => "on"), - 'private' =>array('def_modyfy' => "on"), - 'privacy' =>array('def_modyfy' => "off"), - 'nat' =>array('def_modyfy' => "auto"), - 'softkeyset' =>array('def_modyfy' => "softkeyset") + '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`", 'modyfy' => "VARCHAR(100)"), - 'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modyfy' => "VARCHAR(100)"), + '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`"), @@ -115,14 +113,13 @@ $db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "IN 'audio_cos' => array('drop' => "yes"), 'video_tos' => array('drop' => "yes"), 'video_cos' => array('drop' => "yes"), - 'incominglimit' =>array('def_modyfy' => "2"), - 'transfer' =>array('def_modyfy' => "on"), - 'vmnum' =>array('def_modyfy' => "*97"), - 'musicclass' =>array('def_modyfy' => "default"), - 'echocancel' =>array('def_modyfy' => "on"), - 'silencesuppression' =>array('def_modyfy' => "off"), - 'dndFeature' =>array('create' => 'VARCHAR( 12 ) DEFAULT "on" AFTER `amaflags`', 'modyfy' => "VARCHAR(12)", 'def_modyfy' =>"on"), - 'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modyfy' => "VARCHAR(12)", 'def_modyfy' =>"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") ) ); @@ -239,11 +236,11 @@ if (!empty($version)) { $fld_id = $tabl_data[0]; if (!empty($tab_modify[$fld_id])) { $db_config[$tabl_name][$fld_id]['status'] = 'yes'; - if (!empty($tab_modify[$fld_id]['def_modyfy'])) { - if (strtoupper($tab_modify[$fld_id]['def_modyfy']) == strtoupper($tabl_data[4])) { + if (!empty($tab_modify[$fld_id]['def_modify'])) { + if (strtoupper($tab_modify[$fld_id]['def_modify']) == strtoupper($tabl_data[4])) { $db_config[$tabl_name][$fld_id]['def_mod_stat'] = 'no'; } - if ( strtoupper ($tab_modify[$fld_id]['modyfy']) == strtoupper($tabl_data[1])) { + if ( strtoupper ($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) { $db_config[$tabl_name][$fld_id]['mod_stat'] = 'no'; } } @@ -267,19 +264,19 @@ if (!empty($version)) { $sql_modify .= 'CHANGE COLUMN `'.$row_fld.'` `'. $row_data['rename'].'` '.$row_data['create'].', '; } - if (!empty($row_data['modyfy'])) { + 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'].", "; } else { - $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['modyfy']." DEFAULT '".$row_data['def_modyfy']."', "; + $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', "; } $row_data['def_mod_stat'] = 'no'; } } - if (!empty($row_data['def_modyfy'])) { + if (!empty($row_data['def_modify'])) { if (empty($row_data['def_mod_stat'])) { - $sql_modify .= "ALTER COLUMN `".$row_fld."` SET DEFAULT '".$row_data['def_modyfy']."', "; + $sql_modify .= "ALTER COLUMN `".$row_fld."` SET DEFAULT '".$row_data['def_modify']."', "; } } if (!empty($row_data['drop'])) { diff --git a/views/server.setting.php b/views/server.setting.php index 4267192..f11edb2 100644 --- a/views/server.setting.php +++ b/views/server.setting.php @@ -5,65 +5,19 @@ * and open the template in the editor. */ // vim: set ai ts=4 sw=4 ft=phtml: - -// $var_hw_config = $this->get_db_SccpTableData("get_sccpdevice_byid", array('id' => 'SEPB8BEBF224790')); - global $astman; - $ast_out = $astman->Command("sccp show version"); - if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) { - $ast_out = explode(' ', substr($matches[0],9,-1)); - $res = 0; - if ($ast_out[0] >= '4.3.0'){ - $res = 1; - } - if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){ - $res = 10; - if (!empty($ast_out[3]) && $ast_out[3] >= '702487a'){ - $res += 1; - } - } else { - $res = 0; - } - } - -print_r(base_convert('702487a', 16, 10)); -print_r('
'); -print_r($version); -print_r('
'); +// print_r($this->sccpvalues['sccp_comatable']); ?>
sccp_conf_init); -// print_r(@parse_ini_file($this->sccppath["sccp_conf"], true)); -// print_r(\FreePBX::LoadConfig()->getConfig('sccp.conf')); -// print_r($this->FreePBX->LoadConfig('sccp.conf')); -// $this->sccp_create_tftp_XML(); -// print_r($this->get_db_SccpTableData('SccpDevice')); -// print_r('
'); -// print_r($this->sccp_get_active_devise()); -// print_r(music_list()); -// print_r($this->sccppath["sccp_conf"]); -// print_r($this-> getMyConfig('softkeyset')); -/* - $dev_tech ="sccp"; - $drivers = FreePBX::Core()->getAllDrivers(); - if(isset($drivers[$dev_tech])) { - $devopts = $drivers[$dev_tech]->getDevice('1234'); - } else { - $devopts = array(); - } - print_r($devopts); -*/ echo $this->ShowGroup('sccp_general',1); echo $this->ShowGroup('sccp_net',1); echo $this->ShowGroup('sccp_lang',1); echo $this->ShowGroup('sccp_qos_config',1); echo $this->ShowGroup('sccp_extpath_config',1); -// $this->sccp_db_save_setting(); -// $this->sccp_create_sccp_init(); ?>