Compare commits

...

75 commits

Author SHA1 Message Date
Diederik de Groot 5752d9f393
Revert previous change 2022-01-30 15:16:15 +01:00
Diederik de Groot b28ec36e20
Update cisco_language table
Note: I changed 'ISO8859-1' to 'ISO-8859-1', please check if this is php compatible before applying this PR.
2022-01-30 14:40:36 +01:00
steve-lad 9519f0243a
Update sccpManagerUpdater.json 2022-01-28 11:24:50 +01:00
stevenA f5e51a52b7 Resolve issue of softkeysets lost across installs 2022-01-28 11:14:34 +01:00
stevenA 4cf414e995 Fix issue where values with spaces are truncate
Need to quote value in html
Fix installer overwriting valid sccpdevmodel
2022-01-28 10:00:13 +01:00
stevenA fb66f0e239 Fix issue where values with spaces are truncated
value needs to be quoted
2022-01-28 09:51:02 +01:00
steve-lad 60e973b4a6
Update sccpManagerUpdater.json 2022-01-27 19:29:51 +01:00
steve-lad 2ea478c117
Update sccpManagerUpdater.json 2022-01-27 19:29:27 +01:00
steve-lad fbbbefb25e
Update module.xml 2022-01-27 19:26:14 +01:00
steve-lad e7bc2492ef
Update module.xml 2022-01-27 19:18:23 +01:00
steve-lad f7e13505e9
Update sccpManagerUpdater.json 2022-01-27 19:05:29 +01:00
stevenA b752640f81 Update ajaxHelper.php 2022-01-27 18:50:18 +01:00
steve-lad da62493384
Update sccpManagerUpdater.json 2022-01-27 12:20:04 +01:00
stevenA 722285bc3d Update version
Revert 1 line from backport from 16
2022-01-27 12:15:51 +01:00
stevenA 09acfd097d Fix Issue #32
Standardise handling of IED fields (net and ip addresses)
Correct writing to db (seq was assigned a new value which caused duplication in sccpsettings and apparent unsaved data)
Remove inherit button in device and standardise to inherit server settings. Show users what will be set.
2022-01-27 12:03:50 +01:00
stevenA bd84870c6b Close Issue #29
Added warning and additional info for Hotline.
2022-01-19 14:41:43 +01:00
stevenA 60777bf3e3 Fix saving of custom soft keysets
Red border if invalid set name
Clean up modal indenting
Define valid chars
Only initialise general section at each save (previously initialised all clearing soft key sets)
2022-01-19 13:46:47 +01:00
steve-lad 1c5fa400ae
Update sccpManagerUpdater.json 2022-01-19 12:22:08 +01:00
steve-lad a8e3dbdd30
Update module.xml 2022-01-19 12:17:05 +01:00
stevenA 381fe184bd Fix Issue #59
Correct error in update mode selection
Save all buttons, rather than to last empty - buttons do not need to be allocated sequentially
Remove on duplicate case - add should always be new as either device is new, or have deleted device data before.
2022-01-19 12:07:41 +01:00
stevenA e08ad858f5 Update module.xml 2022-01-19 10:06:24 +01:00
stevenA ddd10f3ca9 Update rewrite.rules
Add case for dialplan.xml
2022-01-19 09:55:14 +01:00
stevenA d7ad8397da Update ajaxHelper.php 2022-01-19 08:36:57 +01:00
stevenA 4e17791fa1 Change wincharset selection method
Use utf-8 for java based phones
2022-01-17 10:43:50 +01:00
steve-lad 5796297bae
Update sccpManagerUpdater.json 2022-01-16 16:34:52 +01:00
stevenA 546de5add1 Modify installer db calls to remove IF EXISTS
IF EXISTS is not correct in MariaDb v5, used in all FreePbx Packages.
2022-01-16 16:04:41 +01:00
steve-lad b1769e6378
Update sccpManagerUpdater.json 2022-01-15 10:55:44 +01:00
stevenA 360ceea6cd Upgrade Installer
Installer was dropping new 14.3 columns data as these columns did not exist in module.xml schema.
Modify schema to include all columns, including legacy columns, and then move data prior to modifying schema.
2022-01-15 10:48:36 +01:00
stevenA 0dec44161f Update module.xml 2022-01-13 13:09:05 +01:00
stevenA 6808154c3a Update xmlinterface.class.php
Return binary vendor config values when necessary
2022-01-13 13:08:34 +01:00
stevenA e25fab14ff Update module.xml 2022-01-13 11:42:29 +01:00
stevenA e088deee12 Update xmlinterface.class.php
Fix langcode selection
2022-01-13 11:34:12 +01:00
stevenA 8051c30987 Update module.xml 2022-01-13 10:28:40 +01:00
stevenA 5c4848442a Update rewrite.rules
Optional rules were not commented out causing phones to look in tftproot/firmware/firmware
2022-01-13 10:24:26 +01:00
steve-lad 24cc8be3a7
Update module.xml 2022-01-11 15:40:47 +01:00
steve-lad 4f468517e7
Add PHP dependancy 2022-01-11 15:25:06 +01:00
steve-lad c3089d6d7f
Update sccpManagerUpdater.json 2022-01-11 11:59:19 +01:00
steve-lad 12cb1307ba
Update sccpManagerUpdater.json 2022-01-10 14:08:03 +01:00
stevenA 3ce99c94d8 Fix reversion - not returning to correct page after save
Settings and device save require different r=treatment on reload after save
2022-01-10 14:00:07 +01:00
steve-lad 70b318019e
Update sccpManagerUpdater.json 2022-01-10 11:37:59 +01:00
stevenA 82bd9cbaef Update module.xml
Update version
2022-01-10 11:33:42 +01:00
stevenA 34d6e976f2 Fix minor issues when saving settings
Page was not reloading correctly
Devices were not restarting (returning too soon)
2022-01-10 11:31:26 +01:00
steve-lad 6681a07c96
Update sccpManagerUpdater.json 2022-01-09 13:11:05 +01:00
stevenA 8013474e75 Fix issue where selecting new device in rnav caused exception
Correct window.location redirect syntax
2022-01-09 13:05:35 +01:00
steve-lad 88f4fba2c0
Update README.md 2022-01-06 15:26:13 +01:00
steve-lad a8dfaac9bb
Update sccpManagerUpdater.json 2022-01-06 15:09:06 +01:00
stevenA 745ef87fea Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2022-01-06 15:00:35 +01:00
stevenA 048077fce8 Update SIP device Handling & Fix Issue#53
Fix Issue #53
Consolidate forms to facilitate maintenance, reduce code, and apply changes to SIP handling introduce for sccp
Delete form.addsdevice.php
Delete form.sbuttons.php
Delete sipconfigs class and move db functions to dbinterface class, and other function to helperfunctions
create new field type for SIP line
update 9951 buttons count in installer
simplify segregation of sip and sccp requests
2022-01-06 15:00:24 +01:00
steve-lad fa9f28aac3
Update sccpManagerUpdater.json 2022-01-04 14:48:16 +01:00
stevenA 1f73ade196 Fix Issue #54
Do not try to write SEP file if no line defined. Save settings and warn user via toast
Fix feedback to ajax by separately submitting data before return
Fix freepbx overwriting data and causing fail, by separating json into two blocks and only parsing the first
Fix return to tab on save (set location hash) when tabs changed in settings
Fix return to calling page on save when device updated
2022-01-04 14:41:43 +01:00
steve-lad 8c725874d7
Update sccpManagerUpdater.json 2022-01-02 15:02:04 +01:00
steve-lad b39983c690
Update module.xml 2022-01-02 14:58:38 +01:00
stevenA 8f91e2c6e6 Update sipconfigs.class.php 2022-01-02 14:24:47 +01:00
steve-lad 463ab79add
Update sccpManagerUpdater.json 2022-01-02 13:12:21 +01:00
stevenA 198b3fffa8 Update save SIP device
Fail if no valid FreePbx sip bindings available

Fix SIP display issue

Correct line protocol selection
2022-01-02 13:06:41 +01:00
stevenA 21f9123ece Update formcreate.class.php
Clean up form create
2022-01-01 16:37:17 +01:00
stevenA 3381ad189b Update formcreate.class.php
Clean up code
2022-01-01 16:28:36 +01:00
stevenA b9ca187d30 Update module.xml
Update develop version
2022-01-01 13:50:29 +01:00
stevenA 2d9a272589 Update xmlinterface.class.php
change phonePersonalization from camel
2022-01-01 13:47:03 +01:00
steve-lad a68ac219d3
Update sccpManagerUpdater.json 2022-01-01 12:53:26 +01:00
steve-lad 4833638c8e
Update module.xml 2022-01-01 12:48:15 +01:00
steve-lad ad698eb5c0
Update module.xml 2022-01-01 12:46:17 +01:00
steve-lad 6cf10cc13b
Merge pull request #52 from chan-sccp/Fix-Issue-#49
Fix Issue #49 and improve handling of edit defaults
2022-01-01 12:45:46 +01:00
stevenA 378d3b2ff7 Fix Issue #49 and improve handling of edit defaults
keepalive was on 2 pages, so the value was being written then overwritten

Improved handling of customise and restore javascript to ensure that if the option was subsequently unselected, the original value was retained
2022-01-01 12:44:02 +01:00
steve-lad 354e3a2f47
Update sccpManagerUpdater.json 2021-12-31 15:38:18 +01:00
steve-lad ce365acdf2
Merge pull request #51 from chan-sccp/Fix-Issue-#50
Fix issue #50
2021-12-31 15:34:45 +01:00
stevenA 84b65309a3 Update Version 2021-12-31 15:32:44 +01:00
stevenA 89b1a1cd3f Fix defaults for string settings
Hack to fix bindaddr / externip
2021-12-31 15:31:56 +01:00
stevenA 8953484e1f Fix reset of defaults for text fields
Still need to address bindaddress:port and externalIP: Name
2021-12-31 15:01:02 +01:00
stevenA 8268bbf81a Fix restore defaults for radio buttons
Fix restore defaults for radio buttons
2021-12-31 12:45:12 +01:00
steve-lad 10a0ddb123
Update sccpManagerUpdater.json 2021-12-30 15:40:57 +01:00
steve-lad 8d412ce4ae
Merge pull request #48 from chan-sccp/Fix-issue-#47
Fix issue #47 - Defaults toggling with repeated saves
2021-12-30 15:27:25 +01:00
steve-lad 61beae544e
Merge branch 'develop' into Fix-issue-#47 2021-12-30 15:27:15 +01:00
stevenA c473c62ada Fix issue #47 - Defaults toggling with repeated saves
Remove unused group from server.settings.php
Correct testing for use of system defaults
Correct application of system defaults
ToDo:Numeric values are not being saved, or do not revert to defaults when button clicked
2021-12-30 15:22:20 +01:00
steve-lad fe780283a8
Update sccpManagerUpdater.json 2021-12-30 11:01:29 +01:00
28 changed files with 2039 additions and 1406 deletions

View file

@ -104,7 +104,10 @@ https://github.com/chan-sccp/sccp_manager/archive/refs/heads/develop.zip
### Module update to latest state
If you installed the Develop branch, the module can be updated to the latest version via FreePBX. FreePBX -> Admin -> Module Admin.
If you installed any version >14.3.0.13, the module can be updated to the latest version via FreePBX. The GUI version FreePBX -> Admin -> Module Admin currently has a reported bug, but the upgrade can be made via the command line using
```
fwconsole ma upgrade sccp_manager
```
### IMPORTANT NOTES:

View file

@ -320,11 +320,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->pagedata = array(
"general" => array(
"name" => _("Sip device configuration"),
"page" => 'views/form.addsdevice.php'
"page" => 'views/form.adddevice.php'
),
"buttons" => array(
"name" => _("Sip device Buttons"),
"page" => 'views/form.sbuttons.php'
"page" => 'views/form.buttons.php'
)
);
break;
@ -390,21 +390,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// $lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
$max_btn = (!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 60);
$last_btn = $max_btn;
for ($it = $max_btn; $it >= 0; $it--) {
if (!empty($get_settings['button' . $it . '_type'])) {
$last_btn = $it;
$btn_t = $get_settings['button' . $it . '_type'];
if ($btn_t != 'empty') {
break;
}
}
}
for ($it = 0; $it <= $last_btn; $it++) {
if (!empty($get_settings['button' . $it . '_type'])) {
$btn_t = $get_settings['button' . $it . '_type'];
for ($it = 0; $it < $max_btn; $it++) {
if (!empty($get_settings["button${it}_type"])) {
$btn_t = $get_settings["button${it}_type"];
$btn_n = '';
$btn_opt = '';
if ($it == 0) {
@ -412,9 +401,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
switch ($btn_t) {
case 'feature':
$btn_f = $get_settings['button' . $it . '_feature'];
$btn_f = $get_settings["button${it}_feature"];
// $btn_opt = (empty($get_settings['button' . $it . '_fvalue'])) ? '' : $get_settings['button' . $it . '_fvalue'];
$btn_n = (empty($get_settings['button' . $it . '_flabel'])) ? $def_feature[$btn_f]['name'] : $get_settings['button' . $it . '_flabel'];
$btn_n = (empty($get_settings["button${it}_flabel"])) ? $def_feature[$btn_f]['name'] : $get_settings["button${it}_flabel"];
$btn_opt = $btn_f;
if (!empty($def_feature[$btn_f]['value'])) {
if (empty($get_settings['button' . $it . '_fvalue'])) {
@ -432,46 +421,46 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break;
case 'monitor':
$btn_t = 'speeddial';
$btn_opt = (string) $get_settings['button' . $it . '_line'];
$btn_opt = (string) $get_settings["button${it}_line"];
$db_res = $this->dbinterface->getSccpDeviceTableData('SccpExtension', array('name' => $btn_opt));
$btn_n = $db_res[0]['label'];
$btn_opt .= ',' . $btn_opt . $this->hint_context['default'];
break;
case 'speeddial':
if (!empty($get_settings['button' . $it . '_input'])) {
$btn_n = $get_settings['button' . $it . '_input'];
if (!empty($get_settings["button${it}_input"])) {
$btn_n = $get_settings["button${it}_input"];
}
if (!empty($get_settings['button' . $it . '_phone'])) {
$btn_opt = $get_settings['button' . $it . '_phone'];
if (!empty($get_settings["button${it}_phone"])) {
$btn_opt = $get_settings["button${it}_phone"];
if (empty($btn_n)) {
$btn_n = $btn_opt;
}
}
if (!empty($get_settings['button' . $it . '_hint'])) {
if ($get_settings['button' . $it . '_hint'] == "hint") {
if (!empty($get_settings["button${it}_hint"])) {
if ($get_settings["button${it}_hint"] == "hint") {
if (empty($btn_n)) {
$btn_t = 'line';
$btn_n = $get_settings['button' . $it . '_hline'] . '!silent';
$btn_n = $get_settings["button${it}_hline"] . '!silent';
$btn_opt = '';
} else {
// $btn_opt .= ',' . $get_settings['button' . $it . '_hline'] . $this->hint_context['default'];
$btn_opt .= ',' . $get_settings['button' . $it . '_hline'];
$btn_opt .= ',' . $get_settings["button${it}_hline"];
}
}
}
break;
case 'adv.line':
$btn_t = 'line';
$btn_n = (string) $get_settings['button' . $it . '_line'];
$btn_n .= '@' . (string) $get_settings['button' . $it . '_advline'];
$btn_opt = (string) $get_settings['button' . $it . '_advopt'];
$btn_n = (string) $get_settings["button${it}_line"];
$btn_n .= '@' . (string) $get_settings["button${it}_advline"];
$btn_opt = (string) $get_settings["button${it}_advopt"];
break;
case 'line':
case 'silent':
if (isset($get_settings['button' . $it . '_line'])) {
$btn_n = (string) $get_settings['button' . $it . '_line'];
if (isset($get_settings["button${it}_line"])) {
$btn_n = (string) $get_settings["button${it}_line"];
if ($it > 0) {
if ($btn_t == 'silent') {
$btn_n .= '!silent';
@ -620,7 +609,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$result = array();
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
if (!$this->getFileListFromProvisioner($this->sccpvalues['tftp_path']['data'])) {
// File does not exist and cannot get from internet.
return $result;
};
@ -675,9 +664,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
*/
private function initializeTFtpLanguagePath() {
$dir = $this->sccppath["tftp_lang_path"];
//$dir = $this->sccppath["tftp_lang_path"];
foreach ($this->extconfigs->getExtConfig('sccp_lang') as $langKey => $langValueArr) {
$localeDir = $dir . DIRECTORY_SEPARATOR . $langValueArr['locale'];
$localeDir = $this->sccppath["tftp_lang_path"] . DIRECTORY_SEPARATOR . $langValueArr['locale'];
if (!is_dir($localeDir)) {
if (!mkdir($localeDir, 0755, true)) {
die("Error creating $localeDir directory");
@ -691,7 +680,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
*/
function initializeSccpPath() {
$this->sccppath = array(
'asterisk' => $this->sccpvalues['asterisk_etc_path']['data'],
'tftp_path' => $this->sccpvalues['tftp_path']['data'],
@ -704,15 +692,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
'tftp_countries_path' => $this->sccpvalues['tftp_countries_path']['data']
);
$read_config = $this->cnf_read->getConfig('sccp.conf');
$this->sccp_conf_init['general'] = $read_config['general'];
foreach ($read_config as $key => $value) {
if (isset($read_config[$key]['type'])) { // copy soft key
if ($read_config[$key]['type'] == 'softkeyset') {
$this->sccp_conf_init[$key] = $read_config[$key];
}
}
}
// initialise $sccp_conf_init
$this->sccp_conf_init = $this->initialiseConfInit();
$hint = $this->aminterface->core_list_hints();
foreach ($hint as $key => $value) {
@ -854,11 +835,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Create (SEP) dev_ID.cnf.xml
*/
function createSccpDeviceXML($dev_id = '') {
function createSccpDeviceXML(string $dev_id) {
if (empty($dev_id)) {
return false;
}
$sccp_native = true;
$data_value = array();
$dev_line_data = null;
@ -868,8 +846,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if (!empty($dev_config['type'])) {
if (strpos($dev_config['type'], 'sip') !== false) {
$sccp_native = false;
$tmp_bind = $this->sipconfigs->getSipConfig();
$tmp_bind = $this->getSipConfig();
$dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext'));
if (empty($dev_ext_config)){
// TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP.
// Need to return and inform user
return false;
}
$data_value = array_merge($data_value, $dev_ext_config);
$data_tmp = explode(';', $dev_ext_config['sip_lines']);
$data_value['sbind'] = array();
@ -877,15 +860,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$tmp_line = explode(',', $value);
switch ($tmp_line[0]) {
case 'line':
$dev_line_data = $this->sipconfigs->get_db_sip_TableData('DeviceById', array('id' => $tmp_line[1]));
$f_linetype = ($dev_line_data['dial'] == 'PJSIP') ? 'pjsip' : 'sip';
$dev_line_data = $this->dbinterface->getSipTableData('DeviceById', $tmp_line[1]);
$f_linetype = ($dev_line_data['sipdriver'] == 'chan_sip') ? 'sip' : 'pjsip';
$dev_line_data['sbind'] = $tmp_bind[$f_linetype];
if ((!$this->array_key_exists_recursive('udp', $tmp_bind[$f_linetype])) && (!$this->array_key_exists_recursive('tcp', $tmp_bind[$f_linetype]))) {
print_r("Wrong sip server Config ! Not enabled UDP or TCP protocol");
die();
return -1;
die_freepbx(_("SIP server configuration error ! Neither UDP nor TCP protocol enabled"));
return false;
}
if (!empty($dev_line_data)) {
$data_value['siplines'][] = $dev_line_data;
}

View file

@ -54,7 +54,7 @@ $(document).ready(function () {
if (data.message) {
bs_alert(data.message,data.status);
} else {
fpbxToast(_('Data saved'),_('Data saved'), 'success');
fpbxToast(_('Data saved'),'', 'success');
}
} else {
bs_alert(data.message,data.status);
@ -90,23 +90,23 @@ $(document).ready(function () {
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.hash != null) {
location.hash = data.hash;
}
if (data.href != null) {
location.href = data.href;
}
if (data.path != null) {
location.path = data.path;
}
if (data.search != null) {
location.search = data.search;
}
var newLocation = location.href;
newLocation = ('path' in data && data.path !== '') ? data.path : location.pathname;
newLocation += ('search' in data && data.search !== '') ? `${data.search}` : `${location.search}`;
// location.hash is set by (".change-tab") at line 198 for settings
newLocation += ('hash' in data && data.hash !== '' ) ? data.hash : location.hash;
if (data.message) {
fpbxToast(_('Configuration saved. Reloading Module'),_('Configuration saved'), 'success');
fpbxToast(_(data.message),'', data.toastFlag);
// If posting warning, allow time to read
var toastDelay = (data.toastFlag == 'success') ? 500 : 1500;
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
setTimeout(function(){
location.replace(newLocation);
if (data.search == `?display=sccpsettings`) {
location.reload();
}
},
toastDelay);
}
}
} else {
@ -116,10 +116,6 @@ $(document).ready(function () {
});
});
$(".input-js-add").click(function () {
add_dynamic_input($(this), $(this).data('for'), "", "");
});
$(".table").on('click', '.table-js-add', function (e) {
add_dynamic_table($(this), $(this).data('for'), "", "");
});
@ -128,7 +124,6 @@ $(document).ready(function () {
del_dynamic_table($(this), $(this).data('for'));
});
$(".table").on('click', '.btn-item-delete', function (e) {
var dev_cmd = '';
var dev_id = $(this).data('id');
@ -194,7 +189,10 @@ $(document).ready(function () {
});
// ---------------------------------------
// Set location.hash when changing tabs so that can return to same tab after reload.
$(".change-tab").click(function(){
window.location.hash = '#' + $(this).attr('data-name');
});
$('.btnMultiselect').click(function (e) {
var kid = $(this).data('id');
@ -918,32 +916,51 @@ function load_oncliсk(e, data)
}
}
// call from here not document.ready as have dynamic content
$(document).on('click', ".input-js-remove" , function () {
// delete the current row
var pname = $(this).data('id');
$('#' + pname).remove();
});
function add_dynamic_input(pe, pclass, vdefault)
{
// We'd like a new one, please.
pcls = pe.data('for');
pname = pe.data('id');
pmax = pe.data('max');
jdata = JSON.parse(hex2bin(pe.data('json')));
$(document).on('click', ".input-js-add" , function () {
// Add new row to networks or ip array
var pcls = $(this).data('for'),
pname = $(this).data('id'),
pmax = $(this).data('max'),
prow = $(this).data('row'),
pcount = $("." + pcls).length;
if (pcount == pmax){
//already reached max elements
return;
}
var last = $("." + pcls + ":last"),
ourid = last.data('nextid'),
nextid = ourid + 1;
var html = "<div class = '" + pcls + " form-group form-inline' data-nextid=" + nextid + ">";
jdata = JSON.parse(hex2bin($(this).data('json')));
var last = $("." + pcls).last(),
ourid = last.data('nextid'),
nextid = ourid + 1,
html = "<div class = '" + pcls + "' id ='" + pname + nextid + "' form-group form-inline' data-nextid=" + nextid + ">";
for (var key in jdata) {
html_opt = '';
html_calss = jdata[key]['class'];
for (var skey in jdata[key]['options']) {
html_opt += ' ' + skey + '="' + jdata[key]['options'][skey] + '"';
}
html += "<input type='text' name='" + pname + "[" + ourid + "][" + key + "]' class='" + html_calss + "' " + html_opt + " value='" + vdefault + "'> " + jdata[key]['nameseparator'] + " ";
html += "<input type='text' name='" + pname + "[" + nextid + "][" + key + "]' class " + html_opt + "> " + jdata[key]['nameseparator'] + " ";
}
// add remove button
html += "<button type='button' class='btn btn-danger btn-lg input-js-remove' id='" + pname + nextid + "-btn-remove' data-id='" + pname + nextid + "' data-for='" + pname + "'>";
html += "<i class='fa fa-minus pull-right'></i></button>";
// add plus button
html += "<button type='button' class='btn btn-primary btn-lg input-js-add' id='" + pname + nextid + "-btn-add' data-id='" + pname + "'";
html += " data-row='" + nextid + "' data-for='" + pname + "' data-max='" + pmax + "' data-json='" + $(this).data('json') + "' >";
html += "<i class='fa fa-plus pull-right'></i></button>";
html += "</div>\n";
if (pmax >= nextid) {
last.after(html);
}
}
last.after(html);
$('#' + pname + prow + '-btn-add').remove();
});
function del_dynamic_table(pe, pclass, vdefault)
{
@ -1186,82 +1203,100 @@ function sleep(milliseconds)
}
}
// There are 2 dynamically created button Classes
// sccp_restore for restoring system defaults, and sccp_edit for entering
// custom values. Clicking on these buttons is handled by the 2 functions below.
$(".sccp-restore").click(function() {
//input is sent by data-for where for is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
if ($(this).data("type") === 'radio') {
input = document.getElementsByName(id);
}
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
console.log('restore/checked');
edit_style.display = 'block';
if ($(this).data("type") === 'radio') {
// simulate read only for checkboxes
input.forEach(
function(radioElement) {
radioElement.setAttribute('disabled', true);
if (radioElement.hasAttribute('checked')) {
radioElement.removeAttribute('disabled');
}
//input is sent by data-for where for is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
input = document.getElementsByName(id);
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
console.log('restore/checked');
// Restoring defaults
// show the edit block and populate with default values.
edit_style.display = 'block';
var defaultVal = $(this).data("default");
if ($(this).data("type") === 'radio') {
// simulate read only for checkboxes except default
input.forEach(
function(radioElement) {
radioElement.setAttribute('disabled', true);
if (radioElement.value === defaultVal){
radioElement.removeAttribute('disabled');
radioElement.checked = true;
} else {
radioElement.removeAttribute('checked');
}
}
);
return;
} else if ($(this).data("type") === 'text') {
if ((input[0].id === "sccp_bindaddr") || (input[0].id === "sccp_externip")) {
// TODO: This is a dirty hack as default value is wrong - need to improve
input[0].value = '0.0.0.0';
} else {
input[0].value = defaultVal;
input[0].readOnly = true;
}
}
} else {
console.log('restore/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
//Revert to original value as have unchecked customise.
radioElement.checked = radioElement.defaultChecked;
radioElement.name.value = radioElement.name.defaultValue;
}
);
} else if ($(this).data("type") === 'text') {
//Revert to original value as have unchecked customise.
input[0].value = input[0].defaultValue;
}
);
return;
}
input.prop("readonly", true);
} else {
console.log('restore/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
// simulate read only for checkboxes
input.forEach(
function(radioElement) {
radioElement.removeAttribute('disabled');
}
);
return;
}
input.data("custom", input.val());
input.prop("readonly", true);
input.val(input.data("default"));
}
}
});
$(".sccp-edit").click(function() {
//input is sent by data-xxx where xxx is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
if ($(this).data("type") === 'radio') {
input = document.getElementsByName(id);
}
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
console.log('edit/checked');
edit_style.display = 'block';
if ($(this).data("type") === 'radio') {
// Security - attribute should not exist.
input.forEach(
function(radioElement) {
radioElement.removeAttribute('disabled');
}
);
return;
}
input.prop("readonly", false);
input.focus();
} else {
console.log('edit/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
//input is sent by data-xxx where xxx is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
input = document.getElementsByName(id);
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
// editing away from the default value
console.log('edit/checked');
edit_style.display = 'block';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
radioElement.removeAttribute('disabled');
}
);
return;
}
input.data("custom", input.val());
input.prop("readonly", true);
input.val(input.data("default"));
}
} else if ($(this).data("type") === 'text') {
input[0].focus();
}
} else {
console.log('edit/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
//Revert to original value as have unchecked customise.
radioElement.checked = radioElement.defaultChecked;
}
);
} else if ($(this).data("type") === 'text') {
//Revert to original value as have unchecked customise.
input[0].value = input[0].defaultValue;
}
}
});

803
conf/CiscoIPPhone.xsd Normal file
View file

@ -0,0 +1,803 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Cisco Systems, Inc. (Cisco Systems, Inc.) -->
<!-- Last updated 31 Dec 20 -->
<!-- The following Cisco IP Phones implement this XML parser: 6921, 6941, 6945, 6961, 7906G, 7911G, 7921G, 7925G, 7925G-EX, 7926G, 7931G, 7941G, 7941G-GE 7942G, 7945G, 7961G, 7961G-GE, 7962G, 7965G, 7970G, 7971G-GE, 7975G, 8800 Series, 8821, 8961, 9951, and 9971.-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="3.3.4">
<xsd:complexType name="CiscoIPPhoneExecuteItemType">
<xsd:attribute name="Priority" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="URL" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneResponseItemType">
<xsd:sequence>
<xsd:element name="Status" type="xsd:short"/>
<xsd:element name="Data">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneTouchAreaMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TouchArea" type="CiscoIPPhoneTouchAreaType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneTouchAreaType">
<xsd:attribute name="X1" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="Y1" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="X2" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="Y2" type="xsd:unsignedShort" use="required"/>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneDirectoryEntryType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Telephone" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneInputItemType">
<xsd:sequence>
<xsd:element name="DisplayName" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="QueryStringParam">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InputFlags">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="A"/>
<xsd:enumeration value="T"/>
<xsd:enumeration value="N"/>
<xsd:enumeration value="E"/>
<xsd:enumeration value="U"/>
<xsd:enumeration value="L"/>
<xsd:enumeration value="AP"/>
<xsd:enumeration value="TP"/>
<xsd:enumeration value="NP"/>
<xsd:enumeration value="EP"/>
<xsd:enumeration value="UP"/>
<xsd:enumeration value="LP"/>
<xsd:enumeration value="PA"/>
<xsd:enumeration value="PT"/>
<xsd:enumeration value="PN"/>
<xsd:enumeration value="PE"/>
<xsd:enumeration value="PU"/>
<xsd:enumeration value="PL"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DefaultValue" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconItemType">
<xsd:sequence>
<xsd:element name="Index" type="xsd:unsignedShort"/>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="16"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="40"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="IconIndex" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="9"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconFileItemType">
<xsd:sequence>
<xsd:element name="Index">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="9"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneKeyType">
<xsd:sequence>
<xsd:element name="Key">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="KeyPad0"/>
<xsd:enumeration value="KeyPad1"/>
<xsd:enumeration value="KeyPad2"/>
<xsd:enumeration value="KeyPad3"/>
<xsd:enumeration value="KeyPad4"/>
<xsd:enumeration value="KeyPad5"/>
<xsd:enumeration value="KeyPad6"/>
<xsd:enumeration value="KeyPad7"/>
<xsd:enumeration value="KeyPad8"/>
<xsd:enumeration value="KeyPad9"/>
<xsd:enumeration value="KeyPadStar"/>
<xsd:enumeration value="KeyPadPound"/>
<xsd:enumeration value="NavUp"/>
<xsd:enumeration value="NavDown"/>
<xsd:enumeration value="NavLeft"/>
<xsd:enumeration value="NavRight"/>
<xsd:enumeration value="NavSelect"/>
<xsd:enumeration value="NavBack"/>
<xsd:enumeration value="PushToTalk"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URLDown" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneSoftKeyType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Position">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="8"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URLDown" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="Title" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Prompt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SoftKeyItem" type="CiscoIPPhoneSoftKeyType" minOccurs="0" maxOccurs="8"/>
<xsd:element name="KeyItem" type="CiscoIPPhoneKeyType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
<xsd:attribute name="keypadTarget" use="optional" default="application">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="application"/>
<xsd:enumeration value="applicationCall"/>
<xsd:enumeration value="activeCall"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="appId" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppFocusLost" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppFocusGained" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppMinimized" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppClosed" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="CiscoIPPhoneExecute">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ExecuteItem" type="CiscoIPPhoneExecuteItemType" maxOccurs="3"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPhoneResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ResponseItem" type="CiscoIPPhoneResponseItemType" maxOccurs="3"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneError">
<xsd:complexType>
<xsd:attribute name="Number" type="xsd:unsignedShort" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneText">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="4000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneInput">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InputItem" type="CiscoIPPhoneInputItemType" minOccurs="0" maxOccurs="5"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneDirectory">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="DirectoryEntry" type="CiscoIPPhoneDirectoryEntryType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneImage">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="132"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="133"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="65"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="2162"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneImageFile">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="297"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="167"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneMenuItemType" minOccurs="0" maxOccurs="100"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneIconMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneIconMenuItemType" minOccurs="0" maxOccurs="32"/>
<xsd:element name="IconItem" type="CiscoIPPhoneIconItemType" minOccurs="0" maxOccurs="10"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneIconFileMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneIconMenuItemType" minOccurs="0" maxOccurs="32"/>
<xsd:element name="IconItem" type="CiscoIPPhoneIconFileItemType" minOccurs="0" maxOccurs="10"/>
</xsd:sequence>
<xsd:attribute name="IconIndex" type="xsd:unsignedShort" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneGraphicMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="132"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="133"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="65"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="2162"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MenuItem" type="CiscoIPPhoneMenuItemType" minOccurs="0" maxOccurs="12"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneGraphicFileMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="297"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="167"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MenuItem" type="CiscoIPPhoneTouchAreaMenuItemType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneStatus">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Timer" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="105"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="106"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="21"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:minLength value="0"/>
<xsd:maxLength value="557"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneStatusFile">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Timer" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="261"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="49"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View file

@ -39,7 +39,7 @@
</srstInfo>
<connectionMonitorDuration>120</connectionMonitorDuration>
</devicePool>
<versionStamp>{Jan 01 2003 00:00:00}</versionStamp>
<versionStamp>{Jan 01 2003 00:00:00}</versionStamp>
<loadInformation>P00308010100</loadInformation>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>

View file

@ -78,7 +78,7 @@ and open the template in the editor. Base Version before all crash :-)
<name>servername</name>
<default>Asterisk XML</default>
</input>
<help>Servername: This is the type of server - usually, it will be Asterisk.</help>
<help>Servername: This is the name of the server; normally it will be Asterisk.</help>
</item>
<item type="IE" id="3">
<label>Bind Address : [ Port ]</label>
@ -166,6 +166,23 @@ and open the template in the editor. Base Version before all crash :-)
<page_group name="sccp_net">
<label>SCCP Networks</label>
<item type="IED" id="2" seq="0">
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="NONE" field="net" nameseparator="/">
<options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
<class></class>
</input>
<input value="NONE" field="mask">
<options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
<class></class>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disabled>Add Deny network</addbutton-disabled>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
<item type="IED" id="1" seq="0">
<label>Allow Networks / Mask</label>
<name>permit</name>
@ -178,6 +195,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disabled>Add Allow Range</addbutton-disabled>
<help>Allow network settings. Blank fields will be ignored used Network 0.0.0.0/0.0.0.0 to resolve any existing connections. You can use the 'internal' connections only from the networks connected to the server. </help>
</item>
@ -195,30 +213,13 @@ and open the template in the editor. Base Version before all crash :-)
<class></class>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disabled>Add Internal Range</addbutton-disabled>
<help>Local network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
<item type="IED" id="2" seq="0">
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="NONE" field="net" nameseparator="/">
<options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
<class></class>
</input>
<input value="NONE" field="mask">
<options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
<class></class>
</input>
<add_pluss>+</add_pluss>
<addbutton-disabled>Add Deny network</addbutton-disabled>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
<item type="IED" id="1" seq="98">
<label>Device Connect Address / Name </label>
<name>ccm_address</name>
<cbutton field="internal" value="internal">Internal</cbutton>
<default>0.0.0.0:2000</default>
<input value="NONE" field="ip" nameseparator=":">
<options placeholder="0.0.0.0 / pbx.org"/>
<class></class>
@ -228,6 +229,7 @@ and open the template in the editor. Base Version before all crash :-)
<class></class>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disabled>Add Address</addbutton-disabled>
<help>This function is useful when the server has many interfaces, but devices must connect only to some interfaces.</help>
</item>
@ -415,17 +417,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="no">No</button>
<help>Use simulated enbloc dialing to speedup connection when dialing while onhook (older phones)</help>
</item>
<item type="IE" id="5">
<label>SCCP SERVER Keepalive</label>
<input>
<name>keepalive</name>
<default>60</default>
<class>sccp-custom</class>
<type>number</type>
<options min="60" max="300"></options>
</input>
<help>Time between Keep Alive checks. Valid range is 60-300 seconds. After much trial-and-error, the minimum (60) seems to work just fine.</help>
</item>
<item type="IS" id="11" seq="98">
<name>phonepersonalization</name>
<label>Allow push background from server </label>
@ -513,7 +504,7 @@ and open the template in the editor. Base Version before all crash :-)
<page_group name="sccp_dev_time">
<label>SCCP Time Service config</label>
<item type="SLD" id="1" seq="1">
<item type="SLD" id="1" seq="0">
<label>Display Day Format</label>
<name>dateformat</name>
<select>
@ -723,7 +714,7 @@ and open the template in the editor. Base Version before all crash :-)
<name>srst_ip</name>
<max_row>3</max_row>
<default>/</default>
<input value="NONE" field="Addr" nameseparator=":">
<input value="NONE" field="ip" nameseparator=":">
<options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" />
<class></class>
</input>
@ -961,7 +952,7 @@ and open the template in the editor. Base Version before all crash :-)
</row>
</element>
<element type='p'> </element>
<element type='h3'>Be careful with this function. Especially not to the internet. So i would restring the deny/permit to 'internal' by default in that case.</element>
<element type='h3'>Be careful with this function. It is recommended to restrict to internal network use; set the deny/permit to 'internal' by default. This is insecure and should be switched off before going into production. A PLAR phone is still able to ring any other extension by entering the number on the phone before going off-hook. So either setup a secure context for these types of phones or switch off hotline.</element>
<element type='table'>
<row>
<col>Allow =</col>
@ -989,7 +980,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="1">
<name>hotline_enabled</name>
<label>Hotline</label>
<default>off</default>
<default>"no"</default>
<button value="no">No</button>
<button value="yes">Yes</button>
<help>Hotline Enabled: This allows unregistered extensions to connect to the system and dial the number listed below.</help>
@ -1396,6 +1387,82 @@ and open the template in the editor. Base Version before all crash :-)
</item>
</page_group>
<page_group name="sccp_hw_sip_dev2">
<label>Device configuration</label>
<item type="IE" id="1" seq="99">
<label>Device Label</label>
<input>
<name>description</name>
<default>000000000</default>
<class>sccp-custom</class>
<options pattern="[0-9a-zA-Z]+"/>
</input>
<help>The information in the upper right corner of the device screen. Only English letters and digits !</help>
</item>
<item type="SDMF" id="1" seq="100">
<label>Default Line</label>
<name>defaultLine</name>
<default></default>
<select name="name" addlabel='label' dataid="name" dataval="label">model</select>
<class>lineSelect form-control</class>
<help>Select the default line for this device</help>
</item>
<item type="SLK" id="2" seq="99">
<label>Soft Keyset</label>
<name>softkeyset</name>
<default>default</default>
<select></select>
<help>System Default Softkey</help>
</item>
<item type="SLZ" id="3" seq="98">
<label>Time Zone offset</label>
<name>tzoffset</name>
<default>00</default>
<select></select>
<help>Time Zone offset</help>
</item>
<item type="SLTD" id="5" seq="98">
<label>SCCP Phone Device Language</label>
<name>devlang</name>
<default>English_United_States</default>
<select> </select>
<help>The user locale allows the phone to display text (menu items, soft keys etc.) native to the phone's language. If No language packs found is shown, you need to add locales in the tftp server</help>
</item>
<item type="SLTN" id="4" seq="98">
<label>SCCP Network Device Language</label>
<name>netlang</name>
<default>English_United_States</default>
<select></select>
<help>The Network locales allows the phone to play tones (ringing, busy etc.) native to the phone's country. If No language packs found is shown, you need to add locales in the tftp server</help>
</item>
<item type="IS" id="11" seq="98">
<name>phonepersonalization</name>
<label>Allow push background from server </label>
<default></default>
<button value="1">Enabled</button>
<button value="0">Disabled</button>
<help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help>
</item>
<item type="IE" id="6" seq="99">
<label>Background Image</label>
<input>
<name>backgroundImage</name>
<default></default>
<class>sccp-custom</class>
</input>
<help>For phones that can display background images - display this one. Default is [empty]</help>
</item>
<item type="IE" id="7" seq="99">
<label>Ringtone</label>
<input>
<name>ringtone</name>
<default></default>
<class>sccp-custom</class>
</input>
<help>The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provides the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ringtones directory with the rest of the config files.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_button">
<label>Buttons Configuration</label>
<item type="IE" id="1" seq="99">
@ -1618,6 +1685,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disabled>Add Deny network</addbutton-disabled>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
@ -1625,11 +1693,7 @@ and open the template in the editor. Base Version before all crash :-)
<label>Allow Networks / Mask</label>
<name>permit</name>
<default>NONE</default>
<cbutton field="inherit" value="NONE">Inherit
<option_disabled class=".sccp_hw_net_inherit">false</option_disabled>
</cbutton>
<cbutton field="internal" value="internal"><class>sccp_hw-ar_permit-gr</class>internal</cbutton>
<class>sccp_hw_net_inherit</class>
<input value="NONE" field="net" nameseparator="/">
<options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
@ -1638,6 +1702,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
</input>
<add_pluss>+</add_pluss>
<max_row>5</max_row>
<addbutton-disables>Add Allow network</addbutton-disables>
<help>Allow network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -1957,6 +2022,7 @@ and open the template in the editor. Base Version before all crash :-)
<class>col-md-9</class>
</input>
<add_pluss>+</add_pluss>
<max_row>3</max_row>
<help></help>
</item>
</page_group>

View file

@ -181,8 +181,8 @@ ri ^\/((.+\-cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1
ri ^\/((SPA504G-cfg.xml)(\.enc)?(\.sgn)?)$ settings/\1
# Keep firmware in a separate directory (optional)
ri ^(.+\.loads)$ firmware/\1
ri ^(.+\.sbn)$ firmware/\1
#ri ^(.+\.loads)$ firmware/\1
#ri ^(.+\.sbn)$ firmware/\1
ri ^(.+)\/(.+-sccp.jar)$ locales/languages/\1/\2
@ -206,6 +206,9 @@ ri ^(.+)(\.raw|\.rwb|\.pcm)(\.sgn)?$ ringtones/\1\2\3
#ri ^Desktops/(.+)/(List\.xml)(\.sgn)?$ wallpapers/\1/\2\3
#ri ^Desktops/(.+)/(.+\.png)(\.sgn)?$ wallpapers/\1/\2\3
# Dialplan
ri ^(dialplan.xml)$ dialplan/\1
ri ^authorized_keys$ settings/authorized_keys
#

View file

@ -10,7 +10,6 @@ global $version;
global $aminterface;
global $extconfigs;
global $mobile_hw;
global $useAmiForSoftKeys;
global $settingsFromDb;
global $thisInstaller;
global $cnf_int;
@ -21,7 +20,6 @@ $mobile_hw = '0';
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
$table_req = array('sccpdevice', 'sccpline', 'sccpsettings');
$sccp_compatible = 0;
$chanSCCPWarning = true;
$db_config = '';
$sccp_version = array();
$cnf_int = \FreePBX::Config();
@ -45,16 +43,14 @@ foreach ($requiredClasses as $className) {
}
CheckAsteriskVersion();
$sccp_version = CheckChanSCCPCompatible();
$sccp_compatible = $sccp_version[0];
$chanSCCPWarning = $sccp_version[1] ^= 1;
$sccp_compatible = $aminterface->getSCCPVersion()['vCode'];
outn("<li>" . _("Sccp model Compatible code : ") . $sccp_compatible . "</li>");
if ($sccp_compatible == 0) {
outn("<br>");
outn("<font color='red'>Chan Sccp not Found. Install it before continuing !</font>");
outn("<font color='red'>chan-sccp not found. Install it before continuing !</font>");
die();
}
// BackUp Old config
createBackUpConfig();
RenameConfig();
@ -68,10 +64,7 @@ InstallDB_createButtonConfigTrigger();
InstallDbCreateViews($sccp_compatible);
installDbPopulateSccpline();
InstallDB_updateDBVer($sccp_compatible);
if ($chanSCCPWarning) {
outn("<br>");
outn("<font color='red'>Error: installed version of chan-sccp is not compatible. Please upgrade chan-sccp</font>");
}
Setup_RealTime();
addDriver($sccp_compatible);
checkTftpServer();
@ -189,7 +182,7 @@ function Get_DB_config($sccp_compatible)
'modify' => "enum('sccpdevice', 'sipdevice', 'sccpuser')" ),
)
);
// Hardware Mobile. Can switch Softwate to Hardware
// Hardware Mobile. Can switch Software to Hardware
$db_config_v4M = array(
'sccpdevmodel' => array(
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL")
@ -296,7 +289,7 @@ function Get_DB_config($sccp_compatible)
'_description' => array('rename' => 'description'),
'keepalive' => array('create' => "INT(11) DEFAULT '60'", 'modify' => 'INT(11)', 'def_modify' => "60")
),
'sccpline' => array (
'sccpline' => array(
'regcontext' => array('create' => "VARCHAR(20) NULL default 'sccpregistration'", 'modify' => "VARCHAR(20)"),
'transfer_on_hangup' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'autoselectline_enabled' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
@ -310,9 +303,13 @@ function Get_DB_config($sccp_compatible)
'_backgroundImageAccess' => array('rename' => 'backgroundImageAccess'),
'_callLogBlfEnabled' => array('rename' => 'callLogBlfEnabled')
),
'sccpsettings' => array (
'sccpsettings' => array(
'systemdefault' => array('create' => "VARCHAR(255) NULL default ''")
)
),
'sccpdevmodel' => array(
'fwfound' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
'templatefound' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')")
)
);
if ($sccp_compatible >= 433) {
@ -325,6 +322,7 @@ function Get_DB_config($sccp_compatible)
$db_config_v4['sccpdevice'] = array_merge($db_config_v4['sccpdevice'],$db_config_v5['sccpdevice']);
$db_config_v4['sccpline'] = array_merge($db_config_v4['sccpline'],$db_config_v5['sccpline']);
$db_config_v4['sccpsettings'] = $db_config_v5['sccpsettings'];
$db_config_v4['sccpdevmodel'] = $db_config_v5['sccpdevmodel'];
}
return $db_config_v4;
}
@ -369,20 +367,78 @@ function CheckAsteriskVersion()
function CheckChanSCCPCompatible()
{
global $chanSCCPWarning;
global $aminterface;
// calling with true returns array with compatibility and RevisionNumber
return $aminterface->get_compatible_sccp(true);
return $aminterface->getSCCPVersion['vCode'];
}
function InstallDB_updateSchema($db_config)
{
/*
Initially, referred to schema existing and created db from scratch. This required
initialising sccp_manager object which in term required that sccpsettings existed
To overcome this, moved to creation/modification of db via module.xml.
In early version of 14.3, only used initial fields present in older versions, and then
added new required fields. This resulted in new fields being dropped at next install.
Now include all fields in module.xml, and then transfer any data in old fields to new fields
before then deleting old fields, rather than renaming columns which will no longer work as
the new column already exists, and may contain data. This affected 36 fields in sccpdevice
and 5 fields in sccpline which in old db schema used _ prefix to hide from chan-sccp.
*/
global $db;
if (!$db_config) {
die_freepbx("No db_config provided");
}
outn("<li>" . _("Saving legacy data into current column") . "</li>");
$priorSchemaFields = array(
'sccpdevice' => array(
'_description', '_loginname', '_profileid', '_dialrules', '_devlang', '_netlang', '_logserver',
'_daysdisplaynotactive', '_displayontime', '_displayonduration', '_displayidletimeout', '_settingsaccess', '_videocapability',
'_webaccess', '_webadmin', '_pcport', '_spantopcport', '_voicevlanaccess', '_enablecdpswport', '_enablecdppcport',
'_enablelldpswport', '_enablelldppcport', '_firstdigittimeout', '_digittimeout', '_cfwdnoanswer_timeout',
'_autoanswer_ring_time', '_autoanswer_tone', '_remotehangup_tone', '_transfer_tone', '_callwaiting_tone',
'_callanswerorder', '_sccp_tos', '_sccp_cos', '_dev_sshPassword', '_dev_sshUserId', '_phonepersonalization'),
'sccpline' => array(
'_regcontext', '_transfer_on_hangup', '_autoselectline_enabled', '_autocall_select', '_backgroundImageAccess', '_callLogBlfEnabled')
);
foreach ($priorSchemaFields as $table => $fieldsArr) {
// First get any data in columns to be deleted ( _Column)
$sqlMatch = array_reduce($fieldsArr, function($carry, $column) {
return "${carry} ${column} IS NOT NULL OR";
});
unset($column);
$sqlFields = array_reduce($fieldsArr, function($carry, $column) {
return "${carry} ${column} AS " . ltrim($column,"_") .",";
});
$sqlMatch = rtrim($sqlMatch, "OR");
$sqlFields = rtrim($sqlFields, ",");
$stmt = $db->prepare("SELECT name, ${sqlFields} FROM ${table} WHERE ${sqlMatch}");
$stmt->execute();
$dbResult = $stmt->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
// Now move any data found from _Column to Column. This is safe as the two should not exist.
if (!empty($dbResult)) {
foreach ($dbResult as $name => $columnArr) {
$sqlVar = array_reduce(array_keys($columnArr), function($carry, $key) use ($columnArr){
$carry .= (isset($columnArr[$key])) ? "${key} = '${columnArr[$key]}'," : "";
return $carry;
});
$sqlVar = rtrim($sqlVar, ",");
$stmt = $db->prepare("UPDATE ${table} SET ${sqlVar} WHERE name = '${name}'");
$stmt->execute();
}
}
// Processed all _Column names; now safe to delete them
$sqlDrop = array_reduce($fieldsArr, function($carry, $column) {
return "${carry} DROP COLUMN ${column},";
});
$sqlDrop = rtrim($sqlDrop, ", ");
$stmt = $db->prepare("ALTER TABLE ${table} ${sqlDrop}");
$stmt->execute();
}
// Now process the column updates as per the legacy installer
$count_modify = 0;
outn("<li>" . _("Modify Database schema") . "</li>");
outn("<li>" . _("Modifying Database schema") . "</li>");
foreach ($db_config as $tabl_name => $tab_modif) {
$sql_create = '';
$sql_modify = '';
@ -399,7 +455,9 @@ function InstallDB_updateSchema($db_config)
foreach ($db_result as $fld_id => $tabl_data) {
if (!empty($tab_modif[$fld_id])) {
// have column in table so potentially something to update
// if dropping column, prepare sql and continue
// if dropping column, prepare sql and continue. The drop case will never
// occur as columns that are dropped should no longer be in the module.xml schema
// and so Doctrine will have already dropped them.
if (!empty($tab_modif[$fld_id]['drop'])) {
$sql_create .= "DROP COLUMN {$row_fld}, ";
unset($tab_modif[$fld_id]['drop']);
@ -438,25 +496,33 @@ function InstallDB_updateSchema($db_config)
$count_modify ++;
}
}
// Now handle rename. Need to be carefull that the newname does not exist. If it does then need to
// ignore or unexpected things may happen.
if (!empty($tab_modif[$fld_id]['rename'])) {
// Field currently exists so need to rename (and keep data)
// Field currently exists so need to rename (and keep data). All of legacy _columns have already
// been dropped so will not get here as $fld_id cannot be _column.
// for backward compatibility use CHANGE - REPLACE is only available in MariaDb > 10.5.
$fld_id_newName = $tab_modif[$fld_id]['rename'];
// Does a create exist for newName
if (!empty($tab_modif[$fld_id_newName]['create'])) {
//carry the attributes from the new create to the rename
$sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$tab_modif[$fld_id_newName]['create']}, ";
// do not create newName as modifying existing
unset($tab_modif[$fld_id_newName]['create']);
} else {
// add current attributes to the new name.
$existingAttrs = strtoupper($tabl_data['Type']).(($tabl_data['Null'] == 'NO') ?' NOT NULL': ' NULL') .
((empty($tabl_data['Default']))?'': ' DEFAULT ' . "'" . $tabl_data['Default']."'");
$sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$existingAttrs}, ";
// Only execute if the newname column does not already exist.
if (empty($db_result[$fld_id_newName])) {
// Trying to rename to an existing column. Ignore this case.
// Does a create exist for newName
if (!empty($tab_modif[$fld_id_newName]['create'])) {
//carry the attributes from the new create to the rename
$sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$tab_modif[$fld_id_newName]['create']}, ";
// do not create newName as modifying existing
unset($tab_modif[$fld_id_newName]['create']);
} else {
// add current attributes to the new name.
$existingAttrs = strtoupper($tabl_data['Type']).(($tabl_data['Null'] == 'NO') ?' NOT NULL': ' NULL') .
((empty($tabl_data['Default']))?'': ' DEFAULT ' . "'" . $tabl_data['Default']."'");
$sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$existingAttrs}, ";
}
$count_modify ++;
}
// Have treated this rename so unset. If the newname already exists, have done nothing.
unset($tab_modif[$fld_id]['rename']);
$count_modify ++;
}
// is there a create for this field
if (!empty($tab_modif[$fld_id]['create'])) {
@ -502,152 +568,153 @@ function InstallDB_updateSchema($db_config)
}
}
outn("<li>" . _("Total modify count :") . $count_modify . "</li>");
/*
$stmt = $db->prepare('SELECT CASE WHEN EXISTS(SELECT 1 FROM sccpdevmodel) THEN 0 ELSE 1 END AS IsEmpty;');
$stmt->execute();
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
if (!$result[0]['IsEmpty']) {
// Now see if sccpdevmodel is populated.
$devModelArr = array( "('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL)",
"('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL)",
"('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL)",
"('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL)",
"('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL)",
"('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, '')",
"('6901', 'CISCO', 1, 1, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL)",
"('6911', 'CISCO', 1, 1, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL)",
"('6921', 'CISCO', 1, 1, 'SCCP69xx.9-4-1-3SR3', 'loadInformation496', 0, NULL)",
"('6941', 'CISCO', 1, 1, 'SCCP69xx.9-3-1-3', 'loadInformation495', 0, NULL)",
"('6945', 'CISCO', 1, 1, 'SCCP6945.9-3-1-3', 'loadInformation564', 0, NULL)",
"('6961', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL)",
"('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL)",
"('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL)",
"('7906', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7910', 'CISCO', 1, 1, 'P00405000700', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7911', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL)",
"('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL)",
"('7914;7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL)",
"('7915', 'CISCO', 0, 24, 'B015-1-0-4-2', 'loadInformation227', 1, NULL)",
"('7915;7915', 'CISCO', 0, 48, 'B015-1-0-4-2', 'loadInformation228', 1, NULL)",
"('7916', 'CISCO', 0, 24, 'B016-1-0-4-2', 'loadInformation229', 1, NULL)",
"('7916;7916', 'CISCO', 0, 48, 'B016-1-0-4-2', 'loadInformation230', 1, NULL)",
"('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL)",
"('7921', 'CISCO', 1, 1, 'CP7921G-1.4.6.3', 'loadInformation365', 0, NULL)",
"('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, 'SEP0000000000.cnf.xml_7925_template')",
"('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, '')",
"('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL)",
"('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL)",
"('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL)",
"('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-5-7', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template')",
"('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_7940_template')",
"('7941', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7942', 'CISCO', 1, 2, 'SCCP42.9-4-2SR3-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7945', 'CISCO', 1, 2, 'SCCP45.9-3-1SR1-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_7940_template')",
"('7961', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7962', 'CISCO', 3, 6, 'SCCP42.9-4-2SR3-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7965', 'CISCO', 3, 6, 'SCCP45.9-3-1SR1-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, '')",
"('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, '')",
"('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, '')",
"('7970', 'CISCO', 3, 8, 'SCCP70.9-4-2SR3-1S', 'loadInformation30006', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('7971', 'CISCO', 1, 2, 'SCCP70.9-4-2SR3-1S', 'loadInformation119', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('7975', 'CISCO', 3, 8, 'SCCP75.9-4-2SR3-1S', 'loadInformation437', 0, 'SEP0000000000.cnf.xml_7975_template')",
"('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL)",
"('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, '')",
"('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, '')",
"('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, '')",
"('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, '')",
"('8941', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation586', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('8945', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation585', 0, 'SEP0000000000.cnf.xml_7975_template')",
"('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, 'SEP0000000000.cnf.xml_ATA_template')",
"('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, 'SEP0000000000.cnf.xml_ATA_template')",
"('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL)",
"('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL)",
"('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL)",
"('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL)",
"('ICC', 'NOKIA', 1, 1, '', '', 0, NULL)",
"('Analog Access', 'CISCO', 1, 1, 'A001C030', 'loadInformation30', 0, '')",
"('WS-X6624', 'CISCO', 1, 1, 'A00204000013', 'loadInformation43', 0, '')",
"('WS-X6608', 'CISCO', 1, 1, 'C00104000003', 'loadInformation51', 0, '')",
"('H.323 Phone', 'CISCO', 1, 1, '', 'loadInformation61', 0, '')",
"('Simulator', 'CISCO', 1, 1, '', 'loadInformation100', 0, '')",
"('MTP', 'CISCO', 1, 1, '', 'loadInformation111', 0, '')",
"('MGCP Station', 'CISCO', 1, 1, '', 'loadInformation120', 0, '')",
"('MGCP Trunk', 'CISCO', 1, 1, '', 'loadInformation121', 0, '')",
"('UPC', 'CISCO', 1, 1, '', 'loadInformation358', 0, '')",
"('TelePresence', 'TELEPRESENCE', 1, 1, '', 'loadInformation375', 0, '')",
"('1000', 'TELEPRESENCE', 1, 1, '', 'loadInformation478', 0, '')",
"('3000', 'TELEPRESENCE', 1, 1, '', 'loadInformation479', 0, '')",
"('3200', 'TELEPRESENCE', 1, 1, '', 'loadInformation480', 0, '')",
"('500-37', 'TELEPRESENCE', 1, 1, '', 'loadInformation481', 0, '')",
"('1300-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation505', 0, '')",
"('1100', 'TELEPRESENCE', 1, 1, '', 'loadInformation520', 0, '')",
"('200', 'TELEPRESENCE', 1, 1, '', 'loadInformation557', 0, '')",
"('400', 'TELEPRESENCE', 1, 1, '', 'loadInformation558', 0, '')",
"('EX90', 'TELEPRESENCE', 1, 1, '', 'loadInformation584', 0, '')",
"('500-32', 'TELEPRESENCE', 1, 1, '', 'loadInformation590', 0, '')",
"('1300-47', 'TELEPRESENCE', 1, 1, '', 'loadInformation591', 0, '')",
"('TX1310-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation596', 0, '')",
"('EX60', 'TELEPRESENCE', 1, 1, '', 'loadInformation604', 0, '')",
"('C90', 'TELEPRESENCE', 1, 1, '', 'loadInformation606', 0, '')",
"('C60', 'TELEPRESENCE', 1, 1, '', 'loadInformation607', 0, '')",
"('C40', 'TELEPRESENCE', 1, 1, '', 'loadInformation608', 0, '')",
"('C20', 'TELEPRESENCE', 1, 1, '', 'loadInformation609', 0, '')",
"('C20-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation610', 0, '')",
"('C60-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation611', 0, '')",
"('C40-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation612', 0, '')",
"('C60-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation613', 0, '')",
"('C60-52D', 'TELEPRESENCE', 1, 1, '', 'loadInformation614', 0, '')",
"('C60-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation615', 0, '')",
"('C90-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation616', 0, '')",
"('MX200', 'TELEPRESENCE', 1, 1, '', 'loadInformation617', 0, '')",
"('TX9000', 'TELEPRESENCE', 1, 1, '', 'loadInformation619', 0, '')",
"('TX9200', 'TELEPRESENCE', 1, 1, '', 'loadInformation620', 0, '')",
"('SX20', 'TELEPRESENCE', 1, 1, '', 'loadInformation626', 0, '')",
"('MX300', 'TELEPRESENCE', 1, 1, '', 'loadInformation627', 0, '')",
"('C40-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation633', 0, '')",
"('Jabber', 'CISCO', 1, 1, '', 'loadInformation652', 0, '')",
"('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, '')",
"('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, '')",
"('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, '')",
"('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, '')",
"('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, '')",
"('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, '')",
"('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, '')",
"('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, '')",
"('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, '')",
"('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, '')",
"('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, '')",
"('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, '')",
"('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, '')",
"('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, '')",
"('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, '')",
"('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, '')",
"('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, '')",
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL)",
"('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL)",
"('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL)",
"('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template')",
"('9951-sip', 'CISCO-SIP', 1, 5, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template')",
"('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL)"
);
$test = $db->prepare("SELECT count(*) AS modelCount from sccpdevmodel");
$test->execute();
if ($test->fetchAll()[0]['modelCount'] == count($devModelArr)) {
// Appear to have a correctly populated sccpdevmodel table. Do not overwrite
// as may contain user modifications;
outn("<li>" . _("sccpdevmodel appears to be populated; not overwriting") . "</li>");
return;
} else {
*/
// Force update of sccp devmodel to ensure changes are taken into account
};
// Update sccpdevmodel as counts do not match
outn("Updating sccpdevmodel...");
outn("<li>" . _("Fill sccpdevmodel") . "</li>");
$sql = "REPLACE INTO sccpdevmodel (model, vendor, dns, buttons, loadimage, loadinformationid, enabled, nametemplate) VALUES
('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL),
('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL),
('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL),
('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL),
('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL),
('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, ''),
('6901', 'CISCO', 1, 1, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL),
('6911', 'CISCO', 1, 1, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL),
('6921', 'CISCO', 1, 1, 'SCCP69xx.9-4-1-3SR3', 'loadInformation496', 0, NULL),
('6941', 'CISCO', 1, 1, 'SCCP69xx.9-3-1-3', 'loadInformation495', 0, NULL),
('6945', 'CISCO', 1, 1, 'SCCP6945.9-3-1-3', 'loadInformation564', 0, NULL),
('6961', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL),
('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL),
('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL),
('7906', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7910', 'CISCO', 1, 1, 'P00405000700', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7911', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL),
('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL),
('7914;7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL),
('7915', 'CISCO', 0, 24, 'B015-1-0-4-2', 'loadInformation227', 1, NULL),
('7915;7915', 'CISCO', 0, 48, 'B015-1-0-4-2', 'loadInformation228', 1, NULL),
('7916', 'CISCO', 0, 24, 'B016-1-0-4-2', 'loadInformation229', 1, NULL),
('7916;7916', 'CISCO', 0, 48, 'B016-1-0-4-2', 'loadInformation230', 1, NULL),
('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL),
('7921', 'CISCO', 1, 1, 'CP7921G-1.4.6.3', 'loadInformation365', 0, NULL),
('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, 'SEP0000000000.cnf.xml_7925_template'),
('7926', 'CISCO', 1, 1, 'CP7926G-1.4.1SR1', 'loadInformation557', 0, NULL),
('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL),
('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL),
('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL),
('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-5-7', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'),
('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_7940_template'),
('7941', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7942', 'CISCO', 1, 2, 'SCCP42.9-4-2SR3-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7945', 'CISCO', 1, 2, 'SCCP45.9-3-1SR1-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_7940_template'),
('7961', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7962', 'CISCO', 3, 6, 'SCCP42.9-4-2SR3-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7965', 'CISCO', 3, 6, 'SCCP45.9-3-1SR1-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7970', 'CISCO', 3, 8, 'SCCP70.9-4-2SR3-1S', 'loadInformation30006', 0, 'SEP0000000000.cnf.xml_797x_template'),
('7971', 'CISCO', 1, 2, 'SCCP70.9-4-2SR3-1S', 'loadInformation119', 0, 'SEP0000000000.cnf.xml_797x_template'),
('7975', 'CISCO', 3, 8, 'SCCP75.9-4-2SR3-1S', 'loadInformation437', 0, 'SEP0000000000.cnf.xml_7975_template'),
('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL),
('8941', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation586', 0, 'SEP0000000000.cnf.xml_797x_template'),
('8945', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation585', 0, 'SEP0000000000.cnf.xml_7975_template'),
('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, 'SEP0000000000.cnf.xml_ATA_template'),
('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, 'SEP0000000000.cnf.xml_ATA_template'),
('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL),
('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL),
('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL),
('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL),
('ICC', 'NOKIA', 1, 1, '', '', 0, NULL),
('Analog Access', 'CISCO', 1, 1, 'A001C030', 'loadInformation30', 0, ''),('WS-X6608', 'CISCO', 1, 1, 'D00404000032', 'loadInformation43', 0, ''),
('WS-X6624', 'CISCO', 1, 1, 'A00204000013', 'loadInformation43', 0, ''),
('WS-X6608', 'CISCO', 1, 1, 'C00104000003', 'loadInformation51', 0, ''),
('H.323 Phone', 'CISCO', 1, 1, '', 'loadInformation61', 0, ''),
('Simulator', 'CISCO', 1, 1, '', 'loadInformation100', 0, ''),
('MTP', 'CISCO', 1, 1, '', 'loadInformation111', 0, ''),
('MGCP Station', 'CISCO', 1, 1, '', 'loadInformation120', 0, ''),
('MGCP Trunk', 'CISCO', 1, 1, '', 'loadInformation121', 0, ''),
('UPC', 'CISCO', 1, 1, '', 'loadInformation358', 0, ''),
('TelePresence', 'TELEPRESENCE', 1, 1, '', 'loadInformation375', 0, ''),
('1000', 'TELEPRESENCE', 1, 1, '', 'loadInformation478', 0, ''),
('3000', 'TELEPRESENCE', 1, 1, '', 'loadInformation479', 0, ''),
('3200', 'TELEPRESENCE', 1, 1, '', 'loadInformation480', 0, ''),
('500-37', 'TELEPRESENCE', 1, 1, '', 'loadInformation481', 0, ''),
('1300-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation505', 0, ''),
('1100', 'TELEPRESENCE', 1, 1, '', 'loadInformation520', 0, ''),
('200', 'TELEPRESENCE', 1, 1, '', 'loadInformation557', 0, ''),
('400', 'TELEPRESENCE', 1, 1, '', 'loadInformation558', 0, ''),
('EX90', 'TELEPRESENCE', 1, 1, '', 'loadInformation584', 0, ''),
('500-32', 'TELEPRESENCE', 1, 1, '', 'loadInformation590', 0, ''),
('1300-47', 'TELEPRESENCE', 1, 1, '', 'loadInformation591', 0, ''),
('TX1310-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation596', 0, ''),
('EX60', 'TELEPRESENCE', 1, 1, '', 'loadInformation604', 0, ''),
('C90', 'TELEPRESENCE', 1, 1, '', 'loadInformation606', 0, ''),
('C60', 'TELEPRESENCE', 1, 1, '', 'loadInformation607', 0, ''),
('C40', 'TELEPRESENCE', 1, 1, '', 'loadInformation608', 0, ''),
('C20', 'TELEPRESENCE', 1, 1, '', 'loadInformation609', 0, ''),
('C20-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation610', 0, ''),
('C60-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation611', 0, ''),
('C40-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation612', 0, ''),
('C60-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation613', 0, ''),
('C60-52D', 'TELEPRESENCE', 1, 1, '', 'loadInformation614', 0, ''),
('C60-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation615', 0, ''),
('C90-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation616', 0, ''),
('MX200', 'TELEPRESENCE', 1, 1, '', 'loadInformation617', 0, ''),
('TX9000', 'TELEPRESENCE', 1, 1, '', 'loadInformation619', 0, ''),
('TX9200', 'TELEPRESENCE', 1, 1, '', 'loadInformation620', 0, ''),
('SX20', 'TELEPRESENCE', 1, 1, '', 'loadInformation626', 0, ''),
('MX300', 'TELEPRESENCE', 1, 1, '', 'loadInformation627', 0, ''),
('C40-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation633', 0, ''),
('Jabber', 'CISCO', 1, 1, '', 'loadInformation652', 0, ''),
('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, ''),
('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, ''),
('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, ''),
('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, ''),
('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, ''),
('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, ''),
('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, ''),
('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, ''),
('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, ''),
('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, ''),
('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, ''),
('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, ''),
('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, ''),
('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, ''),
('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, ''),
('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, ''),
('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, ''),
('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, ''),
('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, ''),
('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, ''),
('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, ''),
('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, ''),
('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, ''),
('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, ''),
('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, ''),
('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL),
('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL),
('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),
('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),
('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),
('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
$sql = "REPLACE INTO sccpdevmodel (model, vendor, dns, buttons, loadimage, loadinformationid, enabled, nametemplate) VALUES" . implode(',',$devModelArr);
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
}
//}
return;
}
@ -747,9 +814,9 @@ function InstallDbCreateViews($sccp_compatible)
GROUP BY sccpdevice.name;";
}
$stmt = $db->prepare($sql);
$stmt->execute();
if (DB::IsError($stmt)) {
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
$result = $stmt->execute();
if (!$result) {
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s"), $sql));
}
outn("<li>" . _("(Re)Create sccplineconfig view") . "</li>");
@ -766,9 +833,9 @@ function InstallDbCreateViews($sccp_compatible)
sccpline.namedcallgroup, sccpline.namedpickupgroup, sccpline.phonecodepage, sccpline.videomode
FROM sccpline";
$stmt = $db->prepare($sql);
$stmt->execute();
if (DB::IsError($stmt)) {
die_freepbx(sprintf(_("Error updating sccplineconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
$result = $stmt->execute();
if (!$result) {
die_freepbx(sprintf(_("Error updating sccplineconfig view. Command was: %s"), $sql));
}
return true;
}
@ -957,13 +1024,6 @@ function addDriver($sccp_compatible) {
$file = $amp_conf['AMPWEBROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
$contents = "<?php include '/var/www/html/admin/modules/sccp_manager/sccpManClasses/Sccp.class.php.v{$sccp_compatible}'; ?>";
file_put_contents($file, $contents);
$dir = $cnf_int->get('ASTETCDIR');
if (!file_exists("{$dir}/sccp.conf")) { // System re Config
outn("<li>" . _("Adding default configuration file ...") . "</li>");
$sccpfile = file_get_contents($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
file_put_contents("{$dir}/sccp.conf", $sccpfile);
}
}
function checkTftpServer() {
outn("<li>" . _("Checking TFTP server path and availability ...") . "</li>");
@ -1082,19 +1142,6 @@ function cleanUpSccpSettings() {
outn(_("Found DB Schema : {$settingsFromDb['sccp_compatible']['data']}"));
}
// Check that required settings are initialised and update db and $settingsFromDb if not
/*
foreach ($extconfigs->getExtConfig('sccpDefaults') as $key => $value) {
if (empty($settingsFromDb[$key])) {
$settingsFromDb[$key] = array('keyword' => $key, 'data' => $value, 'type' => 0, 'seq' => 0);
$sql = "REPLACE INTO sccpsettings (keyword, data, seq, type) VALUES ('{$key}', '{$value}', 0, 0)";
$results = $db->query($sql);
if (DB::IsError($results)) {
die_freepbx(_("Error updating sccpsettings: $key"));
}
}
}
*/
// Clean up sccpsettings to remove legacy values.
$xml_vars = $amp_conf['AMPWEBROOT'] . "/admin/modules/sccp_manager/conf/sccpgeneral.xml.v{$sccp_compatible}";
$thisInstaller->xml_data = simplexml_load_file($xml_vars);
@ -1162,6 +1209,8 @@ function cleanUpSccpSettings() {
// Override certain chan-sccp defaults as they are based on a non-FreePbx system
$settingsFromDb['context']['systemdefault'] = 'from-internal';
$settingsFromDb['directed_pickup']['systemdefault'] = 'no';
// Override this chan-sccp default as it is a potential security risk. See Issue 29
$settingsFromDb['hotline_enabled']['systemdefault'] = 'no';
unset($sysConfiguration[$key]);
}
@ -1223,9 +1272,10 @@ function cleanUpSccpSettings() {
)";
$results = $db->query($sql);
}
// Now correct sccp.conf to replace any illegal settings
$thisInstaller->createDefaultSccpConfig($settingsFromDb, $cnf_int->get('ASTETCDIR'));
// Need to load any existing sccp.conf so that retain softkeys section if exists.
$sccp_conf_init = $thisInstaller->initialiseConfInit();
// Now correct sccp.conf to replace any illegal settings passing $sccp_conf_init
$thisInstaller->createDefaultSccpConfig($settingsFromDb, $cnf_int->get('ASTETCDIR'), $sccp_conf_init);
// have to correct prior verion sccpline lists for allow/disallow and deny permit. Prior
// versions used csl, but chan-sccp expects ; separated lists when returned by db.

View file

@ -1,7 +1,7 @@
<module>
<rawname>sccp_manager</rawname>
<name>SCCP Manager</name>
<version>14.3.0.20</version>
<version>14.5.0.4</version>
<type>setup</type>
<category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher>
@ -28,8 +28,28 @@
* Version 14.3.0.16 * - Test version for freepbx upgrader.
* Version 14.3.0.17 * - Test version for freepbx upgrader.
* Version 14.3.0.18 * - Fix Issue 42
* Version 14.3.0.22 * - Fix Issue 50
* Version 14.3.0.23 * - Fix Issue 49
* Version 14.3.0.25 * - Fix Issue 55
* Version 14.3.0.26 * - Fix Issue 54
* Version 14.3.0.27 * - Standardise treatment of SIP and SCCP hardware.
* Version 14.3.0.28 * - Fix issue with RNav which caused exception with new device
* Version 14.3.0.29 * - Fix issue reloading page after saving settings and not restarting devices.
* Version 14.3.0.30 * - Fix reversion in 29. Not returning to correct page when saving device.
* Version 14.3.0.31 * - Fix rewrite rules.
* Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this.
* Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB)
* Version 14.4.0.3 * - Change method of selecting phonecodepage depending on if is java phone.
* Version 14.4.0.5 * - Fix issue #59.
* Version 14.5.0.2 * - Fix issue #32.
* Version 14.5.0.4 * - Fix issue where values with spaces are truncated. Preserve softkeys accross installs
</changelog>
<location>https://github.com/chan-sccp/sccp_manager</location>
<depends>
<version>15</version>
<phpversion>7.0</phpversion>
<phpcomponent>zip</phpcomponent>
</depends>
<supported>
<version>13.0.0.2M</version>
</supported>
@ -42,6 +62,7 @@
<field name="name" type="string" length="15" 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"/>
<field name="_description" type="string" length="45" notnull="false"/>
<field name="tzoffset" type="string" length="5" notnull="false"/>
<field name="imageversion" type="string" length="31" notnull="false"/>
@ -75,8 +96,11 @@
<field name="backgroundThumbnail" type="string" length="255" notnull="false"/>
<field name="ringtone" type="string" length="255" notnull="false"/>
<field name="callhistory_answered_elsewhere" type="string" notnull="false"/>
<field name="loginname" type="string" length="20" default="NULL" notnull="false"/>
<field name="_loginname" type="string" length="20" notnull="false"/>
<field name="_profileid" type="integer" default="0"/>
<field name="profileid" type="integer" default="0"/>
<field name="_profileid" type="integer" notnull="false"/>
<field name="dialrules" type="string" length="255" default="NULL" notnull="false"/>
<field name="_dialrules" type="string" length="255" notnull="false"/>
<field name="useRedialMenu" type="string" length="5" default="no" notnull="false"/>
<field name="cfwdnoanswer" type="string" default="on" notnull="false"/>
@ -84,6 +108,71 @@
<field name="monitor" type="string" notnull="false"/>
<field name="transfer_on_hangup" type="string" notnull="false"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<field name="logserver" type="string" length="100" default="NULL" notnull="false"/>
<field name="_logserver" type="string" length="100" notnull="false"/>
<field name="daysdisplaynotactive" type="string" length="20" default="NULL" notnull="false"/>
<field name="_daysdisplaynotactive" type="string" length="20" notnull="false"/>
<field name="displayontime" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayontime" type="string" length="20" notnull="false"/>
<field name="displayonduration" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayonduration" type="string" length="20" notnull="false"/>
<field name="displayidletimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayidletimeout" type="string" length="20" notnull="false"/>
<field name="settingsaccess" type="string" default="off"/>
<field name="_settingsaccess" type="string" notnull="false"/>
<field name="videocapability" type="string" default="off"/>
<field name="_videocapability" type="string" notnull="false"/>
<field name="webaccess" type="string" default="off"/>
<field name="_webaccess" type="string" notnull="false"/>
<field name="webadmin" type="string" default="off"/>
<field name="_webadmin" type="string" notnull="false"/>
<field name="pcport" type="string" default="on"/>
<field name="_pcport" type="string" notnull="false"/>
<field name="spantopcport" type="string" default="on"/>
<field name="_spantopcport" type="string" notnull="false"/>
<field name="voicevlanaccess" type="string" default="off"/>
<field name="_voicevlanaccess" type="string" notnull="false"/>
<field name="enablecdpswport" type="string" default="off"/>
<field name="_enablecdpswport" type="string" notnull="false"/>
<field name="enablecdppcport" type="string" default="off"/>
<field name="_enablecdppcport" type="string" notnull="false"/>
<field name="enablelldpswport" type="string" default="off"/>
<field name="_enablelldpswport" type="string" notnull="false"/>
<field name="enablelldppcport" type="string" default="off"/>
<field name="_enablelldppcport" type="string" notnull="false"/>
<field name="firstdigittimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_firstdigittimeout" type="string" length="20" notnull="false"/>
<field name="digittimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_digittimeout" type="string" length="20" notnull="false"/>
<field name="cfwdnoanswer_timeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_cfwdnoanswer_timeout" type="string" length="20" notnull="false"/>
<field name="autoanswer_ring_time" type="string" length="20" default="NULL" notnull="false"/>
<field name="_autoanswer_ring_time" type="string" length="20" notnull="false"/>
<field name="autoanswer_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_autoanswer_tone" type="string" length="20" notnull="false"/>
<field name="remotehangup_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_remotehangup_tone" type="string" length="20" notnull="false"/>
<field name="transfer_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_transfer_tone" type="string" length="20" notnull="false"/>
<field name="callwaiting_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_callwaiting_tone" type="string" length="20" notnull="false"/>
<field name="callanswerorder" type="string" default="latestfirst"/>
<field name="_callanswerorder" type="string" notnull="false"/>
<field name="sccp_tos" type="string" length="11" default="0x68"/>
<field name="_sccp_tos" type="string" length="11" notnull="false"/>
<field name="sccp_cos" type="string" length="11" default="0x4"/>
<field name="_sccp_cos" type="string" length="11" notnull="false"/>
<field name="dev_sshPassword" type="string" length="25" default="cisco"/>
<field name="_dev_sshPassword" type="string" length="25" notnull="false"/>
<field name="dev_sshUserId" type="string" length="25" default="cisco"/>
<field name="_dev_sshUserId" type="string" length="25" notnull="false"/>
<field name="phonepersonalization" type="string" length="25" default="0"/>
<field name="_phonepersonalization" type="string" length="25" notnull="false"/>
<field name="devlang" type="string" length="50" default="NULL" notnull="false"/>
<field name="_devlang" type="string" length="50" notnull="false"/>
<field name="netlang" type="string" length="50" default="NULL" notnull="false"/>
<field name="_netlang" type="string" length="50" notnull="false"/>
<field name="keepalive" type="integer" default="60" notnull="false"/>
</table>
<table name="sccpline">
<field name="id" type="integer" autoincrement="true"/>
@ -125,6 +214,18 @@
<field name="setvar" type="string" length="50" notnull="false"/>
<field name="name" type="string" length="40" primarykey="true"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<field name="regcontext" type="string" length="20" default="sccpregistration" notnull="false"/>
<field name="_regcontext" type="string" length="20" notnull="false"/>
<field name="transfer_on_hangup" type="string" default="off"/>
<field name="_transfer_on_hangup" type="string" notnull="false"/>
<field name="autoselectline_enabled" type="string" default="off"/>
<field name="_autoselectline_enabled" type="string" notnull="false"/>
<field name="autocall_select" type="string" default="off"/>
<field name="_autocall_select" type="string" notnull="false"/>
<field name="backgroundImageAccess" type="string" default="off"/>
<field name="_backgroundImageAccess" type="string" notnull="false"/>
<field name="callLogBlfEnabled" type="string" default="2"/>
<field name="_callLogBlfEnabled" type="string" notnull="false"/>
<key name="id" type="unique">
<column name="id"/>
</key>

View file

@ -22,7 +22,7 @@ class dbinterface
public function info()
{
$Ver = '13.0.10'; // This should be updated
$Ver = '14.0.0.1'; // This should be updated
return array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver);
}
@ -44,15 +44,13 @@ class dbinterface
return $result;
}
public function getSccpDeviceTableData($dataid, $data = array())
public function getSccpDeviceTableData(string $dataid, $data = array())
{
// $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE
$stmt = '';
$stmts = '';
$stmtU = '';
if ($dataid == '') {
return false;
}
switch ($dataid) {
case 'extGrid':
// only called by getExtensionGrid from hardware.extension.php view
@ -266,7 +264,7 @@ class dbinterface
$this->db->prepare('TRUNCATE sccpsettings')->execute();
$stmt = $this->db->prepare('INSERT INTO sccpsettings (keyword, data, seq, type, systemdefault) VALUES (:keyword,:data,:seq,:type,:systemdefault)');
} else {
$stmt = $this->db->prepare('REPLACE INTO sccpsettings (keyword, data, seq, type, systemdefault) VALUES (:keyword,:data,:seq,:type,:systemdefault)');
$stmt = $this->db->prepare('REPLACE INTO sccpsettings (keyword, seq, type, data, systemdefault) VALUES (:keyword,:seq,:type,:data,:systemdefault)');
}
foreach ($save_value as $key => $dataArr) {
if (empty($dataArr)) {
@ -336,27 +334,7 @@ class dbinterface
break;
case 'add':
foreach ($save_value as $button_array) {
$stmt = $this->db->prepare("INSERT INTO sccpbuttonconfig SET ref = :ref, reftype = :reftype, instance = :instance, buttontype = :buttontype, name = :name, options = :options
ON DUPLICATE KEY UPDATE ref = :refU, reftype = :reftypeU, instance = :instanceU, buttontype = :buttontypeU, name = :nameU, options = :optionsU");
$stmt->bindParam(':ref', $button_array['ref'],\PDO::PARAM_STR);
$stmt->bindParam(':reftype', $button_array['reftype'],\PDO::PARAM_STR);
$stmt->bindParam(':instance', $button_array['instance'],\PDO::PARAM_INT);
$stmt->bindParam(':buttontype', $button_array['buttontype'],\PDO::PARAM_STR);
$stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR);
$stmt->bindParam(':options', $button_array['options'],\PDO::PARAM_STR);
$stmt->bindParam(':refU', $button_array['ref'],\PDO::PARAM_STR);
$stmt->bindParam(':reftypeU', $button_array['reftype'],\PDO::PARAM_STR);
$stmt->bindParam(':instanceU', $button_array['instance'],\PDO::PARAM_INT);
$stmt->bindParam(':buttontypeU', $button_array['buttontype'],\PDO::PARAM_STR);
$stmt->bindParam(':nameU', $button_array['name'],\PDO::PARAM_STR);
$stmt->bindParam(':optionsU', $button_array['options'],\PDO::PARAM_STR);
$result = $stmt->execute();
}
break;
/*
case 'add':
foreach ($save_value as $button_array) {
$stmt = $this->db->prepare('INSERT INTO sccpbuttonconfig (ref, reftype, instance, buttontype, name, options) VALUES (:ref, :reftype, :instance, :buttontype, :name, :options)');
$stmt = $this->db->prepare("INSERT INTO sccpbuttonconfig SET ref = :ref, reftype = :reftype, instance = :instance, buttontype = :buttontype, name = :name, options = :options");
$stmt->bindParam(':ref', $button_array['ref'],\PDO::PARAM_STR);
$stmt->bindParam(':reftype', $button_array['reftype'],\PDO::PARAM_STR);
$stmt->bindParam(':instance', $button_array['instance'],\PDO::PARAM_INT);
@ -364,9 +342,9 @@ class dbinterface
$stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR);
$stmt->bindParam(':options', $button_array['options'],\PDO::PARAM_STR);
$result = $stmt->execute();
}
break;
*/
case 'clear';
// Clear is equivalent of delete + insert. Mode is used in order to activate trigger.
$this->write('sccpbuttons', '', $mode = 'delete','', $hwid);
@ -377,6 +355,36 @@ class dbinterface
}
return $result;
}
//******** Get SIP settings *******
public function getSipTableData(string $dataid, $line='') {
global $db;
$tech = array();
switch ($dataid) {
case "DeviceById":
// TODO: This needs to be rewritten
$stmt = $this->db->prepare("SELECT keyword,data FROM sip WHERE id = '${line}'");
$stmt->execute();
$tech = $stmt->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
foreach ($tech as &$value) {
$value = $value[0];
}
return $tech;
case "extensionList";
$stmt = $this->db->prepare("SELECT id as name, data as label FROM sip WHERE keyword = 'callerid' order by name");
$stmt->execute();
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
/*
foreach ($result as $value) {
if (empty($tech[$value['id']]['id'])) {
$tech[$value['id']]['id']= $value['id'];
}
$tech[$value['id']][$value['keyword']]=$value['data'];
}
*/
return $result;
}
}
/*
* Maybe Replace by SccpTables ??!

View file

@ -175,7 +175,6 @@ class extconfigs
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil', 'codepage' => 'ISO8859-1'),
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal', 'codepage' => 'ISO8859-1'),
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania', 'codepage' => 'ISO8859-1'),
'ru_RU' => array('code' => 'ru', 'language' => 'Russian', 'locale' => 'Russian_Russian_Federation', 'codepage' => 'CP1251'),
'sk_SK' => array('code' => 'sk', 'language' => 'Slovakian', 'locale' => 'Slovak_Slovakia', 'codepage' => 'ISO8859-1'),
'sl_SL' => array('code' => 'sl', 'language' => 'Slovenian', 'locale' => 'Slovenian_Slovenia', 'codepage' => 'ISO8859-1'),
'sr_ME' => array('code' => 'sr', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Montenegro', 'codepage' => 'ISO8859-1'),

View file

@ -4,6 +4,8 @@ namespace FreePBX\modules\Sccp_manager;
class formcreate
{
use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions;
public function __construct($parent_class = null) {
$this->buttonDefLabel = 'chan-sccp';
$this->buttonHelpLabel = 'site';
@ -34,7 +36,7 @@ class formcreate
if (empty($child->nameseparator)) {
$child->nameseparator = ' / ';
}
$i = 0;
?>
<div class="element-container">
<div class="row">
@ -45,28 +47,23 @@ class formcreate
</div>
<?php
if (!empty($sccp_defaults[$shortId]['systemdefault'])) {
// There is a system default, so add button to customise or reset
// the closing } is after the code to include the button at line ~498
//-- Start include of defaults button --
echo "<div class=col-md-3>";
// There is a system default, so add button to customise or reset
//-- Start include of defaults button --
echo "<div class=col-md-3>";
}
// Can have multiple inputs for a field which are displayed with a separator
$i = 0;
foreach ($child->xpath('input') as $value) {
$res_n = (string)$value->name;
$res_name = $npref . $res_n;
//if (!empty($fvalues[$res_n])) {
$value->value = $fvalues[$res_n]['data'];
if (!empty($fvalues[$res_n]['data'])) {
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) {
$usingSysDefaults = false;
}
if (!empty($fvalues[$res_n]['data'])) {
if ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data']) {
$usingSysDefaults = false;
}
//}
// Default to chan-sccp defaults, not xml defaults.
//if (empty($value->value)) {
//$value->value = $sccp_defaults[$res_n]['systemdefault'];
//}
}
if (empty($value->type)) {
$value->type = 'text';
}
@ -78,29 +75,26 @@ class formcreate
}
// Output current value
if (empty($value->value)) {
echo "Value not found for {$res_n}";
echo "{$res_n} has not been set";
}
echo $value->value;
$i ++;
}
if (!empty($sccp_defaults[$shortId]['systemdefault'])) {
?>
</div>
<div class="col-md-4">
<span class="radioset">
<input type="checkbox"
<?php
echo " data-for={$res_id} data-type=text id=usedefault_{$res_id} ";
if ($usingSysDefaults) {
// Setting a site specific value
echo " data-for={$res_id}";
echo " class=sccp-edit";
echo " id=usedefault_{$res_id}";
echo " :checked";
echo "class=sccp-edit :checked ";
} else {
// reverting to chan-sccp default values
echo " data-for={$res_id}";
echo " class=sccp-restore";
echo " id=usedefault_{$res_id}";
echo " ";
echo "class=sccp-restore data-default={$sccp_defaults[$res_n]['systemdefault']} ";
}
?>
>
@ -123,8 +117,8 @@ class formcreate
<!-- Finish include of defaults button -->
<?php
// Close the conditional include of the defaults button opened at line ~425
}
// Close the conditional include of the defaults button opened at line ~47
}
?>
<div class="col-md-9">
@ -137,16 +131,11 @@ class formcreate
if (empty($res_id)) {
$res_id = $res_name;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$value->value = $fvalues[$res_n]['data'];
}
if (!empty($fvalues[$res_n]['data'])) {
$value->value = $fvalues[$res_n]['data'];
}
// Default to chan-sccp defaults, not xml defaults.
if (empty($value->value)) {
$value->value = $sccp_defaults[$res_n]['systemdefault'];
}
if (!$usingSysDefaults) {
// Default to chan-sccp defaults, not xml defaults if reverting to defaults or empty
if ((empty($value->value)) || ($usingSysDefaults)) {
$value->value = $sccp_defaults[$res_n]['systemdefault'];
}
if (empty($value->type)) {
@ -187,6 +176,8 @@ class formcreate
}
function addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref) {
//$Sccp_manager = \FreePBX::create()->Sccp_manager;
// IED fields are arrays of networks and masks, or ip and ports.
$res_input = '';
$res_value = '';
$opt_at = array();
@ -200,20 +191,27 @@ class formcreate
// $res_value
$lnhtm = '';
$res_id = $napref.$child->name;
$i = 0;
//$i = 0;
$max_row = 255;
if (!empty($child->max_row)) {
$max_row = $child->max_row;
}
// fvalues are current settings - the encoding depends on where the data is
// coming from: IED fields in sccpsettings are json, elsewhere they are ; delimited.
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_value = explode(';', $fvalues[$res_n]['data']);
$res_value = $this->convertCsvToArray($fvalues[$res_n]['data']);
}
}
if ($res_n == 'srst_ip') {
$res_value = $this->convertCsvToArray($sccp_defaults[$res_n]['data']);
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
}
?>
<div class="element-container">
<div class="row">
@ -231,15 +229,21 @@ class formcreate
echo '<div class="form-group form-inline">';
foreach ($child->xpath('cbutton') as $value) {
$res_n = $res_id.'[0]['.$value['field'].']';
$res_vf = '';
// res_vf sets the state of the checkbox internal. This is always
// the first array element in $res_value if set
$res_vf = false;
if ($value['value']=='NONE' && empty($res_value)) {
$res_vf = 'active';
$res_vf = true;
}
$ch_key = array_search($value['value'], $res_value);
if ($ch_key !== false) {
unset($res_value[$ch_key]);
$res_vf = 'active';
$res_value = explode(';', implode(';', $res_value));
if ((isset($res_value[0]['internal'])) || ($res_value[0] == 'internal')) {
$res_vf = true;
// Remove the value from $res_value so that do not add empty row for internal
array_shift($res_value);
// If now have an empty array, add a new empty element
if (count($res_value) == 0) {
// although handle also ip, internal is never set for those arrays
$res_value[0] = array('net'=>"", 'mask' =>"");
}
}
$opt_hide ='';
$opt_class="button-checkbox";
@ -263,9 +267,9 @@ class formcreate
$opt_class .= " ".(string)$value->class;
}
echo '<span class="'.$opt_class.'"'.$opt_hide.'><button type="button" class="btn '.$res_vf.'" data-color="primary">';
echo '<i class="state-icon '. (($res_vf == 'active')?'glyphicon glyphicon-check"':'glyphicon glyphicon-uncheck'). '"></i> ';
echo $value.'</button><input type="checkbox" name="'. $res_n.'" class="hidden" '. (($res_vf == 'active')?'checked="checked"':'') .'/></span>';
echo '<span class="'.$opt_class.'"'.$opt_hide.'><button type="button" class="btn '.(($res_vf) ? 'active':"").'" data-color="primary">';
echo '<i class="state-icon '. (($res_vf)?'glyphicon glyphicon-check"':'glyphicon glyphicon-uncheck'). '"></i> ';
echo $value.'</button><input type="checkbox" name="'. $res_n.'" class="hidden" '. (($res_vf)?'checked="checked"':'') .'/></span>';
}
echo '</div>';
}
@ -274,36 +278,40 @@ class formcreate
$opt_class .= " ".(string)$child->class;
}
echo '<div class = "'.$opt_class.'">';
foreach ($res_value as $dat_v) {
$i=1;
foreach ($res_value as $addrArr) {
?>
<div class = "<?php echo $res_id;?> form-group form-inline" data-nextid=<?php echo $i+1;?> >
<div class = "<?php echo $res_id;?> form-group form-inline" data-nextid=<?php echo $i;?> id= <?php echo $res_id . $i;?>>
<?php
//$res_vf = explode('/', $dat_v);
$i2 = 0;
foreach ($child->xpath('input') as $value) {
$res_n = $res_id.'['.$i.']['.$value['field'].']';
$fields_id = (string)$value['field'];
//$opt_at[$fields_id]['nameseparator']=(string)$value['nameseparator'];
$field_id = (string)$value['field'];
$res_n = $res_id.'['.$i.']['.$field_id.']';
if (!empty($value->class)) {
$opt_at[$fields_id]['class']='form-control ' .(string)$value->class;
$opt_at[$field_id]['class']='form-control ' .(string)$value->class;
}
//$opt_at[$fields_id]['nameseparator']=(string)$value['nameseparator'];
if (!empty((string)$value['nameseparator'])) {
$res_vf = explode((string)$value['nameseparator'], $dat_v);
}
echo '<input type="text" name="'. $res_n.'" class="'.$opt_at[$fields_id]['class'].'" value="'.$res_vf[$i2].'"';
$defValue = (isset($addrArr[$field_id])) ? $addrArr[$field_id]: "";
echo '<input type="text" name="'. $res_n.'" class="'.$opt_at[$field_id]['class'].'" value="'. $defValue .'"';
if (isset($value->options)) {
foreach ($value->options ->attributes() as $optkey => $optval) {
$opt_at[$fields_id]['options'][$optkey]=(string)$optval;
$opt_at[$field_id]['options'][$optkey]=(string)$optval;
$opt_at[$field_id]['nameseparator'] = (null !== (string)$value['nameseparator']) ? (string)$value['nameseparator'] : '';
echo ' '.$optkey.'="'.$optval.'"';
}
}
echo '> '.(string)$value['nameseparator'].' ';
$i2 ++;
}
if (!empty($child->add_pluss)) {
echo '<button type="button" class="btn btn-primary btn-lg input-js-add" id="'.$res_id.'-btn" data-id="'.$res_id.'" data-for="'.$res_id.'" data-max="'.$max_row.'"data-json="'.bin2hex(json_encode($opt_at)).'"><i class="fa fa-plus pull-right"></i></button>';
if ($i <= count($res_value)) {
echo '<button type="button" class="btn btn-danger btn-lg input-js-remove" id="'.$res_id.$i.'-btn-del" data-id="'.$res_id.$i.'"><i class="fa fa-minus pull-right"></i></button>';
}
// only add plus button to the last row
if ($i == count($res_value)) {
echo '<button type="button" class="btn btn-primary btn-lg input-js-add" id="'.$res_id.$i.'-btn-add" data-id="'.$res_id.'" data-row="'.$i.'" data-for="'.$res_id.'" data-max="'.$max_row.'"data-json="'.bin2hex(json_encode($opt_at)).'"><i class="fa fa-plus pull-right"></i></button>';
}
}
echo '</div>';
$i++;
@ -373,17 +381,15 @@ class formcreate
$res_v = (string)$fvalues[$res_n]['data'];
}
}
if ($sccp_defaults[$res_n]['systemdefault'] != $res_v) {
$usingSysDefaults = false;
}
if (!empty($sccp_defaults[$res_n]['systemdefault'])) {
// There is a system default, so add button to customise or reset
// the closing } is after the code to include the button at line ~498
// the closing } is after the code to include the button at line ~438
//-- Start include of defaults button --
echo "<div class='col-md-3'>";
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) {
$usingSysDefaults = false;
}
// Output current value
echo $res_v;
?>
@ -392,20 +398,13 @@ class formcreate
<span class="radioset">
<input type="checkbox"
<?php
echo " data-for={$res_id} data-type=radio id=usedefault_{$res_id} ";
if ($usingSysDefaults) {
// Setting a site specific value
echo " data-for={$res_id}";
echo " data-type=radio";
echo " class=sccp-edit";
echo " id=usedefault_{$res_id}";
echo " :checked";
echo " class=sccp-edit :checked ";
} else {
// reverting to chan-sccp default values
echo " data-for={$res_id}";
echo " data-type=radio";
echo " class=sccp-restore";
echo " id=usedefault_{$res_id}";
echo " ";
echo " data-default={$sccp_defaults[$res_n]['systemdefault']} class=sccp-restore ";
}
?>
>
@ -427,7 +426,7 @@ class formcreate
</div>
<!-- Finish include of defaults button -->
<?php
// Close the conditional include of the defaults button opened at line ~425
// Close the conditional include of the defaults button opened at line ~385
}
?>
@ -437,7 +436,7 @@ class formcreate
$i = 0;
$opt_hide = '';
if (!$usingSysDefaults) {
if ($usingSysDefaults) {
$res_v = $sccp_defaults[$res_n]['systemdefault'];
}
if (!empty($child->option_hide)) {
@ -449,8 +448,6 @@ class formcreate
}
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
}
foreach ($child->xpath('button') as $value) {
$opt_disabled = '';
if (in_array($value, $disabledButtons )) {
@ -458,15 +455,15 @@ class formcreate
}
$val_check = strtolower((string)$value[@value]);
if ($val_check == strtolower($res_v)) {
$val_check = " checked";
$val_check = "checked";
} else {
if ($val_check == '' || $val_check == 'none' ) {
if (strtolower($res_v) == 'none' || $res_v == '' ) {
$val_check = " checked";
$val_check = "checked";
} else {$val_check = "";}
} else {$val_check = "";}
}
echo "<input type=radio name= {$res_id} id=${res_id}_{$i} value={$value[@value]} {$val_check} {$opt_hide} {$opt_disabled}>";
echo "<input type=radio name= {$res_id} id=${res_id}_{$i} value='{$value[@value]}' {$val_check} {$opt_hide} {$opt_disabled}>";
echo "<label for= {$res_id}_{$i}>{$value}</label>";
$i++;
}
@ -751,6 +748,7 @@ class formcreate
$select_opt= $model_list;
break;
case 'SDML':
// Sccp extensions
$assignedExts = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('getAssignedExtensions');
$select_opt = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('SccpExtension');
foreach ($assignedExts as $name => $nameArr ) {
@ -758,6 +756,11 @@ class formcreate
}
$child->default = $fvalues['defaultLine'];
break;
case 'SDMF':
// Sip extensions
$select_opt = \FreePBX::Sccp_manager()->dbinterface->getSipTableData('extensionList');
$child->default = $fvalues['defaultLine'];
break;
case 'SDE':
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model');
$extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');

View file

@ -1,163 +0,0 @@
<?php
/**
*
*/
namespace FreePBX\modules\Sccp_manager;
class sipconfigs
{
// protected $database;
// protected $freepbx;
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
// $freepbx
// $this->database = $freepbx->Database;
}
public function info()
{
$Ver = '13.0.4';
return array('Version' => $Ver,
'about' => 'Sip Setings ver: ' . $Ver);
}
public function get_db_sip_TableData($dataid, $data = array())
{
global $db;
if ($dataid == '') {
return false;
}
switch ($dataid) {
case "Device":
$sql = "SELECT * FROM sip ORDER BY `id`";
$tech = array();
try {
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
foreach ($raw_settings as $value) {
if (empty($tech[$value['id']]['id'])) {
$tech[$value['id']]['id']= $value['id'];
}
$tech[$value['id']][$value['keyword']]=$value['data'];
}
} catch (\Exception $e) {
}
return $tech;
case "DeviceById":
$sql = "SELECT keyword,data FROM sip WHERE id = ?";
$sth = $db->prepare($sql);
$tech = array();
try {
$id = $data['id'];
$sth->execute(array($id));
$tech = $sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
foreach ($tech as &$value) {
$value = $value[0];
}
} catch (\Exception $e) {
}
return $tech;
}
}
public function getSipConfig()
{
$result = array();
// $def_sip_proto = 'sip';
// $def_proto = 'tcp';
// $supp_proto = '';
// $result['sipport'] = \FreePBX::Sipsettings()->getConfig('bindport');
// $result['tlsport'] = \FreePBX::Sipsettings()->getConfig('tlsbindport');
// $tmp_sipsetigs = \FreePBX::Sipsettings()->getChanSipSettings();
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
$if_list = $this->paren_class ->getIpInformation('ip4');
/*
$tmp_bind_ip = !empty($tmp_sipsetigs['externhost_val']) ? $tmp_sipsetigs['externhost_val'] : '';
$tmp_bind_ip = !empty($tmp_sipsetigs['externip_val']) ? $tmp_sipsetigs['externip_val'] : $tmp_bind_ip;
$tmp_bind_ip = !empty($tmp_sipsetigs['bindaddr']) ? $tmp_sipsetigs['bindaddr'] : $tmp_bind_ip;
*/
$tmp_binds = is_array($tmp_binds) ? $tmp_binds: array();
$result = array();
foreach ($tmp_binds as $f_protocol => $f_bind) {
foreach ($f_bind as $f_ip => $f_port) {
if (($f_ip == '0.0.0.0') || ($f_ip == '[::]')) {
foreach ($if_list as $f_if => $f_data) {
if ($f_data['ip'] == "127.0.0.1") {
continue;
}
if (empty($result[$f_protocol][$f_data['ip']])) {
$result[$f_protocol][$f_data['ip']]= $f_port;
} else {
$result[$f_protocol][$f_data['ip']]= array_merge($result[$f_protocol][$f_data['ip']],$f_port);
}
$result[$f_protocol][$f_data['ip']]['ip']=$f_data['ip'];
}
} else {
$result[$f_protocol][$f_ip]=$f_port;
$result[$f_protocol][$f_ip]['ip']=$f_ip;
}
}
}
return $result;
/*
// $result['sipbind'] = $tmp_bind_ip;
if (empty($tmp_sip_binds[$def_sip_proto])){
$def_proto = 'pjsip';
}
return $result;
foreach ($tmp_sip_binds[$def_sip_proto] as $key => $value) {
if (empty($value[$def_proto])) {
$def_proto = 'udp';
$supp_proto = 'udp';
} else {
$supp_proto = !empty($value['udp']) ? 'tcp;udp' : 'tcp';
}
if (empty($def_key)) {
$def_key = $key;
}
if ($key != '0.0.0.0') {
$tmp_bind_ip = $key;
}
$result['sipbindport'] = $value[$def_proto];
}
$result['sipbind'] = $tmp_bind_ip;
$result['sipsuportproto'] = $supp_proto;
$binds= array();
$driver = \FreePBX::Config()->get_conf_setting('ASTSIPDRIVER');
if ($driver == "both" || $driver == "chan_pjsip") {
$b = \FreePBX::Sipsettings()->getConfig("binds");
$b = is_array($b) ? $b : array();
foreach($b as $protocol => $bind) {
foreach($bind as $ip => $state) {
if($state != "on") {
continue;
}
$p = \FreePBX::Sipsettings()->getConfig($protocol."port-".$ip);
$result['nb3'.$protocol] = $p;
if ($flatten) {
$binds['pjsip']['[::]'][$protocol] = $p;
} else {
$binds['pjsip'][$ip][$protocol] = $p;
}
}
}
} else {
$binds['pjsip'] = array("0.0.0.0" => array());
}
$result['nd'] = $driver;
$result['nb'] = $binds;
$result['nb2'] = $b;
return $result;
*
*/
}
}

View file

@ -15,12 +15,52 @@ namespace FreePBX\modules\Sccp_manager;
class xmlinterface
{
use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions;
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
$this->langCodeArray = array(
'Arabic_Saudi_Arabia' => 'ar',
'Bulgarian_Bulgaria' => 'bg',
'Czech_Czech_Republic' => 'cz',
'Danish_Denmark' => 'da',
'German_Germany' => 'de',
'Greek_Greece' => 'el',
'AU_English_United_States' => 'en',
'English_United_Kingdom' => 'en',
'English_United_States' => 'en',
'Spanish_Spain' => 'es',
'Estonian_Estonia' => 'et',
'Finnish_Finland' => 'fi',
'French_Canada' => 'fr',
'French_France' => 'fr',
'Hebrew_Israel' => 'he',
'Croatian_Croatia' => 'hr',
'Hungarian_Hungary' => 'hu',
'Italian_Italy' => 'it',
'Japanese_Japan' => 'ja',
'Korean_Korea_Republic' => 'ko',
'Lithuanian_Lithuania' => 'lt',
'Latvian_Latvia' => 'lv',
'Dutch_Netherlands' => 'nl',
'Norwegian_Norway' => 'no',
'Polish_Poland' => 'pl',
'Portuguese_Brazil' => 'pt',
'Portuguese_Portugal' => 'pt',
'Romanian_Romania' => 'ro',
'Russian_Russian_Federation' => 'ru',
'Slovak_Slovakia' => 'sk',
'Slovenian_Slovenia' => 'sl',
'Serbian_Republic_of_Montenegro' => 'sr',
'Serbian_Republic_of_Serbia' => 'rs',
'Swedish_Sweden' => 'sv',
'Thai_Thailand' => 'th',
'Turkish_Turkey' => 'tr',
'Chinese_China' => 'cn',
'Chinese_Taiwan' => 'zh'
);
}
public function info()
@ -112,7 +152,7 @@ class xmlinterface
$node->addAttribute('model', $var['vendor'] . ' ' . $var['model']);
}
}
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save XMLDefault1.cnf.xml
$this->saveXml($xml_work, $xml_name); // Save XMLDefault1.cnf.xml
}
}
@ -120,46 +160,7 @@ class xmlinterface
{
// TODO: $data_values are system wide defaults, $dev_config are specific device values.
// Need to merge the two arrays so that device specific values override system values
$langCodeArray = array(
'Arabic_Saudi_Arabia' => 'ar',
'Bulgarian_Bulgaria' => 'bg',
'Czech_Czech_Republic' => 'cz',
'Danish_Denmark' => 'da',
'German_Germany' => 'de',
'Greek_Greece' => 'el',
'AU_English_United_States' => 'en',
'English_United_Kingdom' => 'en',
'English_United_States' => 'en',
'Spanish_Spain' => 'es',
'Estonian_Estonia' => 'et',
'Finnish_Finland' => 'fi',
'French_Canada' => 'fr',
'French_France' => 'fr',
'Hebrew_Israel' => 'he',
'Croatian_Croatia' => 'hr',
'Hungarian_Hungary' => 'hu',
'Italian_Italy' => 'it',
'Japanese_Japan' => 'ja',
'Korean_Korea_Republic' => 'ko',
'Lithuanian_Lithuania' => 'lt',
'Latvian_Latvia' => 'lv',
'Dutch_Netherlands' => 'nl',
'Norwegian_Norway' => 'no',
'Polish_Poland' => 'pl',
'Portuguese_Brazil' => 'pt',
'Portuguese_Portugal' => 'pt',
'Romanian_Romania' => 'ro',
'Russian_Russian_Federation' => 'ru',
'Slovak_Slovakia' => 'sk',
'Slovenian_Slovenia' => 'sl',
'Serbian_Republic_of_Montenegro' => 'sr',
'Serbian_Republic_of_Serbia' => 'rs',
'Swedish_Sweden' => 'sv',
'Thai_Thailand' => 'th',
'Turkish_Turkey' => 'tr',
'Chinese_China' => 'cn',
'Chinese_Taiwan' => 'zh'
);
$data_values = array_merge($data_values, $dev_config);
$var_xml_general_fields = array('authenticationurl' => 'dev_authenticationURL', 'informationurl' => 'dev_informationURL', 'messagesurl' => 'dev_messagesURL',
@ -250,29 +251,15 @@ class xmlinterface
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
foreach ($srst_fld as $srst_pro => $srs_put) {
if (empty($data_values[$srst_pro]) || ($data_values['srst_Option'] == 'disable') ) {
$srst_data =array();
} else {
$srst_data = explode(';', $data_values[$srst_pro]);
}
$si = 1;
foreach ($srst_data as $value) {
$srs_val = explode('/', $value);
$nod = $srs_put[0] . $si;
$xnode->$nod = $srs_val[0];
$nod = $srs_put[1] . $si;
$xnode->$nod = ((empty($srs_val[1])) ? "2000": $srs_val[1]);
$si++;
}
while ($si < 4) {
$nod = $srs_put[0] . $si;
$xnode->$nod = '';
$nod = $srs_put[1] . $si;
$xnode->$nod = '';
$si++;
}
// srst addresses are now stored as json;
$srst_addrs = $this->convertCsvToArray($data_values['srst_ip']);
//Now have an array of srst addresses - maybe empty
foreach ($srst_addrs as $netKey => $netValue) {
$nodeName = "ipAddr${netKey}";
$xnode->$nodeName = $netValue['ip'];
$nodeName = "port${netKey}";
$xnode->$nodeName = $netValue['port'];
}
break;
case 'connectionmonitorduration':
@ -311,8 +298,18 @@ class xmlinterface
foreach ($xml_work->$key->children() as $dkey => $ddata) {
if (isset($data_values[strtolower($dkey)])) {
$vtmp_data = $data_values[strtolower($dkey)];
if ((!empty($vtmp_data)) || ($vtmp_data == "0")) {
$xml_node->$dkey = $vtmp_data;
if (!empty($vtmp_data)) {
switch ($vtmp_data) {
case 'off':
$xml_node->$dkey = 1;
break;
case 'on':
$xml_node->$dkey = 0;
break;
default:
$xml_node->$dkey = $vtmp_data;
break;
}
}
}
}
@ -358,8 +355,8 @@ class xmlinterface
$xml_node->winCharSet = $dev_config['phonecodepage'];
$xml_node->name = $dev_config['devlang'];
$xml_node->langCode = 'en';
if (isset($langCodeArray['devlang'])) {
$xml_node->langCode = $langCodeArray['devlang'];
if (isset($this->langCodeArray[$dev_config['devlang']])) {
$xml_node->langCode = $this->langCodeArray[$dev_config['devlang']];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
@ -392,7 +389,7 @@ class xmlinterface
}
}
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save
$this->saveXml($xml_work, $xml_name); // Save
return time();
}
@ -407,20 +404,11 @@ class xmlinterface
}
$ip_fill = true;
if (!empty($data_values['ccm_address'])) {
$ccm_address = $data_values['ccm_address'];
if (strpos($ccm_address, 'internal') === false && strpos($ccm_address, '0.0.0.0') === false) {
$tmp_data = explode(';', $ccm_address);
$ip_fill = false;
foreach ($tmp_data as $tmp_row) {
if (strpos($tmp_row, '/') !== false) {
$ttmp_r = explode('/', $tmp_row); // IPv6 - ????
$rkey = $ttmp_r[0];
$res[$rkey] = array('ip' => $rkey, 'port' => $ttmp_r[1]);
} else {
$rkey = $tmp_row;
$res[$rkey] = array('ip' => $rkey, 'port' => $data_values['port']);
}
}
// ccm_address is json from sccpsettings
$ccm_address = $this->convertCsvToArray($data_values['ccm_address'], true);
// This is a sanitised list of ipaddresses and ports
foreach ($ccm_address as $netValue) {
$res[$netValue['ip']] = $netValue;
}
}
if ($ip_fill) {
@ -452,11 +440,10 @@ class xmlinterface
function create_SEP_SIP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
{
$var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
'idleURL' => 'dev_idleURL', 'sshUserId' => 'dev_sshUserId', 'sshPassword' => 'dev_sshPassword',
'phonePersonalization' => 'phonePersonalization'
'phonePersonalization' => 'phonepersonalization'
);
$var_xml_sipProfile = array('phoneLabel' => 'description',
'transferOnhookEnabled' => 'transferOnhookEnabled', 'enableVad' => 'enableVad', 'voipControlPort' => 'sipport'
@ -487,7 +474,6 @@ class xmlinterface
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_sip_template';
}
$xml_name = $store_path . '/' . $dev_id . '.cnf.xml';
//$sip_bind = $this->get_server_sip_bind($data_values);
$sip_bind = $data_values['sbind'];
$bind_proto = 'tcp';
$bind_ip_def = '';
@ -685,8 +671,8 @@ class xmlinterface
$xml_node->winCharSet = $dev_config['phonecodepage'];
$xml_node->name = $dev_config['devlang'];
$xml_node->langCode = 'en';
if (isset($langCodeArray['devlang'])) {
$xml_node->langCode = $langCodeArray['devlang'];
if (isset($this->langCodeArray['devlang'])) {
$xml_node->langCode = $this->langCodeArray['devlang'];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
@ -719,7 +705,7 @@ class xmlinterface
}
}
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save
$this->saveXml($xml_work, $xml_name); // Save
} else {
die('Error Hardware template :' . $xml_template . ' not found');
}

View file

@ -56,15 +56,11 @@ trait ajaxHelper {
// TODO: Need to be more specific on reload and only reload if critical settings changed.
$res = $this->aminterface->core_sccp_reload();
$msg [] = array ("Config Saved: {$res['Response']}", "Info : {$res['data']}");
// !TODO!: It is necessary in the future to check, and replace all server responses on correct messages. Use _(msg)
return array('status' => true, 'message' => $msg, 'reload' => true);
return array('status' => true, 'message' => 'Data saved', 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => '');
break;
case 'save_sip_device':
case 'save_device':
$this->saveSccpDevice($request);
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'sccpdevice');
return $this->saveSccpDevice($request);
break;
case 'save_ruser':
//$res = $request;
@ -247,7 +243,7 @@ trait ajaxHelper {
if (!empty($request['softkey'])) {
$id_name = $request['softkey'];
unset($this->sccp_conf_init[$id_name]);
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
return array('status' => true, 'table_reload' => true);
}
@ -261,11 +257,11 @@ trait ajaxHelper {
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
}
}
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
// !TODO!: -TODO-: Check SIP Support Enabled
$this->createSccpXmlSoftkey();
$msg = print_r($this->aminterface->core_sccp_reload, 1);
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
return array('status' => true, 'table_reload' => true);
}
break;
@ -444,38 +440,32 @@ trait ajaxHelper {
$sccpdevice_def = (array)$this->getTableDefaults('sccpdevice', false);
$sccpline_def = (array)$this->getTableDefaults('sccpline', false);
// before handling arrays, need to see if deny and permit are set in the request
// if they have been cleared by the users, will not be present
foreach (['deny','permit'] as $keyVal) {
if (!isset($request[$hdr_arprefix.$keyVal])) {
$tmpArr = $this->convertCsvToArray($this->sccpvalues[$keyVal]['systemdefault']);
if (isset($tmpArr[0]['internal'])) {
$request[$hdr_arprefix.$keyVal][0] = $tmpArr[0];
} else {
$request[$hdr_arprefix.$keyVal][1]['net'] = $tmpArr[0]['net'];
$request[$hdr_arprefix.$keyVal][1]['mask'] = $tmpArr[0]['mask'];
}
}
}
foreach ($request as $key => $value) {
// First handle any arrays as their prefix is part common with normal data
//$netvalue = array();
$key = (str_replace($hdr_arprefix, '', $key, $count_mods));
if ($count_mods) {
$arr_data = '';
if (!empty($this->sccpvalues[$key])) {
foreach ($value as $valArr) {
foreach ($valArr as $vkey => $vval) {
switch ($vkey) {
case 'inherit':
case 'internal':
if ($vval == 'on') {
$arr_data .= 'internal;';
}
break;
case 'port':
$arr_data .= ":{$vval}";
break;
case 'mask':
$arr_data .= "/{$vval}";
break;
default:
$arr_data .= $vval;
break;
}
}
}
if (!($this->sccpvalues[$key]['data'] == $arr_data)) {
$save_settings[$key] = $this->sccpvalues[$key];
$save_settings[$key]['data'] = $arr_data;
}
}
// Only arrays : network lists or ip lists.
$save_settings[$key]['keyword'] = $key;
$save_settings[$key]['type'] = $this->sccpvalues[$key]['type'];
$save_settings[$key]['seq'] = $this->sccpvalues[$key]['seq'];
$save_settings[$key]['data'] = $this->convertArrayToCsv($value);
$save_settings[$key]['systemdefault'] = $this->sccpvalues[$key]['systemdefault'];
continue;
}
// Now handle any normal data - arrays will not match as already handled.
@ -504,24 +494,35 @@ trait ajaxHelper {
continue 2;
}
}
}
}
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
$save_settings = array_merge($save_settings, $extSettings);
//dbug($save_settings);
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
}
// now add the site defaults from sccpsettings to sccpdevice for permit and deny, so that these will override
foreach (['deny', 'permit'] as $fieldId) {
$output = array();
foreach ($this->convertCsvToArray($this->sccpvalues[$fieldId]['data']) as $netValue) {
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue;
}
$output[] = implode('/', $netValue);
}
$dbSaveArray[$fieldId] = array('table' => 'sccpdevice', 'field' => $fieldId, 'Default' => implode(';',$output));
}
foreach ($dbSaveArray as $key => $rowToSave) {
$this->dbinterface->updateTableDefaults($rowToSave['table'], $rowToSave['field'], $rowToSave['Default']);
}
// rewrite sccp.conf
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
$save_settings[] = array('status' => true, );
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
$this->createDefaultSccpXml();
return $save_settings;
}
public function getMyConfig($var = null, $id = "noid") {
@ -650,15 +651,14 @@ trait ajaxHelper {
$hdr_prefix = 'sccp_hw_';
$hdr_arprefix = 'sccp_hw-ar_';
$hdr_vendPrefix = 'vendorconfig_';
$save_buttons = array();
$save_settings = array();
$save_codec = array();
$name_dev = '';
$db_field = array_keys($this->dbinterface->getSccpDeviceTableData("get_columns_sccpdevice"));
$hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid'];
$hw_id = (empty($get_settings['sccp_device_id'])) ? 'new' : $get_settings['sccp_device_id'];
$hw_type = (empty($get_settings['sccp_device_typeid'])) ? 'sccpdevice' : $get_settings['sccp_device_typeid'];
$update_hw = ($hw_id == 'new') ? 'add' : 'clear'; // Clear is delete + add
$update_hw = ($hw_id == 'new') ? 'add' : 'clear'; // Clear is delete + add. Only used for buttons
$hw_prefix = 'SEP';
if (!empty($get_settings[$hdr_prefix . 'type'])) {
$value = $get_settings[$hdr_prefix . 'type'];
@ -686,70 +686,71 @@ trait ajaxHelper {
}
break;
case 'phonecodepage':
// phonecodepage depends on 2 variables - language and phone type (uses java or not).
// Non java phones use ISO8859-1 or CP1251 (Cyrillic); java phones use UTF-8. See @dkgroot.
// Below list is not definitive or necessarily accurate - needs to be maintained.
$nonJavaPhones = array(
'6901', '6911', '6921', '6945', '7902', '7905', '7910', '7911', '7912', '7914', '7915', '7916', '7920', '7925', '7926', '7931', '7935', '7936', '7937', '7940', '7960'
);
// TODO: May be other exceptions so use switch. Historically this is the only one handled
if (!empty($get_settings["{$hdr_prefix}devlang"])) {
switch ($get_settings["{$hdr_prefix}devlang"]) {
case 'Russian_Russian_Federation':
$value = 'CP1251';
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'CP1251' : 'utf-8';
break;
default:
$value = 'ISO8859-1';
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'ISO8859-1' : 'utf-8';
break;
}
}
break;
default:
// handle vendor prefix
if (!empty($get_settings[$hdr_vendPrefix . $key])) {
$value = $get_settings[$hdr_vendPrefix . $key];
if (!empty($get_settings["${hdr_vendPrefix}${key}"])) {
$value = $get_settings["${hdr_vendPrefix}${key}"];
}
// handle array prefix
if (!empty($get_settings[$hdr_arprefix . $key])) {
if (!empty($get_settings["${hdr_arprefix}${key}"])) {
// Only 3 types of array returned permit,deny, setvar
$arr_data = '';
$arr_clear = false;
foreach ($get_settings[$hdr_arprefix . $key] as $vkey => $vval) {
$tmp_data = '';
foreach ($vval as $vkey => $vval) {
switch ($vkey) {
case 'inherit':
if ($vval == 'on') {
$arr_clear = true;
// Злобный ХАК ?!TODO!?
if ($key == 'permit') {
$save_settings['deny'] = 'NONE';
}
}
break;
case 'internal':
if ($vval == 'on') {
$tmp_data .= 'internal;';
}
break;
default:
$tmp_data .= $vval . '/';
break;
}
$output = array();
foreach ($get_settings["${hdr_arprefix}${key}"] as $netValue) {
switch ($key) {
case 'permit':
case 'deny';
// Now have an array of settings each with keys net and Mask
// TODO: This needs to be optimised
//foreach ($valueArr as $netValue) {
if (isset($netValue['inherit'])) {
$save_settings['deny'] = 'NONE';
continue 2;
}
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue 2;
}
if (empty($netValue['net'])) {
// empty net so ignored
continue 2;
}
$netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask'];
$output[]= implode('/', $netValue);
//}
break;
case 'setvar':
$output[] = implode(';', $netValue);
break;
// No default case
}
if (strlen($tmp_data) > 2) {
while (substr($tmp_data, -1) == '/') {
$tmp_data = substr($tmp_data, 0, -1);
}
$arr_data .= $tmp_data . ';';
}
}
while (substr($arr_data, -1) == ';') {
$arr_data = substr($arr_data, 0, -1);
}
if ($arr_clear) {
$value = 'NONE';
} else {
$value = $arr_data;
}
}
// Now only have normal prefix
if (!empty($get_settings["{$hdr_prefix}{$key}"])) {
$value = $get_settings["{$hdr_prefix}{$key}"];
}
$save_settings[$key] = implode(';', $output);
unset($output);
}
// Now only have normal prefix
if (!empty($get_settings["{$hdr_prefix}{$key}"])) {
$value = $get_settings["{$hdr_prefix}{$key}"];
}
}
if (!empty($value)) {
$save_settings[$key] = $value;
@ -763,17 +764,25 @@ trait ajaxHelper {
$this->dbinterface->write('sccpbuttons', $save_buttons, $update_hw, '', $name_dev);
// Create new XML for this device, and then reset or restart the device
// so that it loads the file from TFT.
$this->createSccpDeviceXML($name_dev);
if ($hw_id == 'new') {
$this->aminterface->sccpDeviceReset($name_dev, 'reset');
} else {
$this->aminterface->sccpDeviceReset($name_dev, 'restart');
}
$msg = "Device Saved";
return array('status' => true, 'message' => $msg, 'reload' => true);
$toastFlag = 'success';
if (!$this->createSccpDeviceXML($name_dev)){
// will only be false if creating SIP SEP with no line.
$msg = "Device Saved but SEP config file not created as no SIP line attached to this device";
$toastFlag = 'warning';
};
$hash = '#sipdevice';
if ($get_settings['sccp_device_typeid'] != 'sipdevice') {
$hash = '#sccpdevice';
// cannot restart SIP device via chan-sccp.
if ($hw_id == 'new') {
$this->aminterface->sccpDeviceReset($name_dev, 'reset');
} else {
$this->aminterface->sccpDeviceReset($name_dev, 'restart');
}
}
$search = '?display=sccp_phone';
return array('status' => true, 'message' => $msg, 'reload' => true, 'toastFlag' => $toastFlag, 'search' => $search, 'hash' => $hash);
}
}
?>

View file

@ -3,8 +3,76 @@
namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait helperfunctions {
private function convertCsvToArray($stringToConvert = "") {
// Take a csv string form of net/mask or ip/port and convert to an array
// sub arrays are separated by ";"
$outputArr = array();
if (empty($stringToConvert)) {
return $outputArr;
}
foreach (explode(";", $stringToConvert) as $value) {
//internal is always the first setting if present
if ($value == 'internal') {
$outputArr[] = array('internal' => 'on');
continue;
}
// Now handle rest of value types
$subArr = explode("/", $value);
if (count($subArr) === 2) {
// Have net/mask
$outputArr[] = array('net' => $subArr[0], 'mask' => $subArr[1]);
} else {
// have ip:port
$subArr = explode(":", $value);
$outputArr[] = array('ip' => $subArr[0], 'port' => $subArr[1]);
}
}
return $outputArr;
}
function getIpInformation($type = '') {
private function convertArrayToCsv(array $arrayToConvert) {
// About to save to db so need to convert to string
// Take an array form of net mask or ip port and convert to a csv
// sub arrays are separated by ";"
if (empty($arrayToConvert)) {
return '';
}
$output = array();
// Internal is always element 0, nets and ips start at element 1.
if ((isset($arrayToConvert[1]['net'])) || (isset($arrayToConvert[0]['internal']))) {
// Have net masks
foreach ($arrayToConvert as $netValue) {
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue;
}
if (empty($netValue['net'])) {
// If network not set, user error, has added empty row so delete
continue;
}
// If the mask has not been set, set to this subnet
$netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask'];
$output[] = implode('/', $netValue);
}
} else {
// Have ip addresses
foreach ($arrayToConvert as $ipArr) {
if (isset($ipArr['internal'])) {
// should not be set for an ip address
continue;
}
if (empty($ipArr['ip'])) {
// If ip not set, user error, has added empty row so delete
continue;
}
$ipArr['port'] = (empty($ipArr['port'])) ? "2000" : $ipArr['port'];
$output[] = implode(':', $ipArr);
}
}
return implode(';', $output);
}
private function getIpInformation($type = '') {
$interfaces = array();
switch ($type) {
case 'ip4':
@ -207,6 +275,20 @@ trait helperfunctions {
return false;
}
public function initialiseConfInit(){
$read_config = \FreePBX::LoadConfig()->getConfig('sccp.conf');
$sccp_conf_init['general'] = $read_config['general'];
foreach ($read_config as $key => $value) {
if (isset($read_config[$key]['type'])) { // copy soft key
if ($read_config[$key]['type'] == 'softkeyset') {
$sccp_conf_init[$key] = $read_config[$key];
}
}
}
return $sccp_conf_init;
}
public function checkTftpMapping(){
exec('in.tftpd -V', $tftpInfo);
$info['TFTP Server'] = array('Version' => 'Not Found', 'about' => 'Mapping not available');
@ -274,18 +356,18 @@ trait helperfunctions {
unset($sysConfig);
}
public function createDefaultSccpConfig(array $sccpvalues, string $asteriskPath) {
public function createDefaultSccpConfig(array $sccpvalues, string $asteriskPath, $conf_init) {
global $cnf_wr;
// Make sccp.conf data
// [general] section
// TODO: Need to review sccpsettings seq numbering, as will speed this up, and remove the need for $permittedSettings.
$cnf_wr = \FreePBX::WriteConfig();
//clear old settings, and initiate with allow/disallow and permit/deny keys in correct order
$this->sccp_conf_init = array();
$this->sccp_conf_init['general']['disallow'] = 'all';
$this->sccp_conf_init['general']['allow'] = '';
$this->sccp_conf_init['general']['deny'] = '0.0.0.0/0.0.0.0';
$this->sccp_conf_init['general']['permit'] = '0.0.0.0/0.0.0.0';
//clear old general settings, and initiate with allow/disallow and permit/deny keys in correct order
$conf_init['general'] = array();
$conf_init['general']['disallow'] = 'all';
$conf_init['general']['allow'] = '';
$conf_init['general']['deny'] = '0.0.0.0/0.0.0.0';
$conf_init['general']['permit'] = '0.0.0.0/0.0.0.0';
// permitted chan-sccp settings array
$permittedSettings = array(
'debug', 'servername', 'keepalive', 'context', 'dateformat', 'bindaddr', 'port', 'secbindaddr', 'secport', 'disallow', 'allow', 'deny', 'permit',
@ -307,15 +389,9 @@ trait helperfunctions {
case "allow":
case "disallow":
case "deny":
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
break;
case "localnet":
case "permit":
$content = $value['data'];
if (strpos($content, 'internal') !== false) {
$content = str_replace(';0.0.0.0/0.0.0.0', '', $value['data']);
}
$this->sccp_conf_init['general'][$key] = explode(';', $content);
$conf_init['general'][$key] = explode(';', $value['data']);
break;
case "devlang":
/*
@ -332,7 +408,7 @@ trait helperfunctions {
break;
default:
if (!empty($value['data'])) {
$this->sccp_conf_init['general'][$key] = $value['data'];
$conf_init['general'][$key] = $value['data'];
}
}
}
@ -342,7 +418,7 @@ trait helperfunctions {
// This will complicate solving problems caused by unexpected solutions from users.
//
if (file_exists($asteriskPath . "/sccp_custom.conf")) {
$this->sccp_conf_init['HEADER'] = array(
$conf_init['HEADER'] = array(
"; ;",
"; It is a very bad idea to add an external configuration file !!!! ;",
"; This will complicate solving problems caused by unexpected solutions ;",
@ -351,8 +427,7 @@ trait helperfunctions {
"#include sccp_custom.conf"
);
}
$cnf_wr->WriteConfig('sccp.conf', $this->sccp_conf_init);
//$this->$cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
$cnf_wr->WriteConfig('sccp.conf', $conf_init);
}
public function initVarfromXml() {
@ -405,5 +480,44 @@ trait helperfunctions {
}
}
}
public function getSipConfig() {
// Only called from sccp_manager class when saving SIP device
$result = array();
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
$if_list = $this->getIpInformation('ip4');
if (!is_array($tmp_binds)) {
// FreePBX has no sip bindings.
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
}
foreach ($tmp_binds as $fpbx_protocol => $fpbx_bind) {
foreach ($fpbx_bind as $protocol_ip => $protocol_port_arr) {
if (empty($protocol_port_arr)) {
continue;
}
if (($protocol_ip == '0.0.0.0') || ($protocol_ip == '[::]')) {
foreach ($if_list as $if_type => $if_data) {
if ($if_data['ip'] == "127.0.0.1") {
continue;
}
if (empty($result[$fpbx_protocol][$if_data['ip']])) {
$result[$fpbx_protocol][$if_data['ip']]= $protocol_port_arr;
} else {
$result[$fpbx_protocol][$if_data['ip']]= array_merge($result[$fpbx_protocol][$if_data['ip']],$protocol_port_arr);
}
$result[$fpbx_protocol][$if_data['ip']]['ip']=$if_data['ip'];
}
} else {
$result[$fpbx_protocol][$protocol_ip]=$protocol_port_arr;
$result[$fpbx_protocol][$protocol_ip]['ip']=$protocol_ip;
}
}
}
if (empty($result)) {
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
}
return $result;
}
}
?>

View file

@ -2,20 +2,20 @@
"rawname": "sccp_manager",
"repo": "stable",
"name": "Sccp Manager",
"version": "14.3.0.19",
"version": "14.5.0.4",
"publisher": "Steve Lad",
"license": "GPL",
"licenselink": "http://www.gnu.org/licenses/gpl.txt",
"changelog": "*14.3.0.15* Install master files list via installer\n*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",
"changelog": "*14.5.0.4* Preserve softkeys across installs. Fix truncated values\n*14.5.0.3* Fix issue 32\n*14.4.0.5* Fix issue 59\n*14.4.0.1* Fix regression in SQL not compatible with MariaDb 5\n*14.4.0.1* Upgrade installer to prevent data loss when run\n*14.3.0.30* Fix issue returning after save\n*14.3.0.28* Fix issue with RNav\n*14.3.0.27* Improve handling of SIP devices\n*14.3.0.15* Install master files list via installer\n*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",
"description": "The Sccp Manager module lets you manage the chan-sccp driver.",
"depends": {
"version": "14.0"
"version": "16.0"
},
"supported": {
"version": "13.0"
"version": "15.0"
},
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.3.0.19.tar.gz",
"md5sum": "d9d96ada20338e7e88ac8eb4681ca8b3",
"packaged": "1640775011"
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.5.0.4.tar.gz",
"md5sum": "80b454d5cfdd602bffeec350e6e76bac",
"packaged": "1643364518"
}

View file

@ -46,39 +46,37 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="keysetform">
<input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<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">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 9) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
$i ++;
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<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">
<thead>
<tr>
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 12) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
$i ++;
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
<!-- Begin Form Input New / Edit -->
@ -90,18 +88,27 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div>
<div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div><div class="col-md-9">
<input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
</div></div></div>
<style type="text/css">
input:invalid {border: red solid 3px;}
</style>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div>
<div class="col-md-9">
<input type="text" maxlength="15" pattern="[a-zA-Z0-9]{4,15}" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Max length 15 letters or numbers without spaces</span>
</div>
</div>
</div>
<ul class="nav nav-tabs" role="tablist">
<?php
@ -157,8 +164,6 @@ foreach ($keysetarray as $key => $value) {
</div>
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
var exp_model = '';

View file

@ -27,6 +27,7 @@ if (!empty($_REQUEST['new_id'])) {
if (!empty($_REQUEST['id'])) {
// Editing an existing Device. Overwrite any defaults that are already set for this device.
$dev_id = $_REQUEST['id'];
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
foreach ($db_res as $key => $val) {
if (!empty($val)) {
@ -103,25 +104,47 @@ if (!empty($def_val['type'])) {
<input type="hidden" name="Submit" value="Submit">
<?php
if (empty($dev_id)) {
echo '<input type="hidden" name="sccp_deviceid" value="new">';
} else {
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
echo '<input type="hidden" name="sccp_device_id" value="'.$dev_id.'">';
}
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
if ($_REQUEST['tech_hardware'] == 'cisco') {
echo '<input type="hidden" name="sccp_device_typeid" value="sccpdevice">';
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
}
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
} else if ($_REQUEST['tech_hardware'] == 'cisco-sip') {
echo '<input type="hidden" name="sccp_device_typeid" value="sipdevice">';
/*
if (empty($dev_new)) {
echo '<input type="hidden" name="sccp_deviceid" value="new">';
} else {
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
}
*/
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
}
echo $this->showGroup('sccp_hw_sip_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val);
}
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?>
</form>

View file

@ -1,126 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$def_val = null;
$dev_id = null;
$dev_new = null;
$device_warning= null;
// Default value from Server setings
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $this->sccpvalues['netlang']['data'], "seq" => "99");
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $this->sccpvalues['devlang']['data'], "seq" => "99");
$def_val['directed_pickup_context'] = array("keyword" => 'directed_pickup_context', "data" => $this->sccpvalues['directed_pickup_context']['data'], "seq" => "99");
if (!empty($_REQUEST['new_id'])) {
$dev_id = $_REQUEST['new_id'];
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
$val = $_REQUEST['type'];
$def_val['type'] = array("keyword" => 'type', "data" => $val, "seq" => "99");
if (!empty($_REQUEST['addon'])) {
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
}
}
if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$dev_new = $dev_id;
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
foreach ($db_res as $key => $val) {
if (!empty($val)) {
switch ($key) {
case 'type':
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0];
}
if (!empty($tmp_raw['validate'])) {
$tmpar = explode(";", $tmp_raw['validate']);
if ($tmpar[0] != 'yes') {
$device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
}
if ($tmpar[1] != 'yes') {
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
}
}
break;
case 'name':
$key = 'mac';
$val = str_replace(array('SEP','ATA','VG'), '', $val);
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
break;
case '_hwlang':
$tmpar = explode(":", $val);
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
break;
// case 'permit':
// case 'deny':
// $def_val[$key . '_net'] = array("keyword" => $key, "data" => before('/', $val), "seq" => "99");
// $key = $key . '_mask';
// $val = after('/', $val);
// break;
}
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
}
}
}
//print_r($db_res);
if (!empty($device_warning)) {
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Warning in the SCCP Device</h2>
<div class="table-responsive">
<?php
foreach ($device_warning as $key => $value) {
echo '<h3>'.$key.'</h3>';
if (is_array($value)) {
echo '<li>'._(implode('</li><li>', $value)).'</li>';
} else {
echo '<li>'. _($value).'</li>';
}
}
?>
</pre>
</div>
</div>
</div>
</div>
<br>
<?php } ?>
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_sedit">
<input type="hidden" name="category" value="adddevice_form">
<input type="hidden" name="Submit" value="Submit">
<input type="hidden" name="sccp_device_typeid" value="sipdevice">
<?php
if (empty($dev_new)) {
echo '<input type="hidden" name="sccp_deviceid" value="new">';
} else {
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
}
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
}
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?>
</form>

View file

@ -6,34 +6,26 @@
* and open the template in the editor.
*/
$forminfo =array(
array("name" => "dev_buttons", 'label' =>"Buttons Configuration"),
array("name" => "button", 'label'=>"Buttons ", 'help' => "help.")
);
array('name'=>'dev_buttons', 'label'=>'Buttons Configuration'),
array('name'=>'button', 'label'=>'Buttons', 'help'=>'help')
);
//$buttons_type= array("empty","line","service","feature","speeddial");
// "feature","service" -- Add leter !
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
/*
button = feature,PDefault,ParkingLot,default,RetrieveSingle
feature,P.slot,parkinglot,P.slot,
*/
if ($_REQUEST['tech_hardware'] === 'cisco') {
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
} else {
$lines_list = $this->dbinterface->getSipTableData('extensionList');
}
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
/* REQUEST for new device
[display] => sccp_phone
[tech_hardware] => cisco
[extdisplay] =>
*/
// print_r($hint_list);
$line_id =0;
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons
$show_buttons =1;
//print_r($hint_list);
if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));

View file

@ -1,262 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$forminfo =array(
array('name'=>'dev_buttons','label'=>'Buttons Configuration'),
array('name'=>'button','label'=>'Buttons','help'=>'help')
);
//$buttons_type= array("empty","line","service","feature","speeddial");
// "feature","service" -- Add leter !
//$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
$buttons_type= array('empty','line','speeddial');
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> 'Record Calls','devstate'=> 'Change Status');
//$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
$lines_list = $this->sipconfigs->get_db_sip_TableData('Device');
//$hint_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
// print_r($lines_list);
$line_id =0;
$max_buttons =56;
$show_buttons =1;
//print_r($hint_list);
if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array('id' => $dev_id));
$db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array('id' => $dev_id));
$max_buttons = $db_device['buttons'];
if (!empty($db_device['addon_buttons'])) {
$max_buttons += $db_device['addon_buttons'];
}
$show_buttons = $max_buttons;
}
if (!empty($_REQUEST['new_id'])) {
$val = $_REQUEST['type'];
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
// $db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $val));
$max_buttons = $dev_schema[0]['buttons'];
if (!empty($_REQUEST['addon'])) {
$val = $_REQUEST['addon'];
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
$max_buttons += $dev_schema[0]['buttons'];
}
$show_buttons = $max_buttons;
}
if (!empty($_REQUEST['ru_id'])) {
$dev_id = $_REQUEST['ru_id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array('id' => $dev_id));
$show_buttons = $max_buttons;
}
?>
<form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_sedit">
<input type="hidden" name="category" value="frm_editbuttons">
<input type="hidden" name="Submit" value="Submit">
<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>
<div class="section" data-id="<?php echo $forminfo[0]['name'];?>">
<div class="row"> <div class="form-group">
<div class="col-sm-2">
<label class="control-label">Help</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="frmbuttons"></i>
</div>
<div class="col-sm-10">
<span id="frmbuttons-help" class="help-block fpbx-help-block"><?php echo _("buttons come in the following flavours: <br>
<ul>
<li>empty: Empty button (no options)</li>
<li>line: Registers the line with identifier specified as [name]</li>
<li>silent: buttons equal 'Line' with out ring</li>
<li>monitor: buttons mode speeddial + show status</li>
<li>speeddial: Adds a speeddial with label [name] and [option1] as number Optionally, [option2] can be used to specify a hint by extension@context as usual.</li>
<li>service (not implemented): Adds a service url Feature buttons have an on/off status represented on the device with a tick-box and can be used to set the device in a particular state. Currently Possible [option1],[option2] combinations:</li>
<ul>
<li>privacy,callpresent = Make a private call, number is suppressed</li><li>privacy,hint = Make a private call, hint is suppressed</li><li>cfwdall,number = Forward all calls </li><li>cfwbusy,number = Forward on busy</li><li>
cfwnoaswer,number = Forward on no-answer (not implemented yet)<br> DND,busy = Do-not-disturb, return Busy signal to Caller <br> DND,silent = Do-not-disturb, return nothing to caller <br>
monitor = Record Calls using AutoMon (asterisk 1.6.x only)</li><li>devstate,custom_devstate = Device State Feature Button (asterisk 1.6.1 and up). custom_devstate is the name of the custom devicestate to be toggled (How to use devicestate)
hold = To be implemented</li><li>transfer = To be implemented</li><li>multiblink = To be implemented</li><li>mobility = To be implemented</li><li>conference = To be implemented</li>
</ui></ui>");?></span>
</div>
</div></div>
<?php
for ($line_id = 0; $line_id <=$max_buttons; $line_id ++) {
// print_r($db_buttons[$line_id]);
$show_form_mode = '';
$defaul_tv = (empty($db_buttons[$line_id])) ? 'empty': $db_buttons[$line_id]['buttontype'];
$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;
$def_hint = ''; // Hint check Box
$def_hint_btn = ''; // Hint Combo Box
$def_silent = '';
$defaul_advline = '';
if (strpos($defaul_btn, '@') >0) {
$defaul_tv = 'adv.line';
$show_form_mode = 'adv.line';
$defaul_btn = strtok($defaul_btn, '@');
$defaul_advline = strtok('@');
}
if ($line_id == 0) {
$show_form_mode = 'line';
}
if (stripos($defaul_btn, '!') >0) {
$defaul_btn = strtok($defaul_btn, '!');
$defaul_tv = 'silent';
$def_silent = 'checked';
}
if ($defaul_tv == "feature") {
$defaul_ftr = $defaul_opt[0];
$defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1];
// print_r($defaul_fcod);
}
foreach ($defaul_opt as $data_i) {
if (strpos($data_i, '@')>0) {
$test_btn = strtok($data_i, '@');
$def_hint = 'checked';
$defaul_btn = $data_i;
$def_hint_btn = $data_i;
if ($test_btn == $defaul_opt[0]) {
foreach ($lines_list as $data) {
if ($data['id']==$test_btn) {
$show_form_mode = 'line';
$defaul_tv = 'monitor';
$defaul_btn = $test_btn;
break;
}
}
}
}
}
// print_r($def_hint_btn);
// print_r($defaul_opt);
echo '<!-- Begin button :'.$line_id.' -->';
echo '<div class="line_button element-container" '.(($line_id < $show_buttons)?"":"hidden ").'data-id="'.$line_id.'">';
// echo 'Mode : '.$show_form_mode. ' opt: ';
// print_r( $defaul_opt);
?>
<div class="row"> <div class="form-group">
<div class="col-sm-2">
<label class="control-label" for="<?php echo $forminfo[1]['name'].$line_id; ?> "><?php echo _($forminfo[1]['label'].$line_id).(($line_id =="0")?' Default ':''); ?></label>
</div>
<div class="col-sm-5">
<div class="col-xs-3">
<!-- Line Type Select -->
<select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
<?php
if ($line_id == 0) {
echo '<option value="line" selected >DEF LINE</option>';
} else {
foreach ($buttons_type as $data) {
$select = (($data == $defaul_tv)?"selected":"");
echo '<option value="'.$data.'" '.$select.' >'.$data.'</option>';
}
}
?>
</select>
</div>
<!-- if Line Type = feature Show Futures -->
<div class="col-xs-7">
<select data-type="feature" class ="futuretype form-control lineid_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" >
<?php
foreach ($feature_list as $fkey => $fval) {
$select = (($fkey == $defaul_ftr)?"selected":"");
echo '<option value="'.$fkey.'" '.$select.' >'.$fval.'</option>';
}
?>
</select>
<!-- if Line Type = line Show SCCP Num -->
<select data-type='line' class ="form-control lineid_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" >
<?php
foreach ($lines_list as $data) {
$select = (($data['id']==$defaul_btn)?"selected":"");
echo '<option value="'.$data['id'].'" '.$select.' >'.$data['id'].' / '.$data['callerid'].'</option>';
}
?>
</select>
<!-- if Line Type = Othe Show Input -->
<div data-type='speeddial' class="lineid_<?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_buttons[$line_id]['name'].'" >';
?>
</div>
</div>
</div>
<div class="col-md-5">
<!-- if Line Type = speeddial Show Hint line -->
<div data-type='hintline' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<?php
echo '<div class="col-xs-5">';
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">';
echo '</div><div class="col-xs-2 radioset" data-toggle="buttons">';
echo '<input class="form-control" type="checkbox" name="'.$forminfo[1]['name'].$line_id.'_hint" id="'.$forminfo[1]['name'].$line_id.'_hint" '.$def_hint.' value= "hint">';
echo '<label for="'.$forminfo[1]['name'].$line_id.'_hint">hints</label>';
echo '</div><div class="col-xs-5">';
echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >';
foreach ($hint_list as $data) {
$select = (($data['key']==$def_hint_btn)?"selected":"");
echo '<option value="'.$data['key'].'" '.$select.' >'.$data['exten'].' / '.$data['label'].'</option>';
}
echo '</select>';
echo '</div>';
?>
</div>
<!-- if Line Type = feature Show Futures Park -->
<div data-type='feature' class="lineid_<?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_buttons[$line_id]['name'].'" >';
?>
</div>
<div class="col-xs-5">
<?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >';
?>
</div>
</div>
<!-- if Line Type = Advanced Show Hint line -->
<div data-type='adv_line' class="lineid_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' 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.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >';
?>
</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_buttons[$line_id]['options'].'" >';
?>
</div>
</div>
</div>
</div></div>
</div>
<?php
echo '<!-- End button :'.$line_id.' -->';
}
?>
</div>
</form>
<div class="section-butom" data-for="<?php echo $forminfo[0]['name'];?>">
<h3></h3>
</div>

View file

@ -48,7 +48,6 @@ if ($h_show==1) {
<?php
}
foreach ($items as $child) {
$disabledButtons = array();
if (empty($child->help)) {
@ -91,6 +90,7 @@ foreach ($items as $child) {
case 'SDM':
case 'SDMS':
case 'SDML':
case 'SDMF':
case 'SDE':
case 'SDD':
\FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);

View file

@ -81,8 +81,7 @@
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
}
function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
@ -90,11 +89,11 @@
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
}
}
return result;
}

View file

@ -17,13 +17,17 @@
class="table">
<thead>
<tr>
<th data-sortable="true" data-field="mac"><?php echo _('SEP ID')?></th>
<th data-sortable="true" data-field="name"><?php echo _('SEP ID')?></th>
<th data-sortable="true" data-field="description"><?php echo _('Descriptions')?></th>
</tr>
</thead>
</table>
<script type="text/javascript">
$("#sccpnavgrid").on('click-row.bs.table',function(e,row,elem){
window.location = '?display=sccp_phone&tech_hardware=cisco&id='+row['mac'];
if (row['new_hw'] == 'Y' ) {
window.location = '?display=sccp_phone&tech_hardware=cisco&new_id=' +row['name'] +'&' +row['type'];
} else {
window.location = '?display=sccp_phone&tech_hardware=cisco&id='+row['name'];
};
})
</script>

View file

@ -5,7 +5,6 @@
* and open the template in the editor.
*/
// vim: set ai ts=4 sw=4 ft=phtml:
?>
<div class="fpbx-container container-fluid">
@ -18,19 +17,19 @@
<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>
<button name="cr_sccp_sphone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
<button name="cr_sip_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
</button>
<button name="reset_sccp_sphone" class="btn sccp_update btn-default" data-id="reset_dev">
<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&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="name">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></th>
<th data-sortable="true" data-field="name"><?php echo _('Device ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Description') ?></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>
<th data-sortable="true" data-field="status"><?php echo _('Status') ?></th>
@ -45,6 +44,21 @@
</div>
<script>
function DispayTypeFormatter(value, row, index) {
var exp_model = value;
if (row['addon'] !== null ) {
var posd = row['addon'].indexOf(';');
if (posd >0) {
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
} else {
exp_model += ' + ' + row['addon'];
}
}
return exp_model;
}
function DispayDeviceActionsKeyFormatterS(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
@ -59,33 +73,20 @@
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
function DispayTypeFormatter(value, row, index) {
var exp_model = value;
if (row['addon'] !== null ) {
var posd = row['addon'].indexOf(';');
if (posd >0) {
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
} else {
exp_model += ' + ' + row['addon'];
}
}
return exp_model;
}
function LineFormatterS(value, row, index) {
function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
}
}
return result;
}
</script>

View file

@ -13,7 +13,7 @@
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" ><?php echo _("Warning : Any changes to the device configuration can cause all phones to restart"); ?></h2>
<h2 style="border:2px solid Tomato;color:Tomato;" ><?php echo _("Warning : Any changes to the device configuration can cause all phones to restart.<br>It is important to read the information on hotline below before using this capability"); ?></h2>
</div>
</div>
</div>

View file

@ -25,7 +25,6 @@
$def_val_device = $this->getTableDefaults('sccpdevice');
echo $this->showGroup('sccp_general', 1);
echo $this->showGroup('sccp_dev_time_s', 1);
echo $this->showGroup('sccp_net', 1);
echo $this->showGroup('sccp_lang', 1);
echo $this->showGroup('sccp_extpath_config', 1);