From c077885c9be20ca00045e43a685af929bda5c070 Mon Sep 17 00:00:00 2001 From: Diederik de Groot Date: Fri, 3 Nov 2017 13:20:17 +0100 Subject: [PATCH] - 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 --- README.md | 33 +++++---- Sccp_manager.class.php | 91 +++++++++++++------------ Sccp_manager.inc/dbinterface.class.php | 20 +++--- Sccp_manager.inc/extconfigs.class.php | 8 +-- Sccp_manager.inc/srvinterface.class.php | 34 +++++---- Sccp_manager.inc/xmlinterface.class.php | 3 +- assets/js/sccp_manager.js | 2 +- conf/Sccp.class.php | 26 ++++--- i18n/sccp_manager.pot | 4 +- install.php | 9 ++- uninstall.php | 5 ++ views/advserver.dialtemplate.php | 8 +-- views/form.buttons.php | 22 +++--- views/form.dptemplate.php | 8 +-- 14 files changed, 148 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index 1b98001..ac69537 100644 --- a/README.md +++ b/README.md @@ -48,22 +48,22 @@ Make sure you have the following installed on your system: ### Requirements - Chan_SCCP module 4.3.0 (or later) channel driver for Asterisk: [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide) - - configure flags ./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate - - Creating mysql DB from sorce (mysql -u root asterisk < mysql-v5_enum.sql) - + - expected configure flags: + ```./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate``` + - Creating mysql DB from sorce + ```mysql -u root asterisk < mysql-v5_enum.sql``` - TFTP Server running under (recomended) /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service) - You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp" - sample: copy /usr/src/chan-sccp/conf/tftp/*.xml* /tftpboot/templates/ + ```cp /usr/src/chan-sccp/conf/tftp/\*.xml\* /tftpboot/templates/``` -- cofigure DHCP server [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service) - -### Setting up a FreePBX system -[See our WIKI](http://wiki.freepbx.org/display/FOP/Install+FreePBX) - -### Setting up a Sccp -[See our WIKI] https://github.com/chan-sccp/chan-sccp/wiki/How-to-setup-the-chan_sccp-Module +- configure DHCP server [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service) +### Setup +- [Setting up a FreePBX system](http://wiki.freepbx.org/display/FOP/Install+FreePBX) +- [Setting up Chan-Sccp](https://github.com/chan-sccp/chan-sccp/wiki/How-to-setup-the-chan_sccp-Module) +- The sccp_manager module will automatically setup and configure asterisk realtime database for chan-sccp. + For more information about realtime [See chan-sccp wiki](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration). ### Module installation @@ -77,10 +77,9 @@ Make sure you have the following installed on your system: 8. Close Status window. 9. Apply Config to FreePBX. -### IMPORTANT NOTE: -- This system assumes you are using the SCCP Real-time Database. If you are -not yet using the RTD, you will need to set it up for this module to be -effective. -- For the correct operation of the cisco-phones you will be tempted cisco phone firmware (recomended v 8.1 or later) -- You can also use cisco language profiles to personalize sysnem and any cisco phones. +### IMPORTANT NOTES: +- This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database, +you will have to set it up for this module to work ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)). +- For the cisco phones to work correctly, they should be provisioned with the latest firmware (v8.1 or higher) +- You can use cisco language profiles (localization) to switch the phones to your locale. diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index b5cd0f2..72a1370 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -231,22 +231,27 @@ 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) { } @@ -508,7 +513,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { public function ajaxRequest($req, &$setting) { switch ($req) { - case 'savesettings': + case 'savesettings': /* !TODO!: mixing snake case and camel case, chooose one :-) */ case "save_hardware": case "save_dp_template": case "delete_hardware": @@ -517,7 +522,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { case "getDeviceModel": case "getUserGrid": case "getSoftKey": - case "getDialTemplete": + case "getDialTemplate": case "create_hw_tftp": case "reset_dev": case 'reset_token': @@ -549,7 +554,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->sccp_db_save_setting(); // $this->sccp_create_sccp_init(); - $res = $this->srvinterface->sccp_core_comands(array('cmd' => 'sccp_reload')); + $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'sccp_reload')); $msg = 'Config Saved: ' . $res['Response'] . '. Info :' . $res['data']; // needreload(); return array('status' => true, 'message' => $msg, 'reload' => true); @@ -562,7 +567,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $this->save_hw_phone($request); break; - case "save_dp_template": + case "save_dp_template": /* !TODO!: dialplan templates should be removed (only required for very old devices (like ATA) */ $res = $this->save_DialPlant($request); if (empty($res)) { return array('status' => true, 'search' => '?display=sccp_adv', 'hash' => 'sccpdialplan'); @@ -574,7 +579,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 Templet is Delete ! ', '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)); } @@ -587,8 +592,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->dbinterface->sccp_save_db('sccpdevice', array('name' => $idv), 'delete', "name"); $this->dbinterface->sccp_save_db("sccpbuttons", array(), 'delete', '', $idv); $this->sccp_delete_device_XML($idv); // Концы в вводу !! -// $this->sccp_core_comands(array('cmd' => 'reload_phone', 'name' => $idv)); - $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_phone', 'name' => $idv)); +// $this->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $idv)); + $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $idv)); } } return array('status' => true, 'table_reload' => true, 'message' => 'HW is Delete ! '); @@ -602,7 +607,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { foreach ($models as $data) { $ver_id = $this->sccp_create_device_XML($data['name']); }; - return array('status' => true, 'message' => 'Create new CNF files Ver :' . $ver_id); + /* !TODO!: Do these returned message strings work with i18n ? */ + return array('status' => true, 'message' => 'Create new config files (version:' . $ver_id . ')')); break; case 'reset_token': @@ -613,23 +619,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $msg = strpos($idv, 'SEP-'); if (!(strpos($idv, 'SEP') === false)) { if ($cmd_id == 'reset_token') { - $res = $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_token', 'name' => $idv)); + $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $idv)); } else { - $res = $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_phone', 'name' => $idv)); + $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $idv)); } -// $msg = print_r($this->sccp_core_comands(array('cmd' => 'reset_phone', 'name' => $idv)), 1); +// $msg = print_r($this->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $idv)), 1); $msg = $res['Response'] . ' ' . $res['data']; } if ($idv == 'all') { - $dev_list = $this->srvinterface->sccp_get_active_devise(); + $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 ') ) { - $res = $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_token', 'name' => $key)); + $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $key)); $msg .= 'Send Token reset to :'. $key .' '; } } else { - $res = $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_phone', 'name' => $key)); + $res = $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $key)); $msg .= $res['Response'] . ' ' . $res['data'] . ' '; } // $msg .= $res['Response'] . ' ' . $res['data'] . ' '; @@ -637,7 +643,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } } - return array('status' => true, 'message' => 'Reset comand send ' . $msg, 'reload' => true); + return array('status' => true, 'message' => 'Reset command send ' . $msg, 'reload' => true); // } break; case 'model_add': @@ -703,7 +709,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $id_name = $request['softkey']; unset($this->sccp_conf_init[$id_name]); $this->sccp_create_sccp_init(); - $msg = print_r($this->srvinterface->sccp_core_comands(array('cmd' => 'sccp_reload')), 1); + $msg = print_r($this->srvinterface->sccp_core_commands(array('cmd' => 'sccp_reload')), 1); return array('status' => true, 'table_reload' => true); } break; @@ -717,7 +723,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } $this->sccp_create_sccp_init(); - $msg = print_r($this->srvinterface->sccp_core_comands(array('cmd' => 'sccp_reload')), 1); + $msg = print_r($this->srvinterface->sccp_core_commands(array('cmd' => 'sccp_reload')), 1); return array('status' => true, 'table_reload' => true); // return $this->sccp_conf_init[$id_name]; @@ -754,11 +760,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { break; case "getPhoneGrid": $result = $this->dbinterface->get_db_SccpTableData('SccpDevice'); - $staus = $this->srvinterface->sccp_get_active_devise(); + $staus = $this->srvinterface->sccp_get_active_device(); if (empty($result)) { $result = array(); } else { -// $staus = $this->sccp_get_active_devise(); +// $staus = $this->sccp_get_active_device(); foreach ($result as &$dev_id) { $id_name = $dev_id['name']; if (!empty($staus[$id_name])) { @@ -769,7 +775,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $staus[$id_name]['news'] ='N'; } else { $dev_id['description'] = '- -'; - $dev_id['status'] = 'no connect'; + $dev_id['status'] = 'not connected'; $dev_id['address'] = '- -'; } } @@ -798,8 +804,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $result; break; - case "getDialTemplete": - $result = $this->get_DP_list(); + case "getDialTemplate": + $result = $this->get_DP_list(); /* !TODO!: please use DialPlan instead of DP */ if (empty($result)) { $result = array(); } @@ -892,9 +898,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { // Save / Updade Base $this->dbinterface->sccp_save_db("sccpdevice", $save_settings, 'replace'); -// Get Model Butons info +// Get Model Buttons info $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); - $max_btn = ((!empty($get_settings['butonscount']) ? $get_settings['butonscount'] : 100)); + $max_btn = ((!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 100)); $last_btn = $max_btn; for ($it = $max_btn; $it >=0; $it--) { if (!empty($get_settings['button' . $it . '_type'])) { @@ -998,9 +1004,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->sccp_create_device_XML($name_dev); if ($hw_id == 'new') { - $this->srvinterface->sccp_core_comands(array('cmd' => 'reset_phone', 'name' => $name_dev)); + $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $name_dev)); } else { - $this->srvinterface->sccp_core_comands(array('cmd' => 'reload_phone', 'name' => $name_dev)); + $this->srvinterface->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $name_dev)); } return $save_settings; @@ -1120,7 +1126,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $file_context = $keysetData['name']; if ($file_context != 'default') { $confDir = $amp_conf["ASTETCDIR"]; - if (strlen($confDir) < 1) { + if (strlen($confDir) < 1) { /* !TODO!: Can this actually happen, or does it mean amp_conf array is empty ? */ $confDir = "/etc/asterisk"; } $inputfile = "$confDir/sccp.conf"; @@ -1398,9 +1404,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } /* - * Chek file enverovments ( xml) + * 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) { @@ -1414,9 +1419,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } /* - * Chek file enverovments ( xml) + * 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; @@ -1450,7 +1455,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->sccppath["tftp_templates"] = $this->sccppath["tftp_path"] . '/templates'; if (!file_exists($this->sccppath["tftp_templates"])) { if (!mkdir($this->sccppath["tftp_templates"], 0777, true)) { - die('Error create template dir'); + die('Error creating template dir'); } } } @@ -1458,7 +1463,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan'; if (!file_exists($this->sccppath["tftp_DP"])) { if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) { - die('Error create DialPlan template dir'); + die('Error creating DialPlan template dir'); } } } @@ -1531,8 +1536,8 @@ 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; @@ -1545,7 +1550,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $res; } - function get_DialPlant($get_file) { + function get_DialPlan($get_file) { $file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml'; if (file_exists($file)) { // $load_xml_data = simplexml_load_file($file); @@ -1559,7 +1564,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $res; } - function del_DialPlant($get_file) { + function del_DialPlan($get_file) { if (!empty($get_file)) { $file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml'; if (file_exists($file)) { @@ -1570,7 +1575,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } - function save_DialPlant($get_settings) { + function save_DialPlan($get_settings) { $xmlstr = "\n"; $dialFelds = array('match','timeout','rewrite','tone'); //str -to lo ! @@ -1579,7 +1584,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $save_data = array(); $integer_msg = _("%s must be a non-negative integer"); $errors = array(); - foreach ($get_settings[$hdr_arprefix.'dialtemplatee'] as $key => $value) { + foreach ($get_settings[$hdr_arprefix.'dialtemplate'] as $key => $value) { $xmlstr .= 'asXml($xml_name); // Save } else { - die('Error Hardware templatee :' . $xml_template . ' not found'); + die('Error Hardware template :' . $xml_template . ' not found'); } return time(); * diff --git a/Sccp_manager.inc/dbinterface.class.php b/Sccp_manager.inc/dbinterface.class.php index 638cc03..309a1cb 100644 --- a/Sccp_manager.inc/dbinterface.class.php +++ b/Sccp_manager.inc/dbinterface.class.php @@ -11,15 +11,15 @@ class dbinterface { private $val_null = 'NONE'; /// REPLACE to null Field public function __construct() { - } - public function info() { - return Array('Version' => '13.0.2', - 'about' =>'Data access interface v. 13.0.2'); - } + } -/* - Core Access Function - */ + public function info() { + return Array('Version' => '13.0.2', 'about' =>'Data access interface v. 13.0.2'); + } + + /* + * Core Access Function + */ public function get_db_SccpTableData($dataid, $data = array()) { if ($dataid == '') { return False; @@ -73,9 +73,7 @@ class dbinterface { /* * Get Sccp Device Model information - * */ - function getDb_model_info($get = "all", $format_list = "all", $filter = array()) { global $db; switch ($format_list) { @@ -204,6 +202,4 @@ class dbinterface { } return $result; } - - } \ No newline at end of file diff --git a/Sccp_manager.inc/extconfigs.class.php b/Sccp_manager.inc/extconfigs.class.php index 0b3c3fd..0b0f24e 100644 --- a/Sccp_manager.inc/extconfigs.class.php +++ b/Sccp_manager.inc/extconfigs.class.php @@ -61,15 +61,15 @@ class extconfigs { "bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6 # bindaddr = "::" will support ipv6 and ipv4 at the same time "deny" => '0.0.0.0/0.0.0.0', - "permit" => '0.0.0.0/0.0.0.0', # defaults to 'internal' which means: + "permit" => '0.0.0.0/0.0.0.0', # !TODO!: please change this to 'internal' which would mean: # permit:127.0.0.0/255.0.0.0,permit:10.0.0.0/255.0.0.0,permit:172.0.0.0/255.224.0.0,permit:192.168.0.0/255.255.0.0" "dateformat" => 'D.M.Y', # This is the german default format. Should be "D/M/Y" or "D/M/YA" instead "disallow" => 'all', "allow" => 'alaw;ulaw', - "devicetable" => 'sccpdevice', "hotline_enabled" => 'no', - "hotline_context" => 'default', - "hotline_extension" => '*60', + "hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ? + "hotline_extension" => '*60', # !TODO!: Is this a good default extension to dial for hotline ? "hotline_label" => 'hotline', + "devicetable" => 'sccpdevice', "linetable" => 'sccpline', "tftp_path" => '/tftpboot' ); diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index c9f7282..77ed07e 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -6,6 +6,7 @@ * */ +/* !TODO!: Re-Indent this file */ namespace FreePBX\modules\Sccp_manager; class srvinterface { @@ -20,7 +21,7 @@ class srvinterface { /* Core Access Function */ - public function sccp_core_comands($params = array()) { + public function sccp_core_commands($params = array()) { global $astman; $cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''), 'get_version' => array('cmd' => "sccp show version", 'param' => ''), @@ -76,7 +77,7 @@ class srvinterface { if (empty($dev_id)) { return array(); } - $res = $this->sccp_core_comands(array('cmd' => 'get_dev_info', 'name' => $dev_id)); + $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 ')); @@ -107,9 +108,10 @@ class srvinterface { return array(); } } + /* Current not use */ public function sccp_list_hints() { - $ast_out = $this->sccp_core_comands(array('cmd' => 'get_hints')); + $ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints')); $ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_key = array(); for ($i = 0; $i < 3; $i++) { @@ -133,6 +135,7 @@ class srvinterface { return $ast_key; } + /* !TODO!: install.php is still using the other version number*/ public function get_compatible_sccp() { $res = $this-> getChanSCCPVersion(); if (empty($res)) { @@ -148,7 +151,9 @@ class srvinterface { } // return $res["vCode"]; } - + + /* !TODO!: Multiple Version functions (choose one)*/ + /* !TODO!: private ? */ function getCoreSCCPVersion() { $result = array(); $ast_out = $this->sccp_version(); @@ -158,7 +163,7 @@ class srvinterface { 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)) { + 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 @@ -168,9 +173,11 @@ class srvinterface { return $result; } -// rename public - > privat + + /* !TODO!: Old Method */ + /* !TODO!: rename public - > private private function sccp_version() { - $ast_out = $this->sccp_core_comands(array('cmd' => 'get_version')); + $ast_out = $this->sccp_core_commands(array('cmd' => 'get_version')); if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) { $ast_out = substr($matches[0],9,-1); return explode(' ', $ast_out); @@ -179,8 +186,9 @@ class srvinterface { } } - - function getChanSCCPVersion() { + /* !TODO!: Multiple Version functions (choose one :-)*/ + /* !TODO!: private ? */ + function getChanSCCPVersion() { global $astman; $result = array(); if (!$astman) { @@ -244,7 +252,7 @@ class srvinterface { } public function sccp_list_keysets() { - $ast_out = $this->sccp_core_comands(array('cmd' => 'get_softkey')); + $ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey')); $ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_key = array(); @@ -269,8 +277,8 @@ class srvinterface { return $ast_key; } - public function sccp_get_active_devise() { - $ast_out = $this->sccp_core_comands(array('cmd' => 'get_device')); + public function sccp_get_active_device() { + $ast_out = $this->sccp_core_commands(array('cmd' => 'get_device')); $ast_out = preg_split("/[\n]/", $ast_out['data']); @@ -319,7 +327,7 @@ class srvinterface { return $ast_key; } /* - * Replace sccp_core_comands($params = array()) { + * Replace sccp_core_commands($params = array()) { */ private function astman_retrieveJSFromMetaData($segment = "") { diff --git a/Sccp_manager.inc/xmlinterface.class.php b/Sccp_manager.inc/xmlinterface.class.php index 8005df8..abaa5b2 100644 --- a/Sccp_manager.inc/xmlinterface.class.php +++ b/Sccp_manager.inc/xmlinterface.class.php @@ -6,6 +6,7 @@ * */ +/* !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 @@ -312,7 +313,7 @@ class xmlinterface { // print_r($xml_work); $xml_work->asXml($xml_name); // Save } else { - die('Error Hardware templatee :' . $xml_template . ' not found'); + die('Error Hardware template :' . $xml_template . ' not found'); } return time(); } diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js index 272c3fb..26f744a 100644 --- a/assets/js/sccp_manager.js +++ b/assets/js/sccp_manager.js @@ -526,7 +526,7 @@ $(document).ready(function () { //}); -// Bootstrap table Enabled / Disabled butons ( class="btn-tab-select") +// Bootstrap table Enabled / Disabled buttons ( class="btn-tab-select") $("table").on('check-all.bs.table', function (rows) { var id_fld = $(this).data('id'); $(".btn-tab-select").each(function () { diff --git a/conf/Sccp.class.php b/conf/Sccp.class.php index b827f54..55aa9bb 100644 --- a/conf/Sccp.class.php +++ b/conf/Sccp.class.php @@ -27,7 +27,9 @@ class Sccp extends \FreePBX\modules\Core\Driver { ); } - public function addDevice1($id, $settings) { + + /* !TODO!: Not clear what the difference is between addDevice and addDevice1 */ + public function addDevice1($id, $settings) { $sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)'; $sth = $this->database->prepare($sql); $settings = is_array($settings)?$settings:array(); @@ -168,29 +170,31 @@ class Sccp extends \FreePBX\modules\Core\Driver { ); } -# ??? Would it not be better to put this part in the view directory (MVC) ? +# !TODO!: Would it not be better to put this part in the view directory (MVC) ? public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { $section = _("Settings"); $category = "general"; $tmparr = array(); - $tt = _("The maximum number of incoming calls to this line."); + $tt = _("The maximum number of incoming calls on this line."); // $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel); + /* !TODO!: Please change the default value for incominglimit to '6' or higher */ $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 1); - $tt = _("Asterisk context this line will use send calls to/from (Note: Only change this is you know what you are doing)."); + $tt = _("Asterisk context which this line will use to send and receive calls (Note: Only change this is you know what you are doing)."); $tmparr['context'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1); + /* !TODO!: Maybe completely remove support for old numberic callgroup/pickupgroup in favor of the named version ? */ $tt = _("Phone call group (numeric only, example:1,3-4)"); $tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1); -# ??? multiple allowed (not sure if that is implemented here) +# !TODO!: multiple allowed (not sure if that is implemented here) $tt = _("Phone named call group (>asterisk-11)"); $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1); $tt = _("Sets the pickup group (numeric only, example:1,3-4) this line is a member of. Allows this line to pickup calls from remote phones which are in this callhroup."); $tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1); -# ??? multiple allowed (not sure if that is implemented here) +# !TODO!: multiple allowed (not sure if that is implemented here) $tt = _("Sets the named pickup name group this line is a member of. Allows this line to pickup calls from remote phones which are in this name callgroup (>asterisk-11)."); $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1); @@ -233,6 +237,7 @@ class Sccp extends \FreePBX\modules\Core\Driver { $select[] = array( 'value' => '0x46', 'text' => 'Reminder Ring'); $select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank'); $select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone'); + /* !TODO!: I would remove the values below this line, except for 'No Tone' */ $select[] = array( 'value' => '0x67', 'text' => '2105 HZ'); $select[] = array( 'value' => '0x68', 'text' => '2600 HZ'); $select[] = array( 'value' => '0x69', 'text' => '440 HZ'); @@ -260,7 +265,7 @@ class Sccp extends \FreePBX\modules\Core\Driver { $tt = _("Outside dialtone frequency (defaul 0x22)"); $tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select'); -# ??? is there no easier way to specify a boolean radio group ? +# !TODO!: is there no easier way to specify a boolean radio group ? unset($select); $select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'no', 'text' => 'No'); @@ -278,10 +283,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 = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'
'. -# ??? The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour + $tt = _("DND: How will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'
'. +# !TODO!: The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour _("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'
'. -# ??? Userdefined is also a possible state, but it is not used or implemented (and it should not be implemented here, i think) +r +# !TODO!: Userdefined is also a possible state, but it is not used or implemented (and it should not be implemented here, i think) _("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'); diff --git a/i18n/sccp_manager.pot b/i18n/sccp_manager.pot index 2bff9d7..d062db1 100644 --- a/i18n/sccp_manager.pot +++ b/i18n/sccp_manager.pot @@ -921,8 +921,8 @@ msgstr "" #: views/sccpgeneral.xml: msgid "" "buttons come in the following flavours:empty: Empty button (no options)line: " -"Registers the line with identifier specified as [name]silent: butons equal " -"'Line' with out ringmonitor: butons mode speeddial + show statusspeeddial: " +"Registers the line with identifier specified as [name]silent: buttons equal " +"'Line' with out ringmonitor: buttons mode speeddial + show statusspeeddial: " "Adds a speeddial with label [name] and [option1] as number Optionally, " "[option2] can be used to specify a hint by extension@context as usual." "service (not implemented): Adds a service url Feature buttons have an on/off " diff --git a/install.php b/install.php index f8eb48a..5235135 100644 --- a/install.php +++ b/install.php @@ -19,6 +19,7 @@ if(class_exists($class,false)) { $srvinterface = new $class(); } +/* unused / moved to srvinterface // // Helper function to retrieve SCCPConfigMetaData via ASTMan // segment: ["", "general","device","line","softkey"]} @@ -39,6 +40,7 @@ function astman_retrieveJSFromMetaData($astman, $segment = "") { return false; } } +*/ function Get_DB_config($sccp_compatible) { $db_config_v0 = array( @@ -268,6 +270,7 @@ function CheckSCCPManagerDBTables($table_req) { } } +/* notused */ function CheckPermissions() { outn("
  • " . _("Checking Filesystem Permissions") . "
  • "); $dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views'; @@ -295,13 +298,13 @@ function CheckAsteriskVersion() { return $ver_compatible; } -function CheckChanSCCPСomatable() { +function CheckChanSCCPCompatible() { global $srvinterface,$astman; if (!$astman) { ie_freepbx('No asterisk manager connection provided!. Installation Failed'); } $sccp_compatible = $srvinterface->get_compatible_sccp(); - outn("
  • " . _("Sccp model Compatable code : ") . $sccp_compatible . "
  • "); + outn("
  • " . _("Sccp model Compatible code : ") . $sccp_compatible . "
  • "); return $sccp_compatible; } @@ -670,7 +673,7 @@ function Setup_RealTime() { CheckSCCPManagerDBTables($table_req); #CheckPermissions(); CheckAsteriskVersion(); -$sccp_compatible = CheckChanSCCPСomatable(); +$sccp_compatible = CheckChanSCCPCompatible(); $db_config = Get_DB_config($sccp_compatible); InstallDB_sccpsettings(); InstallDB_sccpdevmodel(); diff --git a/uninstall.php b/uninstall.php index fd0e833..6cc0836 100644 --- a/uninstall.php +++ b/uninstall.php @@ -1,5 +1,10 @@ get_DP_list()); -//print_r($this->get_DialPlant('dialplan')); +//print_r($this->get_DialPlan('dialplan')); ?>
    -

    +

     
    - +
    - + diff --git a/views/form.buttons.php b/views/form.buttons.php index f191574..7164f13 100644 --- a/views/form.buttons.php +++ b/views/form.buttons.php @@ -23,7 +23,7 @@ $show_buttons =1; //print_r($hint_list); if (!empty($_REQUEST['id'])) { $dev_id = $_REQUEST['id']; - $db_butons = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_buttons', array("id" => $dev_id)); + $db_buttons = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_buttons', array("id" => $dev_id)); $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id)); $max_buttons = $db_device['buttons']; if (!empty($db_device['addon_buttons'])){ @@ -46,10 +46,10 @@ if (!empty($_REQUEST['new_id'])) { ?> - - + + - +

    @@ -79,11 +79,11 @@ if (!empty($_REQUEST['new_id'])) {
    '; + echo ''; ?>
    @@ -197,7 +197,7 @@ if (!empty($_REQUEST['new_id'])) {
    '; + echo ''; ?>
    @@ -216,7 +216,7 @@ if (!empty($_REQUEST['new_id'])) {
    '; + echo ''; ?>
    diff --git a/views/form.dptemplate.php b/views/form.dptemplate.php index 1d25a99..4933a01 100644 --- a/views/form.dptemplate.php +++ b/views/form.dptemplate.php @@ -6,7 +6,7 @@ * and open the template in the editor. */ -//$list_data = $this->get_DialPlant('dialplan'); +//$list_data = $this->get_DialPlan('dialplan'); //print_r($list_data); //$dialFelds = array('match','timeout','line','rewrite','tone'); //$dialFelds = array('match','timeout','User','rewrite','tone'); @@ -16,7 +16,7 @@ if (!empty($_REQUEST['extdisplay'])) { $dev_id = $_REQUEST['extdisplay']; } if ($dev_id != '*new*') { - $list_data= $this->get_DialPlant($dev_id ); + $list_data= $this->get_DialPlan($dev_id ); $data_s= ''; foreach ($list_data['template'] as $key => $value) { foreach ($dialFelds as $fld) { @@ -29,13 +29,13 @@ if ($dev_id != '*new*') { $data_s .= ';'; } $data_s = substr($data_s, 0, -1); - $def_val['dialtemplatee'] = array("keyword" => 'dialtemplatee', "data" => $data_s, "seq" => "99"); + $def_val['dialtemplate'] = array("keyword" => 'dialtemplate', "data" => $data_s, "seq" => "99"); } ?> - +