- 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
- 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.

View file

@ -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 = "<DIALTEMPLATE>\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 .= '<TEMPLATE';
if (!empty($value['match'])) {
foreach ($dialFelds as $fld){
@ -1592,7 +1597,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
}
} else {
$errors = array('Fields "match" is requered !!');
$errors = array('Fields need to match !!');
}
$xmlstr .= "/>\n";
@ -1600,8 +1605,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$xmlstr .= '</DIALTEMPLATE>';
if (!empty($get_settings['idtemplate'])) {
if ($get_settings['idtemplate'] == '*new*') {
if (!empty($get_settings[$hdr_prefix.'dialtemplatee_name'])) {
$put_file = (string)$get_settings[$hdr_prefix.'dialtemplatee_name'];
if (!empty($get_settings[$hdr_prefix.'dialtemplate_name'])) {
$put_file = (string)$get_settings[$hdr_prefix.'dialtemplate_name'];
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
} else $put_file = (string)$get_settings['idtemplate'];
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
@ -1989,7 +1994,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// 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();
*

View file

@ -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;
}
}

View file

@ -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'
);

View file

@ -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)) {
@ -149,6 +152,8 @@ 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 = "") {

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;
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();
}

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) {
var id_fld = $(this).data('id');
$(".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 (?,?,?,?)';
$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").'<br>'.
# ??? 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").'<br>'.
# !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 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>'.
_("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');

View file

@ -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 "

View file

@ -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("<li>" . _("Checking Filesystem Permissions") . "</li>");
$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("<li>" . _("Sccp model Compatable code : ") . $sccp_compatible . "</li>");
outn("<li>" . _("Sccp model Compatible code : ") . $sccp_compatible . "</li>");
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();

View file

@ -1,5 +1,10 @@
<?php
/* $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'); }
global $db;

View file

@ -6,24 +6,24 @@
*/
// vim: set ai ts=4 sw=4 ft=phtml:
//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="row">
<div class="col-sm-12">
<div class="display no-border">
<h1><?php echo _("Cisco Dial Templet") ?></h1>
<h1><?php echo _("Cisco Dial Template") ?></h1>
<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>
<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>
</button>
</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>
<tr>
<!-- <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>
</tr>
</thead>

View file

@ -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'])) {
?>
<form autocomplete="off" name="frm_editbutons" id="frm_editbutons" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="frm_editbutons">
<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_editbuttons">
<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'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
</div>
@ -79,11 +79,11 @@ if (!empty($_REQUEST['new_id'])) {
</div></div>
<?php
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 = '';
$defaul_tv = (empty($db_butons[$line_id])) ? "empty": $db_butons[$line_id]['type'];
$defaul_btn = (empty($db_butons[$line_id])) ? "": $db_butons[$line_id]['name'];
$defaul_opt = (empty($db_butons[$line_id])) ? array(''): explode(',',$db_butons[$line_id]['options']);
$defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['type'];
$defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name'];
$defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']);
$show_form_mode = $defaul_tv;
@ -167,7 +167,7 @@ if (!empty($_REQUEST['new_id'])) {
<!-- if Line Type = Othe Show Input -->
<div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
<?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>
@ -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="col-xs-5">
<?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 class="col-xs-5">
@ -216,7 +216,7 @@ if (!empty($_REQUEST['new_id'])) {
</div>
<div class="col-xs-5">
<?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>

View file

@ -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");
}
?>
<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="Submit" value="Submit">