- 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
This commit is contained in:
Diederik de Groot 2017-11-03 13:20:17 +01:00
parent d218d10bf3
commit c077885c9b
14 changed files with 148 additions and 125 deletions

View file

@ -48,22 +48,22 @@ Make sure you have the following installed on your system:
### Requirements ### 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) - 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 - expected configure flags:
- Creating mysql DB from sorce (mysql -u root asterisk < mysql-v5_enum.sql) ```./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) - 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" - 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) - configure 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
### 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 ### Module installation
@ -77,10 +77,9 @@ Make sure you have the following installed on your system:
8. Close Status window. 8. Close Status window.
9. Apply Config to FreePBX. 9. Apply Config to FreePBX.
### IMPORTANT NOTE: ### IMPORTANT NOTES:
- This system assumes you are using the SCCP Real-time Database. If you are - This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database,
not yet using the RTD, you will need to set it up for this module to be you will have to set it up for this module to work ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)).
effective. - For the cisco phones to work correctly, they should be provisioned with the latest firmware (v8.1 or higher)
- For the correct operation of the cisco-phones you will be tempted cisco phone firmware (recomended v 8.1 or later) - You can use cisco language profiles (localization) to switch the phones to your locale.
- You can also use cisco language profiles to personalize sysnem and any cisco phones.

View file

@ -231,22 +231,27 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
/* unused */
public function doConfigPageInit($page) { public function doConfigPageInit($page) {
$this->doGeneralPost(); $this->doGeneralPost();
} }
/* unused */
public function install() { public function install() {
} }
/* unused */
public function uninstall() { public function uninstall() {
} }
/* unused */
public function backup() { public function backup() {
} }
/* unused */
public function restore($backup) { public function restore($backup) {
} }
@ -508,7 +513,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
public function ajaxRequest($req, &$setting) { public function ajaxRequest($req, &$setting) {
switch ($req) { switch ($req) {
case 'savesettings': case 'savesettings': /* !TODO!: mixing snake case and camel case, chooose one :-) */
case "save_hardware": case "save_hardware":
case "save_dp_template": case "save_dp_template":
case "delete_hardware": case "delete_hardware":
@ -517,7 +522,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case "getDeviceModel": case "getDeviceModel":
case "getUserGrid": case "getUserGrid":
case "getSoftKey": case "getSoftKey":
case "getDialTemplete": case "getDialTemplate":
case "create_hw_tftp": case "create_hw_tftp":
case "reset_dev": case "reset_dev":
case 'reset_token': case 'reset_token':
@ -549,7 +554,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->sccp_db_save_setting(); $this->sccp_db_save_setting();
// $this->sccp_create_sccp_init(); // $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']; $msg = 'Config Saved: ' . $res['Response'] . '. Info :' . $res['data'];
// needreload(); // needreload();
return array('status' => true, 'message' => $msg, 'reload' => true); 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); return $this->save_hw_phone($request);
break; 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); $res = $this->save_DialPlant($request);
if (empty($res)) { if (empty($res)) {
return array('status' => true, 'search' => '?display=sccp_adv', 'hash' => 'sccpdialplan'); 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'])) { if (!empty($request['dialplan'])) {
$get_file = $request['dialplan']; $get_file = $request['dialplan'];
$res = $this->del_DialPlant($get_file); $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 { } else {
return array('status' => false, 'message' => print_r($res)); 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('sccpdevice', array('name' => $idv), 'delete', "name");
$this->dbinterface->sccp_save_db("sccpbuttons", array(), 'delete', '', $idv); $this->dbinterface->sccp_save_db("sccpbuttons", array(), 'delete', '', $idv);
$this->sccp_delete_device_XML($idv); // Концы в вводу !! $this->sccp_delete_device_XML($idv); // Концы в вводу !!
// $this->sccp_core_comands(array('cmd' => 'reload_phone', 'name' => $idv)); // $this->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $idv));
$this->srvinterface->sccp_core_comands(array('cmd' => 'reset_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 ! '); 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) { foreach ($models as $data) {
$ver_id = $this->sccp_create_device_XML($data['name']); $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; break;
case 'reset_token': case 'reset_token':
@ -613,23 +619,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$msg = strpos($idv, 'SEP-'); $msg = strpos($idv, 'SEP-');
if (!(strpos($idv, 'SEP') === false)) { if (!(strpos($idv, 'SEP') === false)) {
if ($cmd_id == 'reset_token') { 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 { } 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']; $msg = $res['Response'] . ' ' . $res['data'];
} }
if ($idv == 'all') { 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) { foreach ($dev_list as $key => $data) {
if ($cmd_id == 'reset_token') { if ($cmd_id == 'reset_token') {
if (($data['token'] == 'Rej') || ($data['status'] == '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 .' '; $msg .= 'Send Token reset to :'. $key .' ';
} }
} else { } 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'] . ' ';
} }
// $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; break;
case 'model_add': case 'model_add':
@ -703,7 +709,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$id_name = $request['softkey']; $id_name = $request['softkey'];
unset($this->sccp_conf_init[$id_name]); unset($this->sccp_conf_init[$id_name]);
$this->sccp_create_sccp_init(); $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 array('status' => true, 'table_reload' => true);
} }
break; break;
@ -717,7 +723,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
$this->sccp_create_sccp_init(); $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 array('status' => true, 'table_reload' => true);
// return $this->sccp_conf_init[$id_name]; // return $this->sccp_conf_init[$id_name];
@ -754,11 +760,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break; break;
case "getPhoneGrid": case "getPhoneGrid":
$result = $this->dbinterface->get_db_SccpTableData('SccpDevice'); $result = $this->dbinterface->get_db_SccpTableData('SccpDevice');
$staus = $this->srvinterface->sccp_get_active_devise(); $staus = $this->srvinterface->sccp_get_active_device();
if (empty($result)) { if (empty($result)) {
$result = array(); $result = array();
} else { } else {
// $staus = $this->sccp_get_active_devise(); // $staus = $this->sccp_get_active_device();
foreach ($result as &$dev_id) { foreach ($result as &$dev_id) {
$id_name = $dev_id['name']; $id_name = $dev_id['name'];
if (!empty($staus[$id_name])) { if (!empty($staus[$id_name])) {
@ -769,7 +775,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$staus[$id_name]['news'] ='N'; $staus[$id_name]['news'] ='N';
} else { } else {
$dev_id['description'] = '- -'; $dev_id['description'] = '- -';
$dev_id['status'] = 'no connect'; $dev_id['status'] = 'not connected';
$dev_id['address'] = '- -'; $dev_id['address'] = '- -';
} }
} }
@ -798,8 +804,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $result; return $result;
break; break;
case "getDialTemplete": case "getDialTemplate":
$result = $this->get_DP_list(); $result = $this->get_DP_list(); /* !TODO!: please use DialPlan instead of DP */
if (empty($result)) { if (empty($result)) {
$result = array(); $result = array();
} }
@ -892,9 +898,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// Save / Updade Base // Save / Updade Base
$this->dbinterface->sccp_save_db("sccpdevice", $save_settings, 'replace'); $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'); $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; $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'])) { 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); $this->sccp_create_device_XML($name_dev);
if ($hw_id == 'new') { 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 { } 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; return $save_settings;
@ -1120,7 +1126,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$file_context = $keysetData['name']; $file_context = $keysetData['name'];
if ($file_context != 'default') { if ($file_context != 'default') {
$confDir = $amp_conf["ASTETCDIR"]; $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"; $confDir = "/etc/asterisk";
} }
$inputfile = "$confDir/sccp.conf"; $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() { private function init_tftp_lang_path() {
$dir = $this->sccppath["tftp_path"]; $dir = $this->sccppath["tftp_path"];
foreach ($this->extconfigs->getextConfig('sccp_lang') as $lang_key => $lang_value) { 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() { function init_sccp_path() {
global $db; global $db;
global $amp_conf; global $amp_conf;
@ -1450,7 +1455,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->sccppath["tftp_templates"] = $this->sccppath["tftp_path"] . '/templates'; $this->sccppath["tftp_templates"] = $this->sccppath["tftp_path"] . '/templates';
if (!file_exists($this->sccppath["tftp_templates"])) { if (!file_exists($this->sccppath["tftp_templates"])) {
if (!mkdir($this->sccppath["tftp_templates"], 0777, true)) { 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'; $this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
if (!file_exists($this->sccppath["tftp_DP"])) { if (!file_exists($this->sccppath["tftp_DP"])) {
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) { 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() { function get_DP_list() {
$dir = $this->sccppath["tftp_DP"].'/*.xml'; $dir = $this->sccppath["tftp_DP"].'/*.xml';
$base_len = strlen($this->sccppath["tftp_DP"])+ 1; $base_len = strlen($this->sccppath["tftp_DP"])+ 1;
@ -1545,7 +1550,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function get_DialPlant($get_file) { 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)) { if (file_exists($file)) {
// $load_xml_data = simplexml_load_file($file); // $load_xml_data = simplexml_load_file($file);
@ -1559,7 +1564,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $res; return $res;
} }
function del_DialPlant($get_file) { function del_DialPlan($get_file) {
if (!empty($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)) { 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 = "<DIALTEMPLATE>\n"; $xmlstr = "<DIALTEMPLATE>\n";
$dialFelds = array('match','timeout','rewrite','tone'); //str -to lo ! $dialFelds = array('match','timeout','rewrite','tone'); //str -to lo !
@ -1579,7 +1584,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$save_data = array(); $save_data = array();
$integer_msg = _("%s must be a non-negative integer"); $integer_msg = _("%s must be a non-negative integer");
$errors = array(); $errors = array();
foreach ($get_settings[$hdr_arprefix.'dialtemplatee'] as $key => $value) { foreach ($get_settings[$hdr_arprefix.'dialtemplate'] as $key => $value) {
$xmlstr .= '<TEMPLATE'; $xmlstr .= '<TEMPLATE';
if (!empty($value['match'])) { if (!empty($value['match'])) {
foreach ($dialFelds as $fld){ foreach ($dialFelds as $fld){
@ -1592,7 +1597,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
} }
} else { } else {
$errors = array('Fields "match" is requered !!'); $errors = array('Fields need to match !!');
} }
$xmlstr .= "/>\n"; $xmlstr .= "/>\n";
@ -1600,8 +1605,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$xmlstr .= '</DIALTEMPLATE>'; $xmlstr .= '</DIALTEMPLATE>';
if (!empty($get_settings['idtemplate'])) { if (!empty($get_settings['idtemplate'])) {
if ($get_settings['idtemplate'] == '*new*') { if ($get_settings['idtemplate'] == '*new*') {
if (!empty($get_settings[$hdr_prefix.'dialtemplatee_name'])) { if (!empty($get_settings[$hdr_prefix.'dialtemplate_name'])) {
$put_file = (string)$get_settings[$hdr_prefix.'dialtemplatee_name']; $put_file = (string)$get_settings[$hdr_prefix.'dialtemplate_name'];
} else { $errors = array('Fields Dial Plan Name is requered !!'); } } else { $errors = array('Fields Dial Plan Name is requered !!'); }
} else $put_file = (string)$get_settings['idtemplate']; } else $put_file = (string)$get_settings['idtemplate'];
} else { $errors = array('Fields Dial Plan Name is requered !!'); } } else { $errors = array('Fields Dial Plan Name is requered !!'); }
@ -1989,7 +1994,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// print_r($xml_work); // print_r($xml_work);
$xml_work->asXml($xml_name); // Save $xml_work->asXml($xml_name); // Save
} else { } else {
die('Error Hardware templatee :' . $xml_template . ' not found'); die('Error Hardware template :' . $xml_template . ' not found');
} }
return time(); return time();
* *

View file

@ -11,15 +11,15 @@ class dbinterface {
private $val_null = 'NONE'; /// REPLACE to null Field private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct() { public function __construct() {
} }
public function info() {
return Array('Version' => '13.0.2',
'about' =>'Data access interface v. 13.0.2');
}
/* public function info() {
Core Access Function 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()) { public function get_db_SccpTableData($dataid, $data = array()) {
if ($dataid == '') { if ($dataid == '') {
return False; return False;
@ -73,9 +73,7 @@ class dbinterface {
/* /*
* Get Sccp Device Model information * Get Sccp Device Model information
*
*/ */
function getDb_model_info($get = "all", $format_list = "all", $filter = array()) { function getDb_model_info($get = "all", $format_list = "all", $filter = array()) {
global $db; global $db;
switch ($format_list) { switch ($format_list) {
@ -204,6 +202,4 @@ class dbinterface {
} }
return $result; return $result;
} }
} }

View file

@ -61,15 +61,15 @@ class extconfigs {
"bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6 "bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6
# bindaddr = "::" will support ipv6 and ipv4 at the same time # bindaddr = "::" will support ipv6 and ipv4 at the same time
"deny" => '0.0.0.0/0.0.0.0', "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" # 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 "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', "disallow" => 'all', "allow" => 'alaw;ulaw',
"devicetable" => 'sccpdevice',
"hotline_enabled" => 'no', "hotline_enabled" => 'no',
"hotline_context" => 'default', "hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
"hotline_extension" => '*60', "hotline_extension" => '*60', # !TODO!: Is this a good default extension to dial for hotline ?
"hotline_label" => 'hotline', "hotline_label" => 'hotline',
"devicetable" => 'sccpdevice',
"linetable" => 'sccpline', "linetable" => 'sccpline',
"tftp_path" => '/tftpboot' "tftp_path" => '/tftpboot'
); );

View file

@ -6,6 +6,7 @@
* *
*/ */
/* !TODO!: Re-Indent this file */
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class srvinterface { class srvinterface {
@ -20,7 +21,7 @@ class srvinterface {
/* /*
Core Access Function Core Access Function
*/ */
public function sccp_core_comands($params = array()) { public function sccp_core_commands($params = array()) {
global $astman; global $astman;
$cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''), $cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''),
'get_version' => array('cmd' => "sccp show version", 'param' => ''), 'get_version' => array('cmd' => "sccp show version", 'param' => ''),
@ -76,7 +77,7 @@ class srvinterface {
if (empty($dev_id)) { if (empty($dev_id)) {
return array(); 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'])); $res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string)$res['data']));
if (strpos($res1,'MAC-Address')) { if (strpos($res1,'MAC-Address')) {
$res2 = substr($res1,0,strpos($res1,'+--- Buttons ')); $res2 = substr($res1,0,strpos($res1,'+--- Buttons '));
@ -107,9 +108,10 @@ class srvinterface {
return array(); return array();
} }
} }
/* Current not use */ /* Current not use */
public function sccp_list_hints() { 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_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array(); $ast_key = array();
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
@ -133,6 +135,7 @@ class srvinterface {
return $ast_key; return $ast_key;
} }
/* !TODO!: install.php is still using the other version number*/
public function get_compatible_sccp() { public function get_compatible_sccp() {
$res = $this-> getChanSCCPVersion(); $res = $this-> getChanSCCPVersion();
if (empty($res)) { if (empty($res)) {
@ -148,7 +151,9 @@ class srvinterface {
} }
// return $res["vCode"]; // return $res["vCode"];
} }
/* !TODO!: Multiple Version functions (choose one)*/
/* !TODO!: private ? */
function getCoreSCCPVersion() { function getCoreSCCPVersion() {
$result = array(); $result = array();
$ast_out = $this->sccp_version(); $ast_out = $this->sccp_version();
@ -158,7 +163,7 @@ class srvinterface {
if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){ if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){
$result["develop"] = $ast_out[1]; $result["develop"] = $ast_out[1];
$res = 10; $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; $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
@ -168,9 +173,11 @@ class srvinterface {
return $result; return $result;
} }
// rename public - > privat
/* !TODO!: Old Method */
/* !TODO!: rename public - > private
private function sccp_version() { 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)) { if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
$ast_out = substr($matches[0],9,-1); $ast_out = substr($matches[0],9,-1);
return explode(' ', $ast_out); return explode(' ', $ast_out);
@ -179,8 +186,9 @@ class srvinterface {
} }
} }
/* !TODO!: Multiple Version functions (choose one :-)*/
function getChanSCCPVersion() { /* !TODO!: private ? */
function getChanSCCPVersion() {
global $astman; global $astman;
$result = array(); $result = array();
if (!$astman) { if (!$astman) {
@ -244,7 +252,7 @@ class srvinterface {
} }
public function sccp_list_keysets() { 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_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array(); $ast_key = array();
@ -269,8 +277,8 @@ class srvinterface {
return $ast_key; return $ast_key;
} }
public function sccp_get_active_devise() { public function sccp_get_active_device() {
$ast_out = $this->sccp_core_comands(array('cmd' => 'get_device')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_device'));
$ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_out = preg_split("/[\n]/", $ast_out['data']);
@ -319,7 +327,7 @@ class srvinterface {
return $ast_key; return $ast_key;
} }
/* /*
* Replace sccp_core_comands($params = array()) { * Replace sccp_core_commands($params = array()) {
*/ */
private function astman_retrieveJSFromMetaData($segment = "") { private function astman_retrieveJSFromMetaData($segment = "") {

View file

@ -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; namespace FreePBX\modules\Sccp_manager;
class xmlinterface { class xmlinterface {
private $val_null = 'NONE'; /// REPLACE to null Field private $val_null = 'NONE'; /// REPLACE to null Field
@ -312,7 +313,7 @@ class xmlinterface {
// print_r($xml_work); // print_r($xml_work);
$xml_work->asXml($xml_name); // Save $xml_work->asXml($xml_name); // Save
} else { } else {
die('Error Hardware templatee :' . $xml_template . ' not found'); die('Error Hardware template :' . $xml_template . ' not found');
} }
return time(); return time();
} }

View file

@ -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) { $("table").on('check-all.bs.table', function (rows) {
var id_fld = $(this).data('id'); var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () { $(".btn-tab-select").each(function () {

View file

@ -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 (?,?,?,?)'; $sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array(); $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) { public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("Settings"); $section = _("Settings");
$category = "general"; $category = "general";
$tmparr = array(); $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); // $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); $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); $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)"); $tt = _("Phone call group (numeric only, example:1,3-4)");
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1); $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)"); $tt = _("Phone named call group (>asterisk-11)");
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1); $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."); $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); $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)."); $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); $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' => '0x46', 'text' => 'Reminder Ring');
$select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank'); $select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank');
$select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone'); $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' => '0x67', 'text' => '2105 HZ');
$select[] = array( 'value' => '0x68', 'text' => '2600 HZ'); $select[] = array( 'value' => '0x68', 'text' => '2600 HZ');
$select[] = array( 'value' => '0x69', 'text' => '440 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)"); $tt = _("Outside dialtone frequency (defaul 0x22)");
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select'); $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); unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No'); $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' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent'); $select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'UserDefined', 'text' => 'UserDefined'); $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").'<br>'. $tt = _("DND: How will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'<br>'.
# ??? The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour # !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)").'<br>'. _("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
# ??? 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)").'<br>'. _("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent 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'); $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');

View file

@ -921,8 +921,8 @@ msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "" msgid ""
"buttons come in the following flavours:empty: Empty button (no options)line: " "buttons come in the following flavours:empty: Empty button (no options)line: "
"Registers the line with identifier specified as [name]silent: butons equal " "Registers the line with identifier specified as [name]silent: buttons equal "
"'Line' with out ringmonitor: butons mode speeddial + show statusspeeddial: " "'Line' with out ringmonitor: buttons mode speeddial + show statusspeeddial: "
"Adds a speeddial with label [name] and [option1] as number Optionally, " "Adds a speeddial with label [name] and [option1] as number Optionally, "
"[option2] can be used to specify a hint by extension@context as usual." "[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 " "service (not implemented): Adds a service url Feature buttons have an on/off "

View file

@ -19,6 +19,7 @@ if(class_exists($class,false)) {
$srvinterface = new $class(); $srvinterface = new $class();
} }
/* unused / moved to srvinterface
// //
// Helper function to retrieve SCCPConfigMetaData via ASTMan // Helper function to retrieve SCCPConfigMetaData via ASTMan
// segment: ["", "general","device","line","softkey"]} // segment: ["", "general","device","line","softkey"]}
@ -39,6 +40,7 @@ function astman_retrieveJSFromMetaData($astman, $segment = "") {
return false; return false;
} }
} }
*/
function Get_DB_config($sccp_compatible) { function Get_DB_config($sccp_compatible) {
$db_config_v0 = array( $db_config_v0 = array(
@ -268,6 +270,7 @@ function CheckSCCPManagerDBTables($table_req) {
} }
} }
/* notused */
function CheckPermissions() { function CheckPermissions() {
outn("<li>" . _("Checking Filesystem Permissions") . "</li>"); outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views'; $dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
@ -295,13 +298,13 @@ function CheckAsteriskVersion() {
return $ver_compatible; return $ver_compatible;
} }
function CheckChanSCCPСomatable() { function CheckChanSCCPCompatible() {
global $srvinterface,$astman; global $srvinterface,$astman;
if (!$astman) { if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed'); ie_freepbx('No asterisk manager connection provided!. Installation Failed');
} }
$sccp_compatible = $srvinterface->get_compatible_sccp(); $sccp_compatible = $srvinterface->get_compatible_sccp();
outn("<li>" . _("Sccp model Compatable code : ") . $sccp_compatible . "</li>"); outn("<li>" . _("Sccp model Compatible code : ") . $sccp_compatible . "</li>");
return $sccp_compatible; return $sccp_compatible;
} }
@ -670,7 +673,7 @@ function Setup_RealTime() {
CheckSCCPManagerDBTables($table_req); CheckSCCPManagerDBTables($table_req);
#CheckPermissions(); #CheckPermissions();
CheckAsteriskVersion(); CheckAsteriskVersion();
$sccp_compatible = CheckChanSCCPСomatable(); $sccp_compatible = CheckChanSCCPCompatible();
$db_config = Get_DB_config($sccp_compatible); $db_config = Get_DB_config($sccp_compatible);
InstallDB_sccpsettings(); InstallDB_sccpsettings();
InstallDB_sccpdevmodel(); InstallDB_sccpdevmodel();

View file

@ -1,5 +1,10 @@
<?php <?php
/* $Id:$ */ /* $Id:$ */
/* !TODO!: In an ideal world this should roll back everything the install.php script did, except for what existed before install.php was run */
/* !TODO!: This would require the install.php to make a note of all the actions that were skipped and/or performed */
/* !TODO!: Might be a good idea to create a backup of the database before removing anything */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
global $db; global $db;

View file

@ -6,24 +6,24 @@
*/ */
// vim: set ai ts=4 sw=4 ft=phtml: // vim: set ai ts=4 sw=4 ft=phtml:
//print_r($this->get_DP_list()); //print_r($this->get_DP_list());
//print_r($this->get_DialPlant('dialplan')); //print_r($this->get_DialPlan('dialplan'));
?> ?>
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Cisco Dial Templet") ?></h1> <h1><?php echo _("Cisco Dial Template") ?></h1>
<div id="toolbar-sccp-dialtemplate"> <div id="toolbar-sccp-dialtemplate">
<a class="btn btn-default" href="config.php?display=sccp_adv&amp;tech_hardware=dialplan&amp;extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a> <a class="btn btn-default" href="config.php?display=sccp_adv&amp;tech_hardware=dialplan&amp;extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a>
<button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled> <button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&amp;command=getDialTemplete" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id"> <table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&amp;command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> --> <!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="id"><?php echo _('Templete name') ?></th> <th data-sortable="true" data-field="id"><?php echo _('Template name') ?></th>
<th data-field="actions" data-formatter="DispayDPActionsKeyFormatter"><?php echo _('Actions') ?></th> <th data-field="actions" data-formatter="DispayDPActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr> </tr>
</thead> </thead>

View file

@ -23,7 +23,7 @@ $show_buttons =1;
//print_r($hint_list); //print_r($hint_list);
if (!empty($_REQUEST['id'])) { if (!empty($_REQUEST['id'])) {
$dev_id = $_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)); $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
$max_buttons = $db_device['buttons']; $max_buttons = $db_device['buttons'];
if (!empty($db_device['addon_buttons'])){ if (!empty($db_device['addon_buttons'])){
@ -46,10 +46,10 @@ if (!empty($_REQUEST['new_id'])) {
?> ?>
<form autocomplete="off" name="frm_editbutons" id="frm_editbutons" class="fpbx-submit" action="" method="post" data-id="hw_edit"> <form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="frm_editbutons"> <input type="hidden" name="category" value="frm_editbuttons">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<input type="hidden" name="butonscount" value="<?php echo $max_buttons?>"> <input type="hidden" name="buttonscount" value="<?php echo $max_buttons?>">
<div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>"> <div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3> <h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
</div> </div>
@ -79,11 +79,11 @@ if (!empty($_REQUEST['new_id'])) {
</div></div> </div></div>
<?php <?php
for ($line_id = 0; $line_id <=$max_buttons; $line_id ++){ for ($line_id = 0; $line_id <=$max_buttons; $line_id ++){
// print_r($db_butons[$line_id]); // print_r($db_buttons[$line_id]);
$show_form_mode = ''; $show_form_mode = '';
$defaul_tv = (empty($db_butons[$line_id])) ? "empty": $db_butons[$line_id]['type']; $defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['type'];
$defaul_btn = (empty($db_butons[$line_id])) ? "": $db_butons[$line_id]['name']; $defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name'];
$defaul_opt = (empty($db_butons[$line_id])) ? array(''): explode(',',$db_butons[$line_id]['options']); $defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']);
$show_form_mode = $defaul_tv; $show_form_mode = $defaul_tv;
@ -167,7 +167,7 @@ if (!empty($_REQUEST['new_id'])) {
<!-- if Line Type = Othe Show Input --> <!-- if Line Type = Othe Show Input -->
<div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" > <div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_butons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
</div> </div>
</div> </div>
@ -197,7 +197,7 @@ if (!empty($_REQUEST['new_id'])) {
<div class="linefeature_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div class="linefeature_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_butons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
</div> </div>
<div class="col-xs-5"> <div class="col-xs-5">
@ -216,7 +216,7 @@ if (!empty($_REQUEST['new_id'])) {
</div> </div>
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advopt" name="'.$forminfo[1]['name'].$line_id.'_advopt" placeholder="ButtonLabel,Options" value="'.$db_butons[$line_id]['options'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advopt" name="'.$forminfo[1]['name'].$line_id.'_advopt" placeholder="ButtonLabel,Options" value="'.$db_buttons[$line_id]['options'].'" >';
?> ?>
</div> </div>
</div> </div>

View file

@ -6,7 +6,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
//$list_data = $this->get_DialPlant('dialplan'); //$list_data = $this->get_DialPlan('dialplan');
//print_r($list_data); //print_r($list_data);
//$dialFelds = array('match','timeout','line','rewrite','tone'); //$dialFelds = array('match','timeout','line','rewrite','tone');
//$dialFelds = array('match','timeout','User','rewrite','tone'); //$dialFelds = array('match','timeout','User','rewrite','tone');
@ -16,7 +16,7 @@ if (!empty($_REQUEST['extdisplay'])) {
$dev_id = $_REQUEST['extdisplay']; $dev_id = $_REQUEST['extdisplay'];
} }
if ($dev_id != '*new*') { if ($dev_id != '*new*') {
$list_data= $this->get_DialPlant($dev_id ); $list_data= $this->get_DialPlan($dev_id );
$data_s= ''; $data_s= '';
foreach ($list_data['template'] as $key => $value) { foreach ($list_data['template'] as $key => $value) {
foreach ($dialFelds as $fld) { foreach ($dialFelds as $fld) {
@ -29,13 +29,13 @@ if ($dev_id != '*new*') {
$data_s .= ';'; $data_s .= ';';
} }
$data_s = substr($data_s, 0, -1); $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");
} }
?> ?>
<form autocomplete="off" name="frm_editdialtemplate" id="frm_editbutons" class="fpbx-submit" action="" method="post" data-id="dial_template"> <form autocomplete="off" name="frm_editdialtemplate" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="dial_template">
<input type="hidden" name="idtemplate" value="<?php echo $dev_id;?>"> <input type="hidden" name="idtemplate" value="<?php echo $dev_id;?>">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">