Revert "Merge branch 'chan-sccp:develop' into develop"

This reverts commit 32d13ac586, reversing
changes made to 12ad576014.
This commit is contained in:
tomquinn04 2021-06-15 10:45:29 +01:00
parent 32d13ac586
commit 408f31b23c
27 changed files with 1778 additions and 360 deletions

View file

@ -14,7 +14,7 @@
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Chan-SCCP Documentation](https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
This FreePBX module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
providing easy provisioning and management of Cisco IP phones and extensions in a similar way to Cisco CallManager.
The idea of creating a module is borrowed from (https://github.com/Cynjut/SCCP_Manager), and was further developed and managed
by PhantomVl (https://github.com/PhantomVl/sccp_manager) who has been unavailable for some time. sccp_manager relies heavily
@ -45,6 +45,9 @@ apt-get install PHP7.3-zip
- chan-sccp module 4.3.4 (or later) channel driver for Asterisk: [See our WIKI](https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide)
- sccp_manager expects these configure flags to be set during compilation:
```./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate --enable-video```
- Creating mysql DB from sorce
```mysql -u root asterisk < mysql-v5_enum.sql```
- TFTP Server running under (recommended) /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"
@ -65,28 +68,30 @@ apt-get install PHP7.3-zip
How to install sccp_manager
-----
1. Log in to FreePBX
2. Go to Admin -> Module Admin
3. Click Upload Modules.
4. Enter one of the following urls:
1. Creating mysql DB from source using
```
mysql -p asterisk < /usr/src/chan-sccp/conf/mysql-v5_enum.sql
```
2. Create a new tab and log in to FreePBX
3. Go to Admin -> Module Admin
4. Click Upload Modules.
5. Enter one of the following urls:
Stable
```
https://github.com/chan-sccp/sccp_manager/archive/refs/heads/Legacy.zip
https://github.com/chan-sccp/sccp_manager/archive/refs/tags/Legacy-v2.tar.gz
```
Develop.
This version can be updated through module admin as modifications are made (pending fix by FreePbx)
_This is development software and so may have issues_
Develop. _This module can be updated through module admin as modifications are made, but may still have issues_
```
https://github.com/chan-sccp/sccp_manager/archive/refs/heads/develop.zip
```
5. Click Download From Web.
6. Click Manage Local Modules.
7. Find and click SCCP Manager. Check Install. Click Process button.
8. Confirm installation.
9. Close Status window.
10. Apply Config to FreePBX.
11. Continue to [Using-SCCP_Manager-to-Manage-chan-sccp](https://github.com/chan-sccp/chan-sccp/wiki/Using-SCCP_Manager-to-Manage-chan-sccp)
6. Click Download From Web.
7. Click Manage Local Modules.
8. Find and click SCCP Manager. Check Install. Click Process button.
9. Confirm installation.
10. Close Status window.
11. Apply Config to FreePBX.
12. Continue to [Using-SCCP_Manager-to-Manage-chan-sccp](https://github.com/chan-sccp/chan-sccp/wiki/Using-SCCP_Manager-to-Manage-chan-sccp)
### Module update to latest state

View file

@ -140,6 +140,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); // Overwrite Exist
// $this->getSccpSetingINI(false); // get from sccep.ini
$this->initializeSccpPath();
$this->initVarfromDefs();
$this->initTftpLang();
@ -163,10 +164,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->initVarfromXml(); // Overwrite Exist
}
//if (get_class($freepbx) === 'FreePBX') {
if (get_class($freepbx) === 'FreePBX') {
// only save settings when building a new FreePBX object
$this->saveSccpSettings();
//}
}
}
/*
@ -201,10 +202,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
}
}
// Check timezone has not been changed in FreePBX and update if has
if ($this->sccpvalues['ntp_timezone'] != \date_default_timezone_get()) {
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => \date_default_timezone_get());
}
}
/*
@ -569,7 +566,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$db_field = $this->dbinterface->HWextension_db_SccpTableData("get_columns_sccpdevice");
$hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid'];
$hw_type = (empty($get_settings['sccp_device_typeid'])) ? 'sccpdevice' : $get_settings['sccp_device_typeid'];
$update_hw = ($hw_id == 'new') ? 'add' : 'clear'; // Possible values are delete, replace, add, clear.
$update_hw = ($hw_id == 'new') ? 'update' : 'clear';
$hw_prefix = 'SEP';
if (!empty($get_settings[$hdr_prefix . 'type'])) {
$value = $get_settings[$hdr_prefix . 'type'];
@ -765,9 +762,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case 'sccp_ntp_timezone':
$tz_id = $value;
$TZdata = $this->extconfigs->getextConfig('sccp_timezone', $tz_id);
$TZdata = $this->extconfigs->getextConfig('sccp_timezone_offset', $tz_id);
if (!empty($TZdata)) {
$value = $TZdata['offset']/60;
$value = ($TZdata / 60);
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
$save_settings[] = array('keyword' => 'tzoffset', 'data' => $value,
'seq' => '98',
@ -777,6 +774,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break;
}
}
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
@ -1071,7 +1069,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
$driver = $this->FreePBX->Core->getAllDriversInfo();
// Below is always set to replace; good for Develop, but needs to be updated for release
$sccp_driver_replace = '';
if (empty($driver['sccp'])) {
$sccp_driver_replace = 'yes';
@ -1087,7 +1084,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->sccpvalues['sccp_compatible'] = array('keyword' => 'sccp_compatible', 'data' => $ver_id, 'type' => '1', 'seq' => '99');
$this->sccppath = $this->extconfigs->validate_init_path($confDir, $this->sccpvalues, $sccp_driver_replace);
$driver = $this->FreePBX->Core->getAllDriversInfo(); // Check that Sccp Driver has been updated by above
$driver = $this->FreePBX->Core->getAllDriversInfo(); // ??????
$read_config = $this->cnf_read->getConfig('sccp.conf');
$this->sccp_conf_init['general'] = $read_config['general'];
@ -1182,7 +1179,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$buton_list = $this->dbinterface->HWextension_db_SccpTableData("get_sccpdevice_buttons", array('buttontype' => 'speeddial'));
}
if (empty($buton_list)) {
return array('Response' => ' 0 buttons found ', 'data' => '');
return array('Response' => ' Found 0 device ', 'data' => '');
}
$copy_fld = array('ref', 'reftype', 'instance', 'buttontype');
$user_list = $user_list = $this->dbinterface->get_db_SccpTableByID("SccpExtension", array(), 'name');

View file

@ -25,7 +25,37 @@ $(document).ready(function () {
}
});
// ajaxsubmit2 is "Save and continue" - saves form data and stays on form
/*
$('#ajaxbackup').on('click', function (e) {
var vdata = '';
var snd_command = 'backupsettings';
$('.fpbx-submit').each(function () {
vdata = vdata + $(this).serialize() + '&';
});
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
data: vdata,
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
} else {
alert('Data Save');
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
});
*/
$('#ajaxsubmit2').on('click', function (e) {
var vdata = '';
var snd_command = 'savesettings';
@ -55,7 +85,7 @@ $(document).ready(function () {
if (data.message) {
bs_alert(data.message,data.status);
} else {
fpbxToast(_('Data saved'),_('Data saved'), 'success');
bs_alert('Data Save',data.status);
}
} else {
bs_alert(data.message,data.status);
@ -63,7 +93,7 @@ $(document).ready(function () {
}
});
});
// ajaxsubmit is save and close form
$('#ajaxsubmit').on('click', function (e) {
var vdata = '';
var snd_command = 'savesettings';
@ -88,6 +118,9 @@ $(document).ready(function () {
data: vdata,
success: function (data) {
if (data.status === true) {
if (data.message) {
var old_style = bs_alert(data.message, data.status, data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
@ -103,12 +136,9 @@ $(document).ready(function () {
if (data.search != null) {
location.search = data.search;
}
if (data.message) {
fpbxToast(_('Configuration saved. Reloading Module'),_('Configuration saved'), 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
}
// if (data.reload === true ) {
if (data.reload === true && old_style ===true ) {
location.reload();
}
} else {
bs_alert(data.message,data.status);
@ -153,23 +183,23 @@ $(document).ready(function () {
}
// console.log("delete : " + data);
if (dev_cmd != '') {
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" information?'))) {
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" inormation ?'))) {
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
command: dev_cmd,
data: ext_data,
success: function (data) {
// console.log(data);
if (data.status === true) {
if (data.message) {
var old_style = bs_alert(data.message, data.status, data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
}
if (data.reload === true && old_style === true ) {
location.reload();
}
} else {
bs_alert(data.message,data.status);
@ -580,13 +610,13 @@ $(document).ready(function () {
var i = 0;
var conf_msg = '??????';
if ($(this).data('id') === 'reset_dev') {
conf_msg = 'Reset ALL devices ?';
conf_msg = 'Reset All device ?';
}
if ($(this).data('id') === 'reset_token') {
conf_msg = 'Reset Token on ALL devices ?';
conf_msg = 'Reset Token on All device ?';
}
if ($(this).data('id') === 'update_button_label') {
conf_msg = 'Update Button Labels on ALL devices ?';
conf_msg = 'Update Butons Labels on All device ?';
}
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
@ -615,24 +645,24 @@ $(document).ready(function () {
success: function (data) {
// console.log(data);
if (data.status === true) {
if (data.message) {
var old_style = bs_alert(data.message, data.status,data.reload);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
}
if (data.reload === true && old_style === true) {
location.reload();
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(data.message[1],_('Error Result'), 'warning');
bs_alert(entry,data.status);
//fpbxToast(entry, 'error', 'error');
});
} else {
if (data.message) {
fpbxToast(data.message,_('Error Result'), 'warning');
bs_alert(data.message,data.status);
} else {
if (data) {
bs_alert(data,data.status);

319
conf/Sccp.class.php Normal file
View file

@ -0,0 +1,319 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X
//
// Templete for Sccp Driver
//
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'description',
"musicclass" => 'musicclass',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup'
);
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP",
"description" => _("Sccp Device"),
"Version" => "11.4",
"about" => "Sccp mysql class Base ver: 11.3, Sccp ver: default"
);
}
/* 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();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value']='';
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
$sql = 'INSERT INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
$sql .= ', '.$key;
$sqlv .= ", '".$settings[$val]['value']."' ";
}
}
}
$sql .= ") ".$sqlv.");";
$sth = $this->database->prepare($sql);
$sth->execute();
return true;
}
public function delDevice($id) {
$sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
$sccp_line = array();
// $sql = "SELECT name as id, name as name";
$sql = "SELECT name as id, name as name ";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
$sql .= " FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result;
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"pin" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "",
"flag" => $flag++
),
"lcontext" => array(
"value" => "from-internal",
"flag" => $flag++
),
"callgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
"pickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"transfer" => array(
"value" => "yes",
"flag" => $flag++
),
"adhocNumber" => array(
"value" => "",
"flag" => $flag++
),
"echocancel" => array(
"value" => "no",
"flag" => $flag++
),
"dnd" => array(
"value" => "UserDefined",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "no",
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
# !TODO!: -TODO-: Would it not be better to put this part in the view directory (MVC) ? No, This is a template for Freepbx.
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("Settings");
$category = "general";
$tmparr = array();
$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 which this line will use to send and receive calls (Note: Only change this is you know what you are doing).");
$tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: Maybe completely remove support for old numberic callgroup/pickupgroup in favor of the named version ? See Sccp.class.php.v431
$tt = _("Phone call group (numeric only, example:1,3-4)");
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431
$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);
// !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431
$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);
$tt = _("Phone pincode (Note used)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)");
$tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1);
unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone');
$select[] = array( 'value' => '0x22', 'text' => 'Outside Dial Tone');
$select[] = array( 'value' => '0x23', 'text' => 'Line Busy Tone');
$select[] = array( 'value' => '0x24', 'text' => 'Alerting Tone');
$select[] = array( 'value' => '0x25', 'text' => 'Reorder Tone');
$select[] = array( 'value' => '0x26', 'text' => 'Recorder Warning Tone');
$select[] = array( 'value' => '0x27', 'text' => 'Recorder Detected Tone');
$select[] = array( 'value' => '0x28', 'text' => 'Reverting Tone');
$select[] = array( 'value' => '0x29', 'text' => 'Receiver OffHook Tone');
$select[] = array( 'value' => '0x2A', 'text' => 'Partial Dial Tone');
$select[] = array( 'value' => '0x2B', 'text' => 'No Such Number Tone');
$select[] = array( 'value' => '0x2C', 'text' => 'Busy Verification Tone');
$select[] = array( 'value' => '0x2D', 'text' => 'Call Waiting Tone');
$select[] = array( 'value' => '0x2E', 'text' => 'Confirmation Tone');
$select[] = array( 'value' => '0x2F', 'text' => 'Camp On Indication Tone');
$select[] = array( 'value' => '0x30', 'text' => 'Recall Dial Tone');
$select[] = array( 'value' => '0x31', 'text' => 'Zip Zip');
$select[] = array( 'value' => '0x32', 'text' => 'Zip');
$select[] = array( 'value' => '0x33', 'text' => 'Beep Bonk');
$select[] = array( 'value' => '0x34', 'text' => 'Music Tone');
$select[] = array( 'value' => '0x35', 'text' => 'Hold Tone');
$select[] = array( 'value' => '0x36', 'text' => 'Test Tone');
$select[] = array( 'value' => '0x37', 'text' => 'DT Monitor Warning Tone');
$select[] = array( 'value' => '0x40', 'text' => 'Add Call Waiting');
$select[] = array( 'value' => '0x41', 'text' => 'Priority Call Wait');
$select[] = array( 'value' => '0x42', 'text' => 'Recall Dial');
$select[] = array( 'value' => '0x43', 'text' => 'Barg In');
$select[] = array( 'value' => '0x44', 'text' => 'Distinct Alert');
$select[] = array( 'value' => '0x45', 'text' => 'Priority Alert');
$select[] = array( 'value' => '0x46', 'text' => 'Reminder Ring');
$select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank');
$select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone');
$select[] = array( 'value' => '0x67', 'text' => '2105 HZ');
$select[] = array( 'value' => '0x68', 'text' => '2600 HZ');
$select[] = array( 'value' => '0x69', 'text' => '440 HZ');
$select[] = array( 'value' => '0x6A', 'text' => '300 HZ');
$select[] = array( 'value' => '0x77', 'text' => 'MLPP Pala');
$select[] = array( 'value' => '0x78', 'text' => 'MLPP Ica');
$select[] = array( 'value' => '0x79', 'text' => 'MLPP Vca');
$select[] = array( 'value' => '0x7A', 'text' => 'MLPP Bpa');
$select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea');
$select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa');
/* !TODO!: +TODO+: I would remove the values below this line, except for 'No Tone' */
// $select[] = array( 'value' => '0x7F', 'text' => 'No Tone');
$select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone');
$select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone');
$select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed Tone');
$select[] = array( 'value' => '0x83', 'text' => 'Meetme Enter Pin Tone');
$select[] = array( 'value' => '0x84', 'text' => 'Meetme Invalid Pin Tone');
$select[] = array( 'value' => '0x85', 'text' => 'Meetme Failed Pin Tone');
$select[] = array( 'value' => '0x86', 'text' => 'Meetme CFB Failed Tone');
$select[] = array( 'value' => '0x87', 'text' => 'Meetme Enter Access Code Tone');
$select[] = array( 'value' => '0x88', 'text' => 'Meetme Access Code Invalid Tone');
$select[] = array( 'value' => '0x89', 'text' => 'Meetme Access Code Failed Tone');
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Outside dialtone frequency (defaul 0x22)");
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select');
# !TODO!: -TODO-: is there no easier way to specify a boolean radio group ? No.
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Allow call transfer.");
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'UserDefined', 'text' => 'UserDefined');
# !TODO!: -TODO-: The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour
# !TODO!: -TODO-: Userdefined is also a possible state, but it is not used or implemented (and it should not be implemented here, i think). See Sccp.class.php.v431, See Sccp.class.php - Old Style
$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>'.
_("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<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)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not supported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){
$moh_list = music_list();
} else {
$moh_list = array('default');
}
foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
$tt = _("Music on hold");
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1);
$devopts = $tmparr;
return $devopts;
}
}

View file

@ -31,14 +31,25 @@ class Sccp extends \FreePBX\modules\Core\Driver {
);
}
/* 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();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) {
global $currentcomponent;
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value'] = '';
$settings['cid_name']['value'] = '';
$settings['cid_name']['value'] = $label;
$settings['mailbox']['value']= '';
// Add $_REQUEST values to settings
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
@ -54,8 +65,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
}
$settings['allow']['value'] = implode(",", $allow_codec);
// If set, parse outboundcid content into cid_num and cid_name sccpline fields
if (!empty($settings['cid_num']['value'])) {
// parse outboundcid content into cid_num and cid_name sccpline fields
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value'] = $id;
} else {
$outboundcid = $settings['cid_num']['value'];
if (preg_match('/"(.*)"\s?<(.*)>/', $outboundcid, $matches)) {
$settings['cid_num']['value'] = $matches[2];
@ -71,6 +84,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
}
}
// die(print_r($settings));
$tech = Array();
$sql = "DESCRIBE sccpline";
foreach ($this->database->query($sql) as $row) {
@ -88,15 +102,6 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$sth = $this->database->prepare($sql);
$sth->execute();
/*
If called from SCCP Phone, redirect to SCCP Phone page on submit.
This was last function in add so should be safe.
Prefer to add in Hooks, but is not followed even if set for $currentcomponent
Do nothing if called from QuickCreateExtension when display is not set
*/
if (isset($_REQUEST['display'])) {
redirect("config.php?display=sccp_phone", false);
}
return true;
}

1018
conf/sccpgeneral.xml Normal file

File diff suppressed because it is too large Load diff

View file

@ -492,7 +492,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Enable NTP settings in device configuration.</help>
<help>Enabling NTP settings in device configuration.</help>
</item>
<item type="IE" id="2" seq="10">
<label>NTP Server name (ip)</label>
@ -501,7 +501,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>pool.ntp.org</default>
<value>pool.ntp.org</value>
</input>
<help>NTP Server name or IP address</help>
<help>NTP Server name or IP</help>
</item>
<item type="IS" id="3" seq="10">
<name>ntp_server_mode</name>
@ -532,7 +532,7 @@ and open the template in the editor. Base Version before all crash :-)
<select>
<default>UTC</default>
</select>
<help>System Time zone - this is set by FreePBX and can be changed in Settings : Advanced Settings</help>
<help>Date Format: Time zone</help>
</item>
</page_group>

View file

@ -45,7 +45,7 @@ $db_config = Get_DB_config($sccp_compatible);
$sccp_db_ver = CheckSCCPManagerDBVersion();
// BackUp Old config
createBackUpConfig();
CreateBackUpConfig();
RenameConfig();
InstallDB_updateSchema($db_config);
@ -708,7 +708,7 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible)
}
return true;
}
function createBackUpConfig()
function CreateBackUpConfig()
{
global $amp_conf;
outn("<li>" . _("Creating Config BackUp") . "</li>");
@ -718,7 +718,7 @@ function createBackUpConfig()
$dir = $cnf_int->get('ASTETCDIR');
$fsql = $dir.'/sccp_backup_'.date("Ymd").'.sql';
$result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$fsql);
$result = exec('mysqldump '.$amp_conf['AMPDBNAME'].' --password='.$amp_conf['AMPDBPASS'].' --user='.$amp_conf['AMPDBUSER'].' --single-transaction >'.$fsql, $output);
try {
$zip = new \ZipArchive();
@ -744,7 +744,7 @@ function createBackUpConfig()
outn("<li>" . _("Error Creating BackUp: ") . $filename ."</li>");
}
unlink($fsql);
outn("<li>" . _("Config backup created: ") . $filename ."</li>");
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
}
function RenameConfig()
@ -793,23 +793,18 @@ function Setup_RealTime()
// Check extconfig file for correct connector values
$ext_conf = '';
$ext_conf_file = '';
$ext_conf_file = 'extconfig.conf';
$backup_ext = array('_custom.conf', '_additional.conf','.conf');
foreach ($backup_ext as $value) {
if (file_exists($dir . '/extconfig' . $value)) {
// Last possibility is normal file extconfig.conf
$ext_conf_file = 'extconfig' . $value;
$ext_conf_file = 'extconfig' . $value;
$ext_conf = $cnf_read->getConfig($ext_conf_file);
break;
}
}
if (empty($ext_conf_file)) {
// Have not found a file, so will need to create. $ext_conf must be empty
$ext_conf_file = 'extconfig.conf';
}
if (!empty($ext_conf)) {
// Have found a file and read a config. Now need to check required settings
$currentExtSettings = array();
$writeExtSettings = $ext_conf;
if (empty($ext_conf['settings']['sccpdevice']) || ($ext_conf['settings']['sccpdevice'] !== $def_ext_config['sccpdevice'])) {
@ -821,15 +816,9 @@ function Setup_RealTime()
$writeExtSettings['settings']['sccpline'] = $def_ext_config['sccpline'];
}
if (!empty($writeExtSettings)) {
outn("<li>" . _("Updating extconfig file ... ") . $ext_conf_file . "</li>");
outn("<li>" . _("Updating extconfig file ...") . "</li>");
$cnf_wr->writeConfig($ext_conf_file, $writeExtSettings);
}
} else {
// Either did not find file or file did not contain any config, so create and fill
outn("<li>" . _("Creating extconfig file ... ") . $ext_conf_file . "</li>");
$writeExtSettings['settings']['sccpdevice'] = $def_ext_config['sccpdevice'];
$writeExtSettings['settings']['sccpline'] = $def_ext_config['sccpline'];
$cnf_wr->writeConfig($ext_conf_file, $writeExtSettings);
}
// Check database settings

View file

@ -1,7 +1,7 @@
<module>
<rawname>sccp_manager</rawname>
<name>SCCP Manager</name>
<version>14.2.0.10</version>
<version>14.2.0.1</version>
<type>setup</type>
<category>Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher>
@ -18,11 +18,6 @@
* Version 14.0.0.1 * - Alfa Release new DB structure Add User mobility
* Version 14.1.0.1 * - Migrated to chan-sccp repo
* Version 14.2.0.1 * - Retired old interface - min chan-sccp v433
* Version 14.2.0.2 * - Fix module database definition
* Version 14.2.0.5 * - Replace Modals with fpbxToast
* Version 14.2.0.8 * - Fix uninstaller and create backup
* Version 14.2.0.9 * - Bug Fix - incorrect response class for Reset Token Device
* Version 14.2.0.10 * - Bug Fix - line not assigned on device creation
</changelog>
<location>https://github.com/chan-sccp/sccp_manager</location>
<supported>
@ -34,7 +29,7 @@
<md5sum></md5sum>
<database>
<table name="sccpdevice">
<field name="name" type="string" length="15" primarykey="true"/>
<field name="name" type="string" length="15" default="" primarykey="true"/>
<field name="type" type="string" length="15" notnull="false"/>
<field name="addon" type="string" length="45" notnull="false"/>
<field name="_description" type="string" length="45" notnull="false"/>
@ -120,7 +115,7 @@
<field name="dnd" type="string" default="reject" notnull="false"/>
<field name="videomode" type="string" default="auto" notnull="false"/>
<field name="setvar" type="string" length="50" notnull="false"/>
<field name="name" type="string" length="40" primarykey="true"/>
<field name="name" type="string" length="40" default="" primarykey="true"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<key name="id" type="unique">
<column name="id"/>
@ -131,7 +126,7 @@
<field name="ref" type="string" length="15" default="" primarykey="true"/>
<field name="reftype" type="string" length="15" default="sccpdevice" primarykey="true"/>
<field name="instance" type="boolean" default="0" primarykey="true"/>
<field name="buttontype" type="string" length="190" default="line" primarykey="true"/>
<field name="buttontype" type="string" default="line" primarykey="true"/>
<field name="name" type="string" length="36" notnull="false"/>
<field name="options" type="string" length="100" notnull="false"/>
<key name="ref" type="index">
@ -140,11 +135,11 @@
</key>
</table>
<table name="sccpdevmodel">
<field name="model" type="string" length="20" primarykey="true"/>
<field name="vendor" type="string" length="40" notnull="false"/>
<field name="model" type="string" length="20" default="" primarykey="true"/>
<field name="vendor" type="string" length="40" default="" notnull="false"/>
<field name="dns" type="integer" default="1" notnull="false"/>
<field name="buttons" type="integer" default="0" notnull="false"/>
<field name="loadimage" type="string" length="40" notnull="false"/>
<field name="loadimage" type="string" length="40" default="" notnull="false"/>
<field name="loadinformationid" type="string" length="30" notnull="false"/>
<field name="enabled" type="integer" default="0" notnull="false"/>
<field name="nametemplate" type="string" length="50" notnull="false"/>

View file

@ -392,7 +392,7 @@ class SCCPTokenAckAction extends ActionMessage
{
parent::__construct('SCCPTokenAck');
$this->setKey('DeviceId', $DeviceName);
$this->setResponseHandler("Generic");
$this->setResponseHandler("SCCPGeneric");
}
}

View file

@ -415,7 +415,7 @@ class aminterface
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPDeviceRestartAction($devicename, $action);
}
$_response = $this->send($_action);
$result['data'] = 'Device: '.$devicename.' Result: '.$_response->getMessage();
$result['data'] = 'Device :'.$devicename.' Result: '.$_response->getMessage();
$result['Response']=$_response->getKey('Response');
}
return $result;

View file

@ -239,6 +239,7 @@ class dbinterface
// mode update - update / replace record
$dbh = \FreePBX::Database();
$result = false;
$delete_value = array();
switch ($table_name) {
case 'sccpsettings':
if ($mode == 'replace') { // Change mode name to be more transparent
@ -249,8 +250,9 @@ class dbinterface
}
foreach ($save_value as $key => $dataArr) {
if (!empty($dataArr) && isset($dataArr['data'])) {
if (empty($dataArr['data'])) {
continue;
if ($dataArr['data'] == $this->val_null) {
$delete_value[] = $save_value[$key]['keyword'];
break;
}
}
$stmt->bindParam(':keyword',$dataArr['keyword'],\PDO::PARAM_STR);
@ -259,6 +261,13 @@ class dbinterface
$stmt->bindParam(':type',$dataArr['type'],\PDO::PARAM_INT);
$result = $stmt->execute();
}
if (!empty($delete_value)) {
$stmt = $dbh->prepare('DELETE FROM sccpsettings WHERE keyword = :keyword');
foreach ($delete_value as $del_key) {
$stmt->bindParam(':keyword',$del_key,\PDO::PARAM_STR);
$result = $stmt->execute();
}
}
break;
case 'sccpdevmodel': // Fall through to next intentionally
case 'sccpdevice': // Fall through to next intentionally

View file

@ -14,13 +14,15 @@ class extconfigs
$this->paren_class = $parent_class;
}
public function info() {
$Ver = '13.1.1';
public function info()
{
$Ver = '13.0.3';
return array('Version' => $Ver,
'about' => 'Default Setings and Enums ver: ' . $Ver);
}
public function getextConfig($id = '', $index = '') {
public function getextConfig($id = '', $index = '')
{
switch ($id) {
case 'keyset':
$result = $this->keysetdefault;
@ -31,47 +33,64 @@ class extconfigs
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone': // Sccp manager: 1303; server_info: 122
case 'sccp_timezone_offset': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
if (empty($index)) {
return 0;
}
if (array_key_exists($index, $this->cisco_timezone)) {
$tmp_time = $this->get_cisco_time_zone($index);
return $tmp_time['offset'];
}
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
$tmp_ofset = $tmp_dt->getOffset();
return $tmp_ofset / 60;
break;
case 'sccp_timezone': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
$result = array();
if (empty($index)) {
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
}
if (array_key_exists($index, $this->cisco_timezone)) {
return $this->get_cisco_time_zone($index);
} else {
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
//See if DST is used in this TZ. Test if DST setting is different at
//various future intervals. If dst changes, this TZ uses dst
$usesDaylight = false;
$haveDstNow = date('I');
$futureDateArray = array(2,4,6,8);
foreach ($futureDateArray as $numMonths) {
$futureDate = (new \DateTime(null,new \DateTimeZone($index)))->modify("+{$numMonths} months");
if ($futureDate->format('I') != $haveDstNow) {
$usesDaylight = true;
break;
};
}
$thisTzOffset = (new \DateTime(null, new \DateTimeZone($index)))->getOffset();
// Now look for a match in cisco_tz_array based on offset and DST
// First correct offset if we have DST now as cisco offsets are
// based on non dst offsets
$tmpOffset = $thisTzOffset / 60;
if ($haveDstNow) {
$tmpOffset = $tmpOffset - 60;
}
foreach ($this->cisco_timezone as $key => $value) {
if (($value['offset'] == $tmpOffset) and ( $value['daylight'] == $usesDaylight )) {
// This code may not be the one typically used, but it has the correct values.
$cisco_code = $key . ' Standard' . (($usesDaylight) ? '/Daylight' : '') . ' Time';
$this->sccpvalues['tzoffset']['data'] = $tmpOffset;
return array('offset' => $tmpOffset, 'daylight' => ($usesDaylight) ? 'Daylight' : '', 'cisco_code' => $cisco_code);
break;
$tz_tmp = array();
foreach ($timezone_abbreviations as $subArray) {
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
if (!empty($tf_idt)) {
$tz_tmp[] = $subArray[$tf_idt];
}
}
if (empty($tz_tmp)) {
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
}
}
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
if (count($tz_tmp)==1) {
$time_set = $tz_tmp[0];
} else {
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
$tmp_ofset = $tmp_dt->getOffset();
foreach ($tz_tmp as $subArray) {
if ($subArray['offset'] == $tmp_ofset) {
$time_set = $subArray;
break;
}
}
}
$tmp_ofset = $time_set['offset'] / 60;
$tmp_dli = (empty($time_set['dst']) ? '' : 'Daylight' );
foreach ($this->cisco_timezone as $key => $value) {
if (($value['offset'] == $tmp_ofset) and ( $value['daylight'] == $tmp_dli )) {
return $this->get_cisco_time_zone($key);
break;
}
}
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
}
break;
default:
return array('noId');
@ -90,8 +109,16 @@ class extconfigs
private function get_cisco_time_zone($tzc)
{
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
return array();
}
$tzdata = $this->cisco_timezone[$tzc];
$cisco_code = $tzc . ' Standard' . (($tzdata['daylight']) ? '/Daylight' : '') . ' Time';
$cisco_code = $tzc . ' Standard' . ((empty($tzdata['daylight'])) ? '' : '/' . $tzdata['daylight']) . ' Time';
if (isset($tzdata['cisco_code'])) {
$cisco_code = (empty($tzdata['cisco_code'])) ? $cisco_code : $tzdata['cisco_code'];
}
return array('offset' => $tzdata['offset'], 'daylight' => $tzdata['daylight'], 'cisco_code' => $cisco_code);
}
@ -167,53 +194,74 @@ class extconfigs
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan', 'codepage' => 'ISO8859-1')
);
private $cisco_timezone = array(
'Dateline' => array('offset' => '-720', 'daylight' => false),
'Samoa' => array('offset' => '-660', 'daylight' => false),
'Hawaiian' => array('offset' => '-600', 'daylight' => false),
'Alaskan' => array('offset' => '-540', 'daylight' => true),
'Pacific' => array('offset' => '-480', 'daylight' => true),
'Mountain' => array('offset' => '-420', 'daylight' => true),
'US Mountain' => array('offset' => '-420', 'daylight' => false),
'Central' => array('offset' => '-360', 'daylight' => true),
'Mexico' => array('offset' => '-360', 'daylight' => true),
'Canada Central' => array('offset' => '-360', 'daylight' => false),
'SA Pacific' => array('offset' => '-300', 'daylight' => false),
'Eastern' => array('offset' => '-300', 'daylight' => true),
'US Eastern' => array('offset' => '-300', 'daylight' => false),
'Atlantic' => array('offset' => '-240', 'daylight' => true),
'SA Western' => array('offset' => '-240', 'daylight' => false),
'Pacific SA' => array('offset' => '-240', 'daylight' => false),
'Newfoundland' => array('offset' => '-210', 'daylight' => true),
'E. South America' => array('offset' => '-180', 'daylight' => true),
'SA Eastern' => array('offset' => '-180', 'daylight' => false),
'Pacific SA' => array('offset' => '-180', 'daylight' => true),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => true),
'Azores' => array('offset' => '-060', 'daylight' => true),
'GMT' => array('offset' => '00', 'daylight' => true),
'Greenwich' => array('offset' => '00', 'daylight' => false),
'W. Europe' => array('offset' => '60', 'daylight' => true),
'Central Europe' => array('offset' => '120', 'daylight' => true),
'South Africa' => array('offset' => '120', 'daylight' => false),
'Saudi Arabia' => array('offset' => '180', 'daylight' => false),
'Iran' => array('offset' => '210', 'daylight' => true),
'Caucasus' => array('offset' => '240', 'daylight' => true),
'Arabian' => array('offset' => '240', 'daylight' => false),
'Afghanistan' => array('offset' => '270', 'daylight' => false),
'West Asia' => array('offset' => '300', 'daylight' => false),
'India' => array('offset' => '330', 'daylight' => false),
'Central Asia' => array('offset' => '360', 'daylight' => false),
'SE Asia' => array('offset' => '420', 'daylight' => false),
'China' => array('offset' => '480', 'daylight' => false),
'Tokyo' => array('offset' => '540', 'daylight' => false),
'Cen. Australia' => array('offset' => '570', 'daylight' => true),
'AUS Central' => array('offset' => '570', 'daylight' => false),
'E. Australia' => array('offset' => '600', 'daylight' => false),
'AUS Eastern' => array('offset' => '600', 'daylight' => true),
'West Pacific' => array('offset' => '600', 'daylight' => false),
'Tasmania' => array('offset' => '600', 'daylight' => true),
'Central Pacific' => array('offset' => '660', 'daylight' => false),
'Fiji' => array('offset' => '720', 'daylight' => false),
'New Zealand' => array('offset' => '720', 'daylight' => true)
'Dateline' => array('offset' => '-720', 'daylight' => ''),
'Samoa' => array('offset' => '-660', 'daylight' => ''),
'Hawaiian' => array('offset' => '-600', 'daylight' => ''),
'Alaskan' => array('offset' => '-540', 'daylight' => 'Daylight'),
'Pacific' => array('offset' => '-480', 'daylight' => 'Daylight'),
'Mountain' => array('offset' => '-420', 'daylight' => 'Daylight'),
'US Mountain' => array('offset' => '-420', 'daylight' => ''),
'Central' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Mexico' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Canada Central' => array('offset' => '-360', 'daylight' => ''),
'SA Pacific' => array('offset' => '-300', 'daylight' => ''),
'Eastern' => array('offset' => '-300', 'daylight' => 'Daylight'),
'US Eastern' => array('offset' => '-300', 'daylight' => ''),
'Atlantic' => array('offset' => '-240', 'daylight' => 'Daylight'),
'SA Western' => array('offset' => '-240', 'daylight' => ''),
'Pacific SA' => array('offset' => '-240', 'daylight' => ''),
'Newfoundland' => array('offset' => '-210', 'daylight' => 'Daylight'),
'E. South America' => array('offset' => '-180', 'daylight' => 'Daylight'),
'SA Eastern' => array('offset' => '-180', 'daylight' => ''),
'Pacific SA' => array('offset' => '-180', 'daylight' => 'Daylight'),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => 'Daylight'),
'Azores' => array('offset' => '-060', 'daylight' => 'Daylight'),
'GMT' => array('offset' => '00', 'daylight' => 'Daylight'),
'Greenwich' => array('offset' => '00', 'daylight' => ''),
'W. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'GTB' => array('offset' => '60', 'daylight' => 'Daylight'),
'Egypt' => array('offset' => '60', 'daylight' => 'Daylight'),
'E. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'Romance' => array('offset' => '120', 'daylight' => 'Daylight'),
'Central Europe' => array('offset' => '120', 'daylight' => 'Daylight'),
'South Africa' => array('offset' => '120', 'daylight' => ''),
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
/* Russian Regions */
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'),
'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/Samara' => array('offset' => '240', 'daylight' => '', 'cisco_code' => 'Arabian Standard Time'),
'Russian/Novosibirsk' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Ekaterinburg' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Irkutsk' => array('offset' => '480', 'daylight' => '', 'cisco_code' => 'China Standard Time'),
'Russian/Yakutsk' => array('offset' => '540', 'daylight' => '', 'cisco_code' => 'Tokyo Standard Time'),
'Russian/Khabarovsk' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Vladivostok' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Sakhalin' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
/* EnD - Russian Regions */
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
'Arabian' => array('offset' => '240', 'daylight' => ''),
'Afghanistan' => array('offset' => '270', 'daylight' => ''),
'West Asia' => array('offset' => '300', 'daylight' => ''),
'India' => array('offset' => '330', 'daylight' => ''),
'Central Asia' => array('offset' => '360', 'daylight' => ''),
'SE Asia' => array('offset' => '420', 'daylight' => ''),
'China' => array('offset' => '480', 'daylight' => ''),
'Taipei' => array('offset' => '480', 'daylight' => ''),
'Tokyo' => array('offset' => '540', 'daylight' => ''),
'Cen. Australia' => array('offset' => '570', 'daylight' => 'Daylight'),
'AUS Central' => array('offset' => '570', 'daylight' => ''),
'E. Australia' => array('offset' => '600', 'daylight' => ''),
'AUS Eastern' => array('offset' => '600', 'daylight' => 'Daylight'),
'West Pacific' => array('offset' => '600', 'daylight' => ''),
'Tasmania' => array('offset' => '600', 'daylight' => 'Daylight'),
'Central Pacific' => array('offset' => '660', 'daylight' => ''),
'Fiji' => array('offset' => '720', 'daylight' => ''),
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
);
public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace = '')
@ -346,14 +394,14 @@ class extconfigs
}
}
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
if (!file_exists($dst) || $sccp_driver_replace == 'yes') {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $db_vars['sccp_compatible']['data'];
if (file_exists($src_path)) {
copy($src_path, $dst);
} else {
// Set new default
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v433';
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst);
copy($src_path, $dst);
}
}

View file

@ -140,7 +140,7 @@ trait ajaxHelper {
case 'reset_dev':
$msg = '';
$msgr = array();
$msgr[] = "Reset command sent to device(s) ";
$msgr[] = 'Reset command send';
if (!empty($request['name'])) {
foreach ($request['name'] as $idv) {
$msg = strpos($idv, 'SEP-');
@ -153,14 +153,13 @@ trait ajaxHelper {
$msgr[] = $msg . ' ' . $res['Response'] . ' ' . $res['data'];
}
}
if ($idv == 'all') {
$dev_list = $this->aminterface->sccp_get_active_device();
foreach ($dev_list as $key => $data) {
if ($cmd_id == 'reset_token') {
if (($data['token'] == 'Rej') || ($data['status'] == 'Token ')) {
$res = $this->aminterface->sccpDeviceReset($idv, 'tokenack');
$msgr[] = 'Sent Token reset to :' . $key;
$msgr[] = 'Send Token reset to :' . $key;
}
} else {
$res = $this->aminterface->sccpDeviceReset($idv, 'reset');
@ -170,7 +169,7 @@ trait ajaxHelper {
}
}
}
return array('status' => (($res['Response'] == 'Error')? false : true ), 'message' => $msgr, 'reload' => false, 'table_reload' => true);
return array('status' => true, 'message' => $msgr, 'reload' => true);
break;
case 'update_button_label':
$msg = '';
@ -186,8 +185,8 @@ trait ajaxHelper {
}
}
$res = $this->updateSccpButtons($hw_list);
$msg .= $res['Response'] . (empty($res['data']) ? '' : ' raw data: ' . $res['data'] . ' ');
return array('status' => true, 'message' => 'Update Buttons Labels Complete: ' . $msg, 'reload' => false, 'table_reload' => true);
$msg .= $res['Response'] . ' raw: ' . $res['data'] . ' ';
return array('status' => true, 'message' => 'Update Butons Labels Complite ' . $msg, 'reload' => true);
case 'model_add':
$save_settings = array();
$key_name = array('model', 'vendor', 'dns', 'buttons', 'loadimage', 'loadinformationid', 'nametemplate');

View file

@ -3,40 +3,12 @@
namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait bmoFunctions {
//Need to reload freePBX for modifications below to work
//want to catch extensions
public static function myConfigPageInits() {
return array("extensions");
}
/* unused but FPBX API requires it */
public function doConfigPageInit($page) {
if ($page == "extensions") {
}
$this->doGeneralPost();
}
// Try to change extensions which is part of core
public static function myGuiHooks() {
return array('core');
}
public function doGuiHook(&$cc) {
if ($_REQUEST['display'] == "extensions" ) {
if ($_REQUEST['tech_hardware'] == 'sccp_custom') {
/*
this is the add extensions form
On submit returns to extensions page. Users prefer that it returns
To Sccp Phone.
Below adds redirect URL, but it is not followed
$cc->setRedirectURL("config.php?display=sccp_phone");
so force redirect at end of addDevice in SccpClass
*/
}
}
}
/* unused but FPBX API requires it */
public function install() {
@ -113,21 +85,23 @@ trait bmoFunctions {
'value' => _("Cancel")
),
);
break;
case 'sccpsettings':
$buttons = array(
'submit' => array(
'name' => 'ajaxsubmit',
'id' => 'ajaxsubmit',
'value' => _("Save")
'value' => _("Submit")
),
'reset' => array(
'name' => 'reset',
'id' => 'ajaxcancel',
'data-reload' => 'reload',
'value' => _("Cancel")
'value' => _("Reset")
),
);
break;
}
return $buttons;
@ -135,7 +109,7 @@ trait bmoFunctions {
public function getRightNav($request) {
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
return load_view($_SERVER['DOCUMENT_ROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('request' => $request));
return load_view(__DIR__ . "/views/hardware.rnav.php", array('request' => $request));
}
}

View file

@ -2,20 +2,24 @@
"rawname": "sccp_manager",
"repo": "extended",
"name": "Sccp Manager",
"version": "14.2.0.3",
"version": "14.2.0.2",
"publisher": "Steve Lad",
"license": "GPL",
"licenselink": "http://www.gnu.org/licenses/gpl.txt",
"changelog": "*14.2.0.3* Fix module database definition\n*14.2.0.3* Fix module database definition\n*14.2.0.2* First release of new version without old interface\n*13.0.0.1* Packaging of ver 1.0.0.1\n*12.0.0.1* Packaging of ver 1.0.0.1",
"category": "Sccp Connectivity",
"changelog": [
"*14.2.0.2* First release of new version without old interface",
"*13.0.0.1* Packaging of ver 1.0.0.1",
"*12.0.0.1* Packaging of ver 1.0.0.1"
],
"category": "Settings",
"description": "The Cisco Manager module lets you manage the chan-sccp module.",
"depends": {
"version": "14.0"
"version": "14.0",
},
"supported": {
"version": "13.0"
},
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.2.0.3.tar.gz",
"md5sum": "9aff57a6553a4a3649e056013fe1758f",
"packaged": "1623001021"
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/V14.2.0.2.tar.gz",
"md5sum": "885935a928b29927a2f9006eda20b549",
"packaged": "3362963"
}

View file

@ -1,41 +1,19 @@
<?php
/* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
global $db;
$version = FreePBX::Config()->get('ASTVERSION');
global $sqlTables;
$sqlTables = array('sccpbuttonconfig','sccpdevice','sccpline','sccpuser','sccpsettings','sccpdevmodel');
createBackUpConfig();
function createBackUpConfig()
{
/* !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 */
// !TODO!: -TODO-: I remove only that which is related to the Manager, it is in my opinion not a critical configuration information. This information is partially present in other files.
/*
function CreateBackUpConfig() {
global $amp_conf;
global $sqlTables;
outn("<li>" . _("Creating Config BackUp") . "</li>");
outn("<li>" . _("Create Config BackUp") . "</li>");
$cnf_int = \FreePBX::Config();
$backup_files = array('extensions','extconfig','res_mysql', 'res_config_mysql','sccp','sccp_hardware','sccp_extensions');
$backup_ext = array('_custom.conf', '_additional.conf','.conf');
$backup_files = array('extconfig','extconfig','res_mysql', 'res_config_mysql','sccp');
$backup_ext = array('_custom.conf', '.conf');
$dir = $cnf_int->get('ASTETCDIR');
$sqlTables = array('sccpbuttonconfig','sccpdevice','sccpline','sccpuser','sccpsettings','sccpdevmodel');
$sqlTablesString = implode(' ',$sqlTables);
$sqlBuFile = $dir.'/sccp_backup_'.date("Ymd").'.sql';
$result = exec("mysqldump {$amp_conf['AMPDBNAME']} {$sqlTablesString}
--password={$amp_conf['AMPDBPASS']}
--user={$amp_conf['AMPDBUSER']}
--single-transaction >{$sqlBuFile}");
try {
$zip = new \ZipArchive();
} catch (\Exception $e) {
outn("<br>");
outn("<font color='red'>PHPx.x-zip not installed where x.x is the installed PHP version. Install it before continuing !</font>");
die_freepbx();
}
$zip = new \ZipArchive();
$filename = $dir . "/sccp_uninstall_backup" . date("Ymd"). ".zip";
if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
foreach ($backup_files as $file) {
@ -45,37 +23,59 @@ function createBackUpConfig()
}
}
}
if (file_exists($sqlBuFile)) {
$zip->addFile($sqlBuFile);
}
$zip->close();
} else {
outn("<li>" . _("Error Creating BackUp: ") . $filename ."</li>");
outn("<br>");
outn("<font color='red'>PHPx.x-zip not installed where x.x is the installed PHP version. Install it before continuing !</font>");
die_freepbx();
outn("<li>" . _("Error Create BackUp: ") . $filename ."</li>");
}
unlink($sqlBuFile);
outn("<li>" . _("Config backup created: ") . $filename ."</li>");
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
}
*/
if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
global $db;
$version = FreePBX::Config()->get('ASTVERSION');
out('Removing all Sccp_manager tables');
$tables = array('sccpdevmodel', 'sccpsettings');
foreach ($tables as $table) {
$sql = "DROP TABLE IF EXISTS {$table}";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
unset($result);
}
if (!empty($version)) {
// Woo, we have a version
$check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC);
if (!(DB::IsError($check))) {
outn("<li>" . _("Deleting keys FROM kvstore..") . "</li>");
//print_r("none, creating table :". $value);
echo "Deleting keys FROM kvstore..";
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'");
}
}
// FreePbx removes all tables via module.xml, and uninstaller will error
// If the tables do not exist.
//outn("<li>" . _('Removing all Sccp_manager tables') . "</li>");
//foreach ($sqlTables as $table) {
//$sql = "DROP TABLE IF EXISTS {$table}";
//}
// Still need to handle views as FreePBX does not know about these.
outn("<li>" . _('Removing all Sccp_manager views') . "</li>");
$db->query("DROP VIEW IF EXISTS sccpdeviceconfig");
// By accessing the database, we have recreated sccpsettings table so now delete
// Need to rewrite this uninstaller.
$sql = "DROP TABLE IF EXISTS sccpsettings";
$result = $db->query($sql);
if (DB::IsError($result)) {
die_freepbx($result->getDebugInfo());
}
outn("<li>" . _("Uninstall Complete") . "</li>");
/* Comment: Maybe save in sccpsettings, if the chan_sccp tables already existed in the database or if they were created by install.php */
/* So that you know if it is safe to drop/delete them */
/* DROP VIEW IF EXISTS`sccpdeviceconfig`;
DROP TABLE IF EXISTS `sccpbuttonconfig`;
DROP TABLE IF EXISTS `sccpdevice`;
DROP TABLE IF EXISTS `sccpdevmodel`;
DROP TABLE IF EXISTS `sccpline`;
DROP TABLE IF EXISTS `sccpsettings`;
DROP TABLE IF EXISTS `sccpuser`;
*
*/
}
echo "done<br>\n";
?>

BIN
views/.nfs.2005102d.05d5 Normal file

Binary file not shown.

View file

@ -12,12 +12,12 @@
<div class="display no-border">
<h1><?php echo _("Cisco Dial Template") ?></h1>
<div id="toolbar-sccp-dialtemplate">
<a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&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>
<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&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">
<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> -->
@ -39,4 +39,4 @@
}
return exp_model;
}
</script>
</script>

View file

@ -54,7 +54,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" 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" id="softkey-all" data-unique-id="softkeys">
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&amp;command=getSoftKey&amp;type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" 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" id="softkey-all" data-unique-id="softkeys">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
@ -72,7 +72,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
@ -101,9 +101,9 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
</div></div></div>
<ul class="nav nav-tabs" role="tablist">
<?php
$i = 0;
foreach ($keysetarray as $key => $value) {
@ -129,7 +129,7 @@ foreach ($keysetarray as $key => $value) {
}
echo '<div class="element-container"><div class="row"><div class="form-group"><div class="col-md-3"><label class="control-label" for="'.$key.'">'._($keynamearray[$key]['name']).'</label>';
echo '<i class="fa fa-question-circle fpbx-help-icon" data-for="'.$key.'"></i></div>';
echo '<div class="col-md-4"><select multiple class="form-control sccpmultiselect" name="av_'.$key.'" id="source_'.$key.'">';
$row_dada= explode(',', $value);
foreach ($row_dada as $data) {
@ -145,19 +145,19 @@ foreach ($keysetarray as $key => $value) {
echo '</div></div></div></div>';
$i ++;
}
?>
</div>
?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="keyset_add" data-mode="new" id="keyset_add" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
@ -168,4 +168,4 @@ foreach ($keysetarray as $key => $value) {
}
return exp_model;
}
</script>
</script>

View file

@ -33,7 +33,7 @@
</ul>
</div>
</div>
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&command=getDeviceModel&type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&amp;command=getDeviceModel&amp;type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<thead>
<tr>
<th data-checkbox="true"></th>
@ -263,13 +263,13 @@
function SetColColorFirm(value, row, index) {
if (row['validate'].split(';')[0] === 'no') {
return "File not found<br />" + value;
return 'Not found '+ value;
}
return value;
}
function SetColColorTempl(value, row, index) {
if (row['validate'].split(';')[1] === 'no') {
return "File not found<br /> " + value ;
return 'Not found ' + value ;
}
return value;

View file

@ -946,6 +946,13 @@ foreach ($items as $child) {
}
}
$time_regions = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Russian', 'Indian', 'Pacific');
$time_zone_global = DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC);
$time_zone_ru = array('Russian/Kaliningrad', 'Russian/Moscow', 'Russian/St.Peterburg', 'Russian/Samara', 'Russian/Novosibirsk', 'Russian/Ekaterinburg', 'Russian/Irkutsk', 'Russian/Yakutsk', 'Russian/Khabarovsk', 'Russian/Vladivostok', 'Russian/Sakhalin', 'Russian/Magadan', 'Russian/Kamchatka');
$time_zone_list = array_merge($time_zone_global, $time_zone_ru);
$optgroup = '';
sort($time_zone_list);
if (empty($child->class)) {
$child->class = 'form-control';
}
@ -956,23 +963,45 @@ foreach ($items as $child) {
}
}
$child->value = \date_default_timezone_get();
if (empty($child->value)) {
$child->value = \date_default_timezone_get();
// if (!empty($child->default)){
// $child->value = $child->default;
// }
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <?php
echo $child->value;
?>
</div>
</div>
</div>
</div>
<div class="col-md-9"> <!-- <div class = "lnet form-group form-inline" data-nextid=1> --> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
foreach ($time_zone_list as $opt_key) {
$z = explode('/', $opt_key, 2);
if (count($z) != 2 || !in_array($z[0], $time_regions)) {
continue;
}
if ($optgroup != $z[0]) {
if ($optgroup !== '') {
echo '</optgroup>';
}
$optgroup = $z[0];
echo '<optgroup label="' . htmlentities($z[0]) . '">';
}
echo '<option value="' . htmlentities($opt_key) . '" label="' . htmlentities(str_replace('_', ' ', $z[1])) . '"' . ($opt_key == $child->value ? ' selected="selected" >' : '>'). htmlentities(str_replace('_', ' ', $opt_key)) . '</option>';
}
if ($optgroup !== '') {
echo '</optgroup>';
}
?> </select>
<!-- </div> --> </div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>

View file

@ -18,9 +18,12 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
<div class="display no-border">
<h1><?php echo _("Extensions (Line)") ?></h1>
<div id="toolbar-sccp-extension">
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
<a class="btn btn-default" href="config.php?display=extensions&amp;tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
<button id="remove-sccp-extension" class="btn btn-danger btn-remove" data-type="extensions" data-section="sccp-extension" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" 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-extension" data-id="name">
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&amp;command=getExtensionGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" 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-extension" data-id="name">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
@ -44,7 +47,7 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
if (rmn_dev == 'yes') {
exp_dev += '<a href="config.php?display=sccp_phone&amp;tech_hardware=r_user&amp;ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;';
}
return exp_dev;
return exp_dev;
return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
</script>
</script>

View file

@ -14,7 +14,7 @@
<div class="display no-border">
<h1><?php echo _("Device SCCP Phone") ?></h1>
<div id="toolbar-sccp-phone">
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
@ -31,11 +31,11 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" 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" id="table-sccp" data-id="mac">
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" 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" id="table-sccp" data-id="mac">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></th>
<th data-sortable="true" data-formatter="DispayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="true" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th>
@ -62,7 +62,7 @@
}
}
return exp_model;
}
function DispayDeviceActionsKeyFormatter(value, row, index) {
var exp_model = '';
@ -70,9 +70,9 @@
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
@ -84,7 +84,7 @@
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
@ -94,5 +94,5 @@
}
return result;
}
</script>
</script>

View file

@ -1,24 +1,18 @@
<div id="toolbar-sccp-rnav">
<a class="btn btn-default" href="config.php?display=sccp_phone#sccpdevice">
<i class="fa fa-list"></i>&nbsp;
<?php echo _("List Device")?>
</a>
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco">
<i class="fa fa-plus">&nbsp;</i>
<?php echo _("Add Device")?>
</a>
<div id="toolbar-sccpbnav">
<a href="config.php?display=sccp_phone#sccpdevice" class = "btn btn-default"><i class="fa fa-list"></i>&nbsp;<?php echo _("List Device")?></a>
<a href="config.php?display=sccp_phone&amp;tech_hardware=cisco" class = "btn btn-default"><i class="fa fa-plus"></i>&nbsp;<?php echo _("Add Device")?></a>
</div>
<table id="sccpnavgrid"
data-search="true"
data-toolbar="#toolbar-sccp-rnav"
data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
data-cache="false"
data-toggle="table"
class="table">
data-search="true"
data-toolbar="#toolbar-sccpnav"
data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp"
data-cache="false"
data-toggle="table"
class="table">
<thead>
<tr>
<th data-sortable="true" data-field="mac"><?php echo _('SEP ID')?></th>
<th data-sortable="true" data-field="description"><?php echo _('Descriptions')?></th>
<tr>
<th data-sortable="true" data-field="mac"><?php echo _('SEP ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Descriptions') ?></th>
</tr>
</thead>
</table>

View file

@ -14,7 +14,7 @@
<div class="display no-border">
<h1><?php echo _("Device SIP Phone") ?></h1>
<div id="toolbar-sccp-sphone">
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
@ -25,11 +25,11 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=cisco-sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" 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" id="table-sip" data-id="mac">
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=cisco-sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" 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" id="table-sip" data-id="mac">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></th>
<th data-sortable="true" data-formatter="DispayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="true" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th>
@ -51,9 +51,9 @@
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
@ -71,13 +71,13 @@
exp_model += ' + ' + row['addon'];
}
}
return exp_model;
return exp_model;
}
function LineFormatterS(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
@ -87,5 +87,5 @@
}
return result;
}
</script>
</script>

View file

@ -117,7 +117,7 @@ if ($mysql_info['Value'] <= '2000') {
}
// Check Time Zone compatibility
// Check Time Zone comatable
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
$cisco_tz = $this->extconfigs->getextConfig('sccp_timezone', $conf_tz);
if ($cisco_tz['offset'] == 0) {