Compare commits

...

54 commits
develop ... V16

Author SHA1 Message Date
Christopher Cookman df51d2b46d BUH 2024-12-05 17:38:49 -07:00
Christopher Cookman 39ac99c600 Fix vars in strings 2024-12-05 17:37:19 -07:00
stevenA 8e6d7b7e14 Add site defaults buttons to IS 2022-02-02 16:47:14 +01:00
stevenA b927523071 Add display settings to device edit 2022-02-02 14:16:14 +01:00
stevenA 14d9dfdf98 Finalise display and saving of daysdisplaynotactive 2022-02-02 13:17:17 +01:00
stevenA 70e972b786 Supply buttons for days not active selection
WIP
2022-02-01 15:00:18 +01:00
stevenA 6297285e58 Provide dropdown for tones 2022-02-01 14:22:47 +01:00
stevenA 0be0dc2b67 Reconfigure settings display
Reorder and move according to relevance as agreed with dkgroot
2022-02-01 12:34:38 +01:00
stevenA 043d45dd73 Drop SRST support
Asterisk does not support SRST
2022-02-01 11:45:51 +01:00
stevenA 79b6010496 Change DND labels 2022-02-01 11:42:55 +01:00
stevenA 9b69d1321a Update Sccp.class.php.v433 2022-02-01 10:42:17 +01:00
stevenA bc7360c6ee Update Sccp.class.php.v433
This function can also be called via FreePbx extensions with an array of ids for deletion. Handle as such
2022-02-01 10:27:52 +01:00
stevenA 35c1b7c708 Fix Issue #65
Do not delete immediately from sccpbuttonconfig when requested by FreePbx, but cache and execute in destructor if no add follows in same instance
2022-02-01 10:09:57 +01:00
Diederik de Groot 824c861775 Fixing multi case switch
(I did check if php had support for the array based case, and i think i did find a link to it. But maybe i misread).
2022-01-31 15:17:54 +01:00
Diederik de Groot 7d9a562c5a Merge branch 'develop' into dkgroot-phonecodepage-ajax 2022-01-31 15:13:45 +01:00
Diederik de Groot cf544b514c Update cisco_language array 2022-01-31 15:12:42 +01:00
stevenA cc6421d3a0 Fix issue #63.
Some device settings were being reset by Doctrine. Ensure that these settings are restored after Doctrine has finished.

Clarify some settings

Remove legacy code which could potentially reset settings
2022-01-31 15:09:17 +01:00
stevenA 98ed27cf8f Update sccpgeneral.xml.v433
Move some fields to advance
Rename some fields to improve user understanding
2022-01-29 14:40:01 +01:00
stevenA fb6e2d8782 Enable named group functionality 2022-01-29 13:38:12 +01:00
stevenA 845ccc2278 Update Sccp_manager.class.php 2022-01-28 11:32:57 +01:00
stevenA 2367203ece Resolve issue of softkeysets lost across installs 2022-01-28 11:19:50 +01:00
stevenA b6485313fd Fix issue where values with spaces are truncated
value needs to be quoted
2022-01-28 09:50:40 +01:00
stevenA 87f90be7b0 Update ajaxHelper.php
Remove debug code
Remove extraneous testing when saving permit / deny as now handled in helper functions
2022-01-28 09:02:02 +01:00
stevenA 24b2dd128c Modify updating sccpsettings in _construct
Remove duplicates from sccpdevmodel array
Improve feedback from module reload
Change update sccpdevmodel process in install
2022-01-27 16:47:56 +01:00
stevenA b212b85b71 Use BMO object in formCreate 2022-01-27 12:36:31 +01:00
stevenA 34ec5dc91a 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:00:28 +01:00
stevenA fb7a7da60a Update SoftKey Set Management
Prior versions relied on preestablished default  softkeyset which was no longer correct, and data from sccp.conf.

Data returned from chan-sccp was mishandled, and only returned a keyset name.

Now process data from AMI and show actual data in use by chan-sccp
2022-01-21 16:12:01 +01:00
stevenA a58d397866 fix reversions after rebase 2022-01-21 08:24:37 +01:00
stevenA 16ee04699b Upgrade Phone Types View
Fix Enable/Disable buttons in Phone Types - now contextual on page
Reformulate sub views (enabled or disabled not all)
Change page Layout and formatting
Fix response feedback
Tidy up html
Fix issue with running validate
2022-01-21 08:16:12 +01:00
stevenA 7caf060e4a Update Phone Types when new device found via hotline
Enable the device in Phone Types to avoid unnecessary fw/templates not found warnings
2022-01-21 08:12:11 +01:00
stevenA b646f4c31f Update install.php
Set default of hotline_enabled to no
2022-01-21 08:12:11 +01:00
stevenA 968210795f Update ajaxHelper.php 2022-01-21 08:12:10 +01:00
stevenA 485ce3fe3a Add FW and Template availability to sccpdevmodel
Rename menu items
Add new fields to sccpdevmodel to show existence of firmware and template files, thereby reducing load times.
2022-01-21 08:11:14 +01:00
stevenA e9a3bf34df Continued Optimisations and Cleaning
Optimise return values from AMI to avoid reformatting
Simplify validate logic
Optimise treatment of ami raw message
Optimise return values from getDb_model_info and clean up method name
Optimize add device moving functions outside of loop
Define unique names for script methods between SIP and SCCP as in same page
2022-01-21 08:11:08 +01:00
stevenA 4fb0ec58b1 Update ajaxHelper.php
Change selection of phonecodepage depending on phone type (java/non-java)
2022-01-21 08:07:58 +01:00
stevenA 2229eef432 Optimise Hint processing
Remove hint processing from __Construct and place in getbuttons, only place where used
Return hint information in correct format from ami, to avoid second formatting
Optimise db calls for hints to speed loading of add/edit device.
2022-01-21 08:05:35 +01:00
stevenA ce383089b8 Revert "Update Response.class.php"
This reverts commit 99c6b8a9b5a84fef0338952c5ff90455b22cd2e9.
2022-01-21 08:04:30 +01:00
stevenA 7b60b20170 Fix installer coding error 2022-01-21 08:04:30 +01:00
stevenA 6b5cd413d7 Update Response.class.php
Change to only modify certain returned fields from convertTable
Need to validate changes for softkeysets as now only return sets and not mode
2022-01-21 08:04:29 +01:00
stevenA 8961ebd5de Optimise aminterface, and calls to it
Only get activeDevices once in doConfigPageInits
Delete redundant functions in Aminterface class
Optimise json handling
2022-01-21 08:04:29 +01:00
stevenA 519c9a1f3b Optimise aminterface class
Remove duplicate functions
Remove legacy tests from _Construct
Optimise JSON handling (eliminate duplicate parsing of rawMessage)
Optimise Message class _Construct - high load so minimise unnecessary calls
2022-01-21 08:04:29 +01:00
stevenA 9138272a46 Remove debug code 2022-01-21 08:04:15 +01:00
stevenA aba1c9595f Fix update settings page on save 2022-01-21 08:01:35 +01:00
stevenA c680ab5bb0 Use doConfigPageInit BMO method
Increase compliance with BMO. Decreases calls and improves responsiveness
2022-01-21 07:58:07 +01:00
stevenA af1725e025 Continued BMO optimisations
Tidy up ajaxHelper
Set correct return values from ajaxHandler
Use BMO __get to minimise construct calls
Implement Module.xml depends
2022-01-21 07:54:51 +01:00
stevenA fbac438a45 Fix update settings page on save 2022-01-21 07:51:36 +01:00
stevenA 9576a17087 Use doConfigPageInit BMO method
Increase compliance with BMO. Decreases calls and improves responsiveness
2022-01-21 07:50:44 +01:00
stevenA 67428fb3be Clean up dbinterface class
Change db search criteria for sip / sccp to improve performance
Use Toast for Save and continue success message
Improve db write performance by simplifying formatting
2022-01-21 07:45:19 +01:00
stevenA b7654a8c75 Remove debug code 2022-01-21 07:45:19 +01:00
stevenA 427d970070 Fix update settings page on save 2022-01-21 07:45:18 +01:00
stevenA c9839eadc5 Use doConfigPageInit BMO method
Increase compliance with BMO. Decreases calls and improves responsiveness
2022-01-21 07:45:18 +01:00
stevenA 7e50dbf2d2 Continued BMO optimisations
Tidy up ajaxHelper
Set correct return values from ajaxHandler
Use BMO __get to minimise construct calls
Implement Module.xml depends
2022-01-21 07:45:10 +01:00
stevenA a3eb87610c Fix update settings page on save 2022-01-21 07:42:34 +01:00
stevenA ea6b7b3783 Use doConfigPageInit BMO method
Increase compliance with BMO. Decreases calls and improves responsiveness
2022-01-21 07:42:22 +01:00
32 changed files with 2818 additions and 2510 deletions

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@ If you add/enable the 'callLogBlfEnabled' xml entry in SEPXXX.cnf.xml under comm
and you have added hints for your local extension in your dialplan, like:
exten => _XX.,hint,SCCP/${EXTEN}
exten => _XX.,hint,SCCP/{$EXTEN}
Then the placed calls list will include the status of the remote extension, like this:

View file

@ -52,9 +52,7 @@ $(document).ready(function () {
success: function (data) {
if (data.status === true) {
if (data.message) {
bs_alert(data.message,data.status);
} else {
fpbxToast(_('Data saved'),'', 'success');
fpbxToast(_(data.message),'', 'success');
}
} else {
bs_alert(data.message,data.status);
@ -92,7 +90,7 @@ $(document).ready(function () {
}
var newLocation = location.href;
newLocation = ('path' in data && data.path !== '') ? data.path : location.pathname;
newLocation += ('search' in data && data.search !== '') ? `${data.search}` : `${location.search}`;
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) {
@ -116,10 +114,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'), "", "");
});
@ -182,16 +176,7 @@ $(document).ready(function () {
// ----------------------- Server.model.Button.Select----------------
$('.dropdown-menu a.dropitem').on("click", function (e) {
$(this).parents('div.btn-group').find('.dropdown_capture').text($(this).text());
// console.log($(this).data('id'));
ref_url = "ajax.php?module=sccp_manager&command=getDeviceModel&type=" + $(this).data('id');
$('#table-models').bootstrapTable('refresh', {url: ref_url});
});
// ---------------------------------------
// Set location.hash when changing tabs so that can return to same tab after reload.
$(".change-tab").click(function(){
@ -528,12 +513,24 @@ $(document).ready(function () {
});
// -----------------------adserver.model view Select models by status----------------
$('.dropdown-menu a.dropitem').on("click", function (e) {
$(this).parents('div.btn-group').find('.dropdown_capture').text($(this).text());
//console.log($(this).data('id'));
ref_url = "ajax.php?module=sccp_manager&command=getDeviceModel&type=" + $(this).data('id');
$('#table-models').bootstrapTable('refresh', {url: ref_url});
$('#table-models').bootstrapTable('uncheckAll');
$("#buttonDeviceEnable").attr('disabled', true);
$("#buttonDeviceDisable").attr('disabled', true);
});
// ---------------------------------------
$('.sccp_update').on('click', function (e) {
// console.log($(this).data('id'));
// ----------------------- Server.keyset form ----------------
// ----------------------- advserver.keyset view ----------------
//
if ($(this).data('id') === 'keyset_add') {
var dev_cmd = 'updateSoftKey';
@ -560,7 +557,8 @@ $(document).ready(function () {
;
}
// ----------------------- Server.model form ----------------
// ----------------------- advserver.model view ----------------
if ($(this).data('id') === 'model_add') {
var dev_cmd = 'model_add';
// var dev_fld = ["model","vendor","dns","buttons","loadimage","loadinformationid","validate","enabled"];
@ -610,8 +608,9 @@ $(document).ready(function () {
i++;
});
}
console.log(datas);
// console.log(datas);
}
// Delete action button
if ($(this).data('id') === 'delete_hardware') {
var dev_cmd = $(this).data('id');
var datas = '';
@ -669,16 +668,16 @@ $(document).ready(function () {
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
data: datas,
success: function (data) {
if (data.status === true) {
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
$('#table-models').bootstrapTable('refresh');
}
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
fpbxToast(data.message,'', 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
$('#table-models').bootstrapTable("resetSearch","");
}
}
} else {
@ -784,31 +783,42 @@ $(document).ready(function () {
// console.log($('#update-sccp-phone').find(':selected').data('val'));
});
// End DOCUMENT READY **************************************************
});
//$("table").on('click-cell.bs.table', function (field, value, row, $element) {
// var id_fld=$element['model']; Работает !
// console.log('Table test: '+ id_fld);
// $('#bt'+id_fld).removeAttr('hidden');
//});
// Bootstrap table Enable / Disable buttons ( class="btn-tab-select")
$("table").on('check-all.bs.table', function (rows) {
var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () {
$(this).removeAttr('disabled');
});
// console.log('Table unselect all' + id_fld);
if (id_fld === 'model') {
var firstRow = $('#table-models').bootstrapTable('getData')[0];
if (firstRow['enabled'] === "1") {
$("#buttonDeviceDisable").removeAttr('disabled');
} else {
$("#buttonDeviceEnable").removeAttr('disabled');
}
} else {
$(".btn-tab-select").each(function () {
$(this).removeAttr('disabled');
});
}
//console.log('Table unselect all' + id_fld);
});
$("table").on('check.bs.table', function (e, row) {
var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () {
$(this).removeAttr('disabled');
});
if (id_fld === 'model') {
if (row['enabled'] === "1") {
$("#buttonDeviceDisable").removeAttr('disabled');
} else if (row['enabled'] === "0") {
$("#buttonDeviceEnable").removeAttr('disabled');
}
} else {
$(".btn-tab-select").each(function () {
$(this).removeAttr('disabled');
});
}
// console.log('Table select ' + id_fld);
});
$("table").on('uncheck.bs.table', function (e, row) {
@ -821,7 +831,7 @@ $("table").on('uncheck.bs.table', function (e, row) {
$(this).attr('disabled', true);
});
}
// console.log('Table unselect ' + id_count);
// console.log('Table unselect ' + id_fld + id_count);
});
$("table").on('uncheck-all.bs.table', function (rows) {
var id_fld = $(this).data('id');
@ -920,32 +930,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)
{
@ -1193,9 +1222,18 @@ function sleep(milliseconds)
// 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
console.log('have click');
var id = $(this).data("for"), input = $("#" + id);
console.log('id ' + id);
console.log('input ' + input);
var edit_style = document.getElementById("edit_" + id).style;
console.log('edit style ' + edit_style);
input = document.getElementsByName(id);
console.log(input);
input = $("input[id^=" + id);
console.log(input);
//input = document.querySelectorAll("[id^=" + id]));
//console.log(input);
if (input.length === 0) {
return;
}
@ -1207,7 +1245,7 @@ $(".sccp-restore").click(function() {
var defaultVal = $(this).data("default");
if ($(this).data("type") === 'radio') {
// simulate read only for checkboxes except default
input.forEach(
input.each(
function(radioElement) {
radioElement.setAttribute('disabled', true);
if (radioElement.value === defaultVal){

View file

@ -134,6 +134,8 @@ and open the template in the editor. Base Version before all crash :-)
<button value="on">On</button>
<help>Global NAT support (default Auto)</help>
</item>
<!--TODO change debug options "core, hint, rtp, device, line, action, channel, config, feature, feature_button, softkey, indicate, pbx,socket, mwi,
event, conference, buttontemplate, speeddial, codec, realtime, parkinglot, none -->
<item type="IS" id="6">
<name>debug</name>
<label>SCCP DEBUG</label>
@ -166,6 +168,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 +197,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 +215,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 +231,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>
@ -283,17 +287,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Digit Timeout: The amount of time to wait after the second (or subsequent) dialed digit. Override rules are the same as for firstdigittimeout.</help>
</item>
<item type="IE" id="3">
<label>No Answer Ring Time</label>
<input>
<name>cfwdnoanswer_timeout</name>
<default>30</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="120"></options>
</input>
<help>Timeout after which callforward noanswer (when active) will be triggered. default is 30 seconds</help>
</item>
<item type="IE" id="3">
<label>Autoanswer Ring Time</label>
<input>
@ -305,43 +298,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Autoanswer Ring Time: The amount of time the phones will ring when being called as Intercom or Paging mode.</help>
</item>
<item type="IE" id="4">
<label>Autoanswer Tone</label>
<input>
<name>autoanswer_tone</name>
<default>0x32</default>
<class>sccp-custom</class>
</input>
<help>Autoanswer Tone: The tone the phone plays back when it picks up the phone in autoanswer mode. Default is '0x32'. Silence is '0x00'. There are lots of tones, all expressed as '0XNN' where 'NN' is a hexadecimal number.</help>
</item>
<item type="IE" id="5">
<label>Remote Hangup Tone</label>
<input>
<name>remotehangup_tone</name>
<default>0x32</default>
<class>sccp-custom</class>
</input>
<help>Remote Hangup Tone: The tone played by the phone when it received a remote hang-up signal. Use '0' to disable the tone.</help>
</item>
<item type="IE" id="6">
<label>Transfer Tone</label>
<input>
<name>transfer_tone</name>
<default>0x32</default>
<class>sccp-custom</class>
</input>
<help>Transfer Tone: The tone played when a call is transferred. Use '0' to disable the tone.</help>
</item>
<item type="IE" id="7">
<label>Call Waiting Tone</label>
<input>
<name>callwaiting_tone</name>
<default>0x2D</default>
<class>sccp-custom</class>
</input>
<help>Call Waiting Tone: The tone played when a call is waiting. If you set this one to '0', you will not get a tone in your current call if a new call comes in, so you might want to disable call waiting for this line instead.</help>
</item>
<item type="IS" id="10">
<name>private</name>
<label>Private Calling</label>
@ -391,6 +347,7 @@ and open the template in the editor. Base Version before all crash :-)
<page_group name="sccp_dev_advconfig">
<label>SCCP Device advanced config</label>
<!--
<item type="IS" id="4" seq="0">
<name>directrtp</name>
<label>Direct RTP</label>
@ -399,6 +356,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="no">NO</button>
<help>This option set global allow devices to do direct RTP sessions (default Off)</help>
</item>
-->
<item type="IS" id="5" seq="99">
<name>earlyrtp</name>
<label>Early RTP</label>
@ -415,6 +373,46 @@ 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="IS" id="7" seq="98">
<name>autoselectline_enabled</name>
<label>Autoselect Line</label>
<default>on</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>Enables and Disables auto line selection.</help>
</item>
<item type="IS" id="10" seq="98">
<name>autocall_select</name>
<label>Auto Call Select</label>
<default>on</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help></help>
</item>
<item type="IS" id="11" seq="98">
<name>callLogBlfEnabled</name>
<label>Allow BLF in Phone Directory</label>
<default>2</default>
<button value="3">Enabled</button>
<button value="2">Disabled</button>
<help>Show numbers you can redial, but also include their current device state, so you know when they are currently busy. Note that the other phonebook entries will now also monitor the remove device state and show the current device state</help>
</item>
<item type="IS" id="8">
<name>echocancel</name>
<label>Echo Cancel</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Echo Cancel: Echo Cancellation (Yes or No).</help>
</item>
<item type="IS" id="9">
<name>silencesuppression</name>
<label>Silence Suppression</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Silence Suppression: Silence Suppression on the phone.</help>
</item>
<item type="IS" id="11" seq="98">
<name>phonepersonalization</name>
<label>Allow push background from server </label>
@ -423,13 +421,61 @@ and open the template in the editor. Base Version before all crash :-)
<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="SLDT" id="4">
<label>Autoanswer Tone</label>
<name>autoanswer_tone</name>
<default>0x32</default>
<class>form-control</class>
<help>Autoanswer Tone: The tone the phone plays back when it picks up the phone in autoanswer mode. Default is 'Zip'.</help>
</item>
<item type="SLDT" id="5">
<label>Remote Hangup Tone</label>
<name>remotehangup_tone</name>
<default>0x32</default>
<class>form-control</class>
<help>Remote Hangup Tone: The tone played by the phone when it received a remote hang-up signal. Default is 'Zip'. Use 'Silence' to disable the tone.</help>
</item>
<item type="SLDT" id="6">
<label>Transfer Tone</label>
<name>transfer_tone</name>
<default>0x32</default>
<class>form-control</class>
<help>Transfer Tone: The tone played when a call is transferred. Default is 'Zip'. Use 'Silence' to disable the tone.</help>
</item>
<item type="SLDT" id="7">
<label>Call Waiting Tone</label>
<name>callwaiting_tone</name>
<default>0x2D</default>
<class>form-control</class>
<help>Call Waiting Tone: The tone played when a call is waiting. Default is 'Call Waiting'. If you set this one to 'Silence', you will not get a tone in your current call if a new call comes in, so you might want to disable call waiting for this line instead.</help>
</item>
<item type="IE" id="3">
<label>No Answer Ring Time</label>
<input>
<name>cfwdnoanswer_timeout</name>
<default>30</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="120"></options>
</input>
<help>Timeout after which callforward noanswer (when active) will be triggered. default is 30 seconds</help>
</item>
<item type="IE" id="5">
<label>Dynamic registration Context</label>
<input>
<name>regcontext</name>
<default>sccpregistration</default>
<class>sccp-custom</class>
</input>
<help>If regcontext is specified in sccp.conf chan-sccp-b will dynamically create and destroy a NoOp priority 1 extension for a given peer/line which registers with the server. If the context is not specified in extension.conf, then it will be dynamically created when an chan-sccp-b agent registers</help>
</item>
</page_group>
<page_group name="sccp_dev_softkey">
<label>Global Enable/Disable Softkeys</label>
<item type="IS" id="2" seq="0">
<name>cfwdall</name>
<label>Call Forward</label>
<label>Enable "Call Forward"</label>
<default>off</default>
<button value="yes">Yes</button>
<button value="no">No</button>
@ -437,7 +483,7 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="3" seq="0">
<name>cfwdbusy</name>
<label>Call Forward busy</label>
<label>Enable "Call Forward when busy"</label>
<default>off</default>
<button value="yes">Yes</button>Call Forward
<button value="no">No</button>
@ -445,7 +491,7 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="3" seq="0">
<name>cfwdnoanswer</name>
<label>Call Forward NOANSWER</label>
<label>Enable "Forward call when not answered"</label>
<default>off</default>
<button value="yes">Yes</button>
<button value="no">No</button>
@ -453,15 +499,16 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="5" seq="0">
<name>dndFeature</name>
<label>DND Button on Device</label>
<label>Enable "Do Not Disturb"</label>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Do Not Disturb. Default is Off</help>
</item>
<item type="IS" id="1" seq="0">
<!--Need to change to enable "Transfer"-->
<name>transfer</name>
<label>Transfer</label>
<label>Enable "Transfer"</label>
<default></default>
<button value="yes">Yes</button>
<button value="no">No</button>
@ -521,26 +568,19 @@ and open the template in the editor. Base Version before all crash :-)
</item>
</page_group>
<page_group name="sccp_dev_vendor_conf">
<label>Device Vendor Setting</label>
<item type="IE" id="3" seq="98">
<label>Log Server</label>
<input>
<name>logserver</name>
<default></default>
<class>sccp-custom</class>
<options placeholder="x.x.x.x:9001" />
</input>
<help>Log server Address: x.x.x.x:9001 </help>
</item>
<item type="IE" id="3" seq="98">
<page_group name="sccp_dev_vendor_display_conf">
<label>Device Display Settings</label>
<item type="IS" id="3" seq="98">
<label>Days Display Not Active</label>
<input>
<name>daysdisplaynotactive</name>
<default></default>
<class>sccp-custom</class>
<options placeholder="1,7" />
</input>
<name>daysdisplaynotactive</name>
<default>off</default>
<button value="1">Sun</button>
<button value="2">Mon</button>
<button value="3">Tue</button>
<button value="4">Wed</button>
<button value="5">Thu</button>
<button value="6">Fri</button>
<button value="7">Sat</button>
<help>Comma separated list of days that the phone's display is not active and will be automatically turned off after the time specified by "displayIdleTimeout" has elapsed (1 - Sunday, 7 - Saturday)</help>
</item>
<item type="IE" id="3" seq="98">
@ -573,6 +613,10 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Timeout in HH:MM format to automatically turn off phone display if outside the time specified by "daysDisplayNotActive", "displayOnTime" and "displayOnTimeout".</help>
</item>
</page_group>
<page_group name="sccp_dev_vendor_access_conf">
<label>Device Access settings</label>
<item type="IS" id="6" seq="98">
<name>settingsaccess</name>
<label>Settings Access</label>
@ -581,14 +625,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="on">Enabled</button>
<help>Whether a user can access the phone settings.</help>
</item>
<item type="IS" id="6" seq="98">
<name>videocapability</name>
<label>Video Capability</label>
<default>off</default>
<button value="off">Disabled</button>
<button value="on">Enabled</button>
<help></help>
</item>
<item type="IS" id="6" seq="98">
<name>webaccess</name>
<label>Web Access</label>
@ -597,6 +633,18 @@ and open the template in the editor. Base Version before all crash :-)
<button value="on">Enabled</button>
<help>Enable the phone's HTTP server.</help>
</item>
</page_group>
<page_group name="sccp_dev_vendor_conf">
<label>Device Vendor Settings</label>
<item type="IS" id="6" seq="98">
<name>videocapability</name>
<label>Video Capability</label>
<default>on</default>
<button value="off">Disabled</button>
<button value="on">Enabled</button>
<help></help>
</item>
<item type="IS" id="6" seq="98">
<name>webadmin</name>
<label>Web Admin</label>
@ -661,6 +709,16 @@ and open the template in the editor. Base Version before all crash :-)
<button value="on">Enabled</button>
<help> Enable Link Layer Discovery Protocol on the PC (computer) port.</help>
</item>
<item type="IE" id="3" seq="98">
<label>Log Server</label>
<input>
<name>logserver</name>
<default></default>
<class>sccp-custom</class>
<options placeholder="x.x.x.x:9001" />
</input>
<help>Log server Address: x.x.x.x:9001 </help>
</item>
</page_group>
<page_group name="sccp_srst">
@ -671,7 +729,6 @@ and open the template in the editor. Base Version before all crash :-)
<element type='p'>You can also configure a Survivable Remote Site Telephony (SRST) reference as the last device in the CallManager(CM) list. This proves especially useful in a remote site configuration where the phones and Asterisk are connected over a WAN network. SRST provides users with fallback support for the IP phones that cannot access the primary, secondary, or tertiary Asterisk Node in the CallManager List because of an Asterisk Node failure or loss of connectivity across the WAN. For the remote sites attached to multiple-service routers across the WAN, SRST ensures that your remote users receive continuous (although minimal) service by providing call handling support directly from the SRST router.</element>
<element type='p'>When IP phones lose contact with primary, secondary, and tertiary Asterisk Nodes (CM's), they must establish a connection to a local SRST router to sustain the call-processing capability necessary to place and receive calls. The IP phone retains the IP address of the local SRST router as a default router in the Network Configuration area of the Settings menu. The Settings menu supports a maximum of five default router entries; however, the cnf.xml accommodates a maximum of three entries. When a secondary Asterisk Node is not available on the network, the local SRST Router's IP address is retained as the standby connection for Asterisk Node during normal operation.</element>
</item>
<item type="IS" id="1" seq="20">
<name>srst_Option</name>
<label>SRST Server Enabled</label>
@ -697,7 +754,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="false">No</button>
<help>The user can change the personal SRST configuration on the device</help>
</item>
<item type="IE" id="2" seq="20">
<label>SRST Config Name</label>
<input>
@ -706,13 +762,12 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>You enabled configure a Survivable Remote Site Telephony (SRST) reference as the last device in the CallManager(CM) list.</help>
</item>
<item type="IED" id="3" seq="20">
<label>SRST Server list</label>
<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>
@ -753,16 +808,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="1" seq="10">
<label>Phone Secure Service URL</label>
<input>
<name>dev_secureservicesURL</name>
<default></default>
<value></value>
<options placeholder="https://x.x.x.x:port/cisco_menu/service.php"></options>
</input>
<help></help>
</item>
<item type="IE" id="2" seq="10">
<label>Phone authentication URL</label>
<input>
@ -773,6 +818,74 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>The above is simply a dummy authentication page. It literally contains one word: AUTHORIZED (it receives UserId, Password, and devicename in the url - if you truly wish to implement special auth)</help>
</item>
<item type="IE" id="4" seq="10">
<label>Phone information URL</label>
<input>
<name>dev_informationURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/information.php"></options>
<default></default>
</input>
<help></help>
</item>
<item type="IE" id="5" seq="10">
<label>Phone messages URL</label>
<input>
<name>dev_messagesURL</name>
<options placeholder="http://x.x.x.x:port/cisco_menu/messages.php"></options>
<default></default>
</input>
<help></help>
</item>
<item type="IE" id="6" seq="10">
<label>Phone directory service URL</label>
<input>
<name>dev_directoryURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/directories.php"></options>
<default></default>
</input>
<help>This is the URL for a CiscoIPPhoneMenu which gets appended to the end of the Missed/Received/Placed calls. I don't use it (I find it makes more sense to put my phone book under services)</help>
</item>
<item type="IE" id="3" seq="10">
<label>Phone Idle information URL</label>
<input>
<name>dev_idleURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/idle.php"></options>
<default></default>
<value></value>
</input>
<help>URL of CiscoIPPhoneImage. Requires a non-zero setting in idleTimeout.</help>
</item>
<item type="IE" id="7" seq="10">
<label>Phone proxyServer URL</label>
<input>
<name>dev_proxyServerURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/proxy.php"></options>
<default></default>
<value></value>
</input>
<help></help>
</item>
<item type="IE" id="8" seq="10">
<label>Phone Idle Timeout</label>
<input>
<name>dev_idleTimeout</name>
<default>60</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="3600"></options>
</input>
<help></help>
</item>
<item type="IE" id="1" seq="10">
<label>Phone Secure Service URL</label>
<input>
<name>dev_secureservicesURL</name>
<default></default>
<value></value>
<options placeholder="https://x.x.x.x:port/cisco_menu/service.php"></options>
</input>
<help></help>
</item>
<item type="IE" id="2" seq="10">
<label>Phone Secure authentication URL</label>
<input>
@ -783,15 +896,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="4" seq="10">
<label>Phone information URL</label>
<input>
<name>dev_informationURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/information.php"></options>
<default></default>
</input>
<help></help>
</item>
<item type="IE" id="4" seq="10">
<label>Phone Secure information URL</label>
<input>
@ -801,15 +905,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="5" seq="10">
<label>Phone messages URL</label>
<input>
<name>dev_messagesURL</name>
<options placeholder="http://x.x.x.x:port/cisco_menu/messages.php"></options>
<default></default>
</input>
<help></help>
</item>
<item type="IE" id="5" seq="10">
<label>Phone Secure messages URL</label>
<input>
@ -819,15 +914,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="6" seq="10">
<label>Phone directory service URL</label>
<input>
<name>dev_directoryURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/directories.php"></options>
<default></default>
</input>
<help>This is the URL for a CiscoIPPhoneMenu which gets appended to the end of the Missed/Received/Placed calls. I don't use it (I find it makes more sense to put my phone book under services)</help>
</item>
<item type="IE" id="6" seq="10">
<label>Phone Secure directory service URL</label>
<input>
@ -837,16 +923,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="3" seq="10">
<label>Phone Idle information URL</label>
<input>
<name>dev_idleURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/idle.php"></options>
<default></default>
<value></value>
</input>
<help>URL of CiscoIPPhoneImage. Requires a non-zero setting in idleTimeout.</help>
</item>
<item type="IE" id="3" seq="10">
<label>Phone Secure Idle information URL</label>
<input>
@ -857,29 +933,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help></help>
</item>
<item type="IE" id="7" seq="10">
<label>Phone proxyServer URL</label>
<input>
<name>dev_proxyServerURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/proxy.php"></options>
<default></default>
<value></value>
</input>
<help></help>
</item>
<item type="IE" id="8" seq="10">
<label>Phone Idle Timeout</label>
<input>
<name>dev_idleTimeout</name>
<default>60</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="3600"></options>
</input>
<help></help>
</item>
</page_group>
<page_group name="sccp_qos_config">
@ -1023,15 +1076,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Context: This is the context in which your phones will operate. It should match the context you are using for the rest of your phones (if you have any). The FreePBX default is 'from-internal'</help>
</item>
<item type="IE" id="5">
<label>Dynamically registration Context</label>
<input>
<name>regcontext</name>
<default>sccpregistration</default>
<class>sccp-custom</class>
</input>
<help>If regcontext is specified in sccp.conf chan-sccp-b will dynamically create and destroy a NoOp priority 1 extension for a given peer/line which registers with the server. If the context is not specified in extension.conf, then it will be dynamically created when an chan-sccp-b agent registers</help>
</item>
<item type="IE" id="7">
<label>Directed pickup context</label>
<input>
@ -1042,6 +1086,7 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
</item>
<!--
<item type="IE" id="7">
<label>Default pickup group</label>
<input>
@ -1052,6 +1097,7 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
</item>
-->
<item type="IS" id="11">
<name>pickup_modeanswer</name>
<label>Directed Pickup Answer</label>
@ -1076,7 +1122,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="no">No</button>
<help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.</help>
</item>
<item type="SLA-disabled" id="6">
<label>Default Dial Plan</label>
<name>dial_template</name>
@ -1085,14 +1130,6 @@ and open the template in the editor. Base Version before all crash :-)
<class>sccp-custom</class>
<help>Help.</help>
</item>
<item type="IS" id="7" seq="98">
<name>autoselectline_enabled</name>
<label>Autoselect Line</label>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>Enables and Disables auto line selection.</help>
</item>
<item type="IS-disabled" id="8" seq="0">
<name>meetme</name>
<label>Meetme Conference</label>
@ -1110,14 +1147,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Other options (app_meetme: A,a,b,c,C,d,D,E,e,F,i,I,l,L,m,M,o,p,P,q,r,s,S,t,T,w,x,X,1) see meetme specific documentation</help>
</item>
<item type="IS" id="10" seq="98">
<name>autocall_select</name>
<label>Auto Call Select</label>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help></help>
</item>
<item type="IS" id="11" seq="98">
<name>backgroundImageAccess</name>
<label>Allow change Background Image</label>
@ -1126,30 +1155,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="off">Disabled</button>
<help>I'm guessing on this one, but on some devices, the background image on the display can be modified at the device. I think this is the thing that allows that to happen.</help>
</item>
<item type="IS" id="11" seq="98">
<name>callLogBlfEnabled</name>
<label>Allow BLF in Phone Directory</label>
<default>2</default>
<button value="3">Enabled</button>
<button value="2">Disabled</button>
<help>Show numbers you can redial, but also include their current device state, so you know when they are currently busy. Note that the other phonebook entries will now also monitor the remove device state and show the current device state</help>
</item>
<item type="IS" id="8">
<name>echocancel</name>
<label>Echo Cancel</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Echo Cancel: Echo Cancellation (Yes or No).</help>
</item>
<item type="IS" id="9">
<name>silencesuppression</name>
<label>Silence Suppression</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Silence Suppression: Silence Suppression on the phone.</help>
</item>
<item type="SLM" id="6">
<label>Music On Hold Class</label>
<name>musicclass</name>
@ -1202,6 +1207,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="pro">Provision</button>
<help>Support the use of regular-expression-based filename remapping</help>
</item>
<!--
<item type="IE" id="2">
<label>SCCP SERVER MySQL Device Table</label>
<input>
@ -1220,6 +1226,7 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Line Table: This is the linetable for your realtime configuration. Don't change this unless you know what you are doing and have made all the appropriate changes in the rest of your Asterisk config files. If you do not want to use the realtime database anymore, you can set this to blank. NOT RECOMMENDED.</help>
</item>
-->
<item type="IS" id="4" seq="99">
<name>createlangdir</name>
<label>Create tftp empty language dir</label>
@ -1488,8 +1495,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>park</name>
<label>Park</label>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Take a look to the compile how-to. Park stuff is not compiled by default.</help>
</item>
<item type="IS" id="2" seq="99">
@ -1510,7 +1517,7 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="3" seq="0">
<name>cfwdnoanswer</name>
<label>Call Forward NOANSWER</label>
<label>Forward call when not answered</label>
<default>on</default>
<button value="yes">Yes</button>
<button value="no">No</button>
@ -1518,10 +1525,10 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="5" seq="99">
<name>dndFeature</name>
<label>DND Button on Device</label>
<label>Enable "Do Not Disturb"</label>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Do Not Disturb. Default is Off</help>
</item>
<item type="IS" id="1" seq="99">
@ -1558,8 +1565,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>mwioncall</name>
<label>Message Lamp On Call</label>
<default>on</default>
<button value="on">Yes</button>
<button value="off">No</button>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Set the MWI on call.</help>
</item>
@ -1683,6 +1690,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>
@ -1690,11 +1698,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}$"/>
@ -1703,6 +1707,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>
@ -1715,6 +1720,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="on">On</button>
<help>Device NAT support (default Auto)</help>
</item>
<!--
<item type="IS" id="4" seq="99">
<name>directrtp</name>
<label>Direct RTP</label>
@ -1723,7 +1729,8 @@ and open the template in the editor. Base Version before all crash :-)
<button value="Yes">Yes</button>
<help>This option allow devices to do direct RTP sessions (default Off)</help>
</item>
<item type="IS" id="5" seq="99">
-->
<item type="IS" id="5" seq="98">
<name>earlyrtp</name>
<label>Early RTP</label>
<default></default>
@ -2022,6 +2029,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>
@ -2055,6 +2063,24 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Context: This is the context in which your phones will operate. It should match the context you are using for the rest of your phones (if you have any). The FreePBX default is 'from-internal'</help>
</item>
<item type="SLG" id="7">
<label>Named Call Group</label>
<name>namedcallgroup</name>
<select>
<default></default>
</select>
<help>Sets the groups this line is a member of. Incoming calls to this line are given these groups as an identifier. This is a comma separated list of group names.
(It is not recommended to use numeric names)
</help>
</item>
<item type="SLG" id="7">
<label>Named Pickup Group</label>
<name>namedpickupgroup</name>
<select>
<default></default>
</select>
<help>This is the list of groups that this line can pickup from. This is a comma separated list of group names</help>
</item>
<item type="IE" id="7">
<label>Directed pickup context</label>
<input>
@ -2063,23 +2089,23 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="from_internal"></options>
<class>sccp-custom</class>
</input>
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
<help>Context where direct pickup searches for extensions. if not set current context will be use.</help>
</item>
<item type="SLG" id="7">
<label>Named Call Group</label>
<name>namedcallgroup</name>
<select>
<default></default>
</select>
<help>Sets the named caller groups this line is a member of</help>
<item type="IS" id="11">
<name>directed_pickup</name>
<label>Directed Pickup</label>
<default></default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Enable/disable directed Pickup button (to do directed pickup from a specific extension).</help>
</item>
<item type="SLG" id="7">
<label>Named Pickup Group</label>
<name>namedpickupgroup</name>
<select>
<default></default>
</select>
<help>Named PickupGroup - the list is of pickup groups used on the system</help>
<item type="IS" id="11">
<name>pickup_modeanswer</name>
<label>Directed Pickup Answer</label>
<default>off</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>When using directed pickup, if this flag is set to Yes, the call will automatically be answered upon pickup</help>
</item>
<item type="IE" id="7">
<label>Secondary dialtone digits</label>
@ -2098,22 +2124,6 @@ and open the template in the editor. Base Version before all crash :-)
</select>
<help>Outside dialtone frequency (default 0x22)</help>
</item>
<item type="IS" id="11">
<name>directed_pickup</name>
<label>Directed Pickup</label>
<default></default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Enable/disable Pickup button to do directed pickup from a specific extension.</help>
</item>
<item type="IS" id="11">
<name>pickup_modeanswer</name>
<label>Directed Pickup Answer</label>
<default>off</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Directed Pickup Mode (Answer): If a call is sent with the "directed pickup" flag, the phone will answer when set to "Yes".</help>
</item>
<item type="IS" id="1" seq="0">
<name>transfer</name>
<label>Transfer</label>

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();
@ -40,21 +38,19 @@ foreach ($requiredClasses as $className) {
include(__DIR__ . "/sccpManClasses/$className.class.php");
}
if (class_exists($class, false)) {
${$className} = new $class();
{$$className} = new $class();
}
}
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();
@ -101,56 +94,51 @@ function Get_DB_config($sccp_compatible)
'pickupmodeanswer' => array('drop' => "yes"),
'disallow' => array('drop' => "yes"),
'callhistory_answered_elsewhere' => array('create' => "enum('Ignore','Missed Calls','Received Calls', 'Placed Calls') NOT NULL default 'Ignore'",
'modify' => "enum('Ignore','Missed Calls','Received Calls','Placed Calls')"),
'hwlang' => array('rename' => "_hwlang"),
'_hwlang' => array('create' => 'VARCHAR(12) NULL DEFAULT NULL'),
'_loginname' => array('create' => 'VARCHAR(20) NULL DEFAULT NULL AFTER `_hwlang`'),
'_profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0' AFTER `_loginname`"),
'_dialrules' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `_profileid`"),
'useRedialMenu' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
'modify' => "enum('Ignore','Missed Calls','Received Calls','Placed Calls') NOT NULL"),
'useRedialMenu' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no') NOT NULL"),
'dtmfmode' => array('drop' => "yes"),
'force_dtmfmode' => array('create' => "ENUM('auto','rfc2833','skinny') NOT NULL default 'auto'",
'modify' => "ENUM('auto','rfc2833','skinny')"),
'modify' => "ENUM('auto','rfc2833','skinny') NOT NULL"),
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'transfer' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes')"),
'cfwdall' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'cfwdbusy' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'cfwdnoanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'park' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'directrtp' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes')"),
'dndFeature' => array('create' => "enum('off','on') NOT NULL default 'off'", 'modify' => "enum('off','on')"),
'earlyrtp' => array('create' => "ENUM('yes','no') NOT NULL default 'yes'", 'modify' => "ENUM('yes','no')"),
'monitor' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'audio_tos' => array('create' => "VARCHAR(11) NOT NULL default '0xB8'",'modify' => "0xB8"),
'audio_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x6'",'modify' => "0x6"),
'video_tos' => array('create' => "VARCHAR(11) NOT NULL default '0x88'",'modify' => "0x88"),
'video_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x5'",'modify' => "0x5"),
'transfer' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes') NOT NULL"),
'cfwdall' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'cfwdbusy' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'cfwdnoanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'park' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'directrtp' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes') NOT NULL"),
'dndFeature' => array('create' => "enum('off','on') NOT NULL default 'off'", 'modify' => "enum('off','on') NOT NULL"),
'earlyrtp' => array('create' => "ENUM('yes','no') NOT NULL default 'yes'", 'modify' => "ENUM('yes','no') NOT NULL"),
'monitor' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'audio_tos' => array('create' => "VARCHAR(11) NOT NULL default '0xB8'", 'modify' => "VARCHAR(11)"),
'audio_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x6'", 'modify' => "VARCHAR(11)"),
'video_tos' => array('create' => "VARCHAR(11) NOT NULL default '0x88'", 'modify' => "VARCHAR(11)"),
'video_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x5'", 'modify' => "VARCHAR(11)"),
'trustphoneip' => array('drop' => "yes"),
'transfer_on_hangup' => array('create' => "enum('yes','no') NOT NULL DEFAULT 'no'", 'modify' => "enum('yes','no')"),
'transfer_on_hangup' => array('create' => "enum('yes','no') NOT NULL DEFAULT 'no'", 'modify' => "enum('yes','no') NOT NULL"),
'phonecodepage' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL', 'modify' => "VARCHAR(50)"),
'mwilamp' => array('create' => "enum('on','off','wink','flash','blink') NOT NULL default 'on'",
'modify' => "enum('on','off','wink','flash','blink')"),
'mwioncall' => array('create' => "enum('no','yes') NOT NULL default 'yes'",'modify' => "enum('no','yes')"),
'private' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
'privacy' => array('create' => "enum('full','on','off') NOT NULL default 'full'", 'modify' => "enum('full','on','off')"),
'nat' => array('create' => "enum('on','off','auto') NOT NULL default 'off'", 'modify' => "enum('on','off','auto')"),
'conf_allow' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'conf_play_part_announce' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'conf_mute_on_entry' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'conf_show_conflist' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'modify' => "enum('on','off','wink','flash','blink') NOT NULL"),
'mwioncall' => array('create' => "enum('no','yes') NOT NULL default 'yes'",'modify' => "enum('no','yes') NOT NULL"),
'private' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no') NOT NULL"),
'privacy' => array('create' => "enum('full','on','off') NOT NULL default 'full'", 'modify' => "enum('full','on','off') NOT NULL"),
'nat' => array('create' => "enum('on','off','auto') NOT NULL default 'off'", 'modify' => "enum('on','off','auto') NOT NULL"),
'conf_allow' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'conf_play_part_announce' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'conf_mute_on_entry' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'conf_show_conflist' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'type' => array('create' => 'VARCHAR(15) NULL DEFAULT NULL', 'modify' => "VARCHAR(15)"),
'imageversion' => array('create' => 'VARCHAR(31) NULL DEFAULT NULL', 'modify' => "VARCHAR(31)"),
'softkeyset' => array('def_modify' => "softkeyset")
),
'sccpline' => array(
'directed_pickup' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
'directed_pickup' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no') NOT NULL"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickup_modeanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
'namedpickupgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
'pickup_modeanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'namedcallgroup' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
'namedpickupgroup' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
'adhocNumber' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
'meetme' => array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
'context' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `description`", 'def_modify' => 'from-internal'),
@ -162,34 +150,34 @@ function Get_DB_config($sccp_compatible)
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'videomode' => array('create' => "enum('auto','user','off') NOT NULL default 'auto'", 'modify' => "enum('auto','user','off')"),
'videomode' => array('create' => "enum('auto','user','off') NOT NULL default 'auto'", 'modify' => "enum('auto','user','off') NOT NULL"),
'incominglimit' => array('create' => "INT(11) DEFAULT '6'", 'modify' => 'INT(11)', 'def_modify' => "6"),
'transfer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'transfer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'vmnum' => array('def_modify' => "*97"),
'musicclass' => array('def_modify' => "default"),
'disallow' => array('create' => "VARCHAR(255) NULL DEFAULT 'all'", 'modify' => 'VARCHAR(255)'),
'allow' => array('create' => "VARCHAR(255) NULL DEFAULT NULL"),
'id' => array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)", 'index' => 'id'),
'echocancel' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'silencesuppression' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes')"),
'dnd' => array('create' => "enum('reject','off','silent','user') NOT NULL default 'reject'", 'modify' => "enum('reject','off','silent','user')", 'def_modify' => "reject")
'echocancel' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL"),
'silencesuppression' => array('create' => "enum('no','yes') NOT NULL default 'no'", 'modify' => "enum('no','yes') NOT NULL"),
'dnd' => array('create' => "enum('reject','off','silent','user') NOT NULL default 'reject'", 'modify' => "enum('reject','off','silent','user') NOT NULL", 'def_modify' => "reject")
),
'sccpuser' => array(
'name' => array('create' => "VARCHAR(20) NOT NULL", 'modify' => "VARCHAR(20)" ),
'pin' => array('create' => "VARCHAR(7) NOT NULL", 'modify' => "VARCHAR(7)" ),
'password' => array('create' => "VARCHAR(7) NOT NULL", 'modify' => "VARCHAR(7)" ),
'description' => array('create' => "VARCHAR(45) NOT NULL", 'modify' => "VARCHAR(45)" ),
'roaminglogin' => array('create' => "ENUM('off','on','multi') NOT NULL DEFAULT 'off'", 'modify' => "ENUM('on','off','multi')" ),
'auto_logout' => array('create' => "ENUM('on','off') NOT NULL DEFAULT 'off'", 'modify' => "ENUM('on','off')" ),
'roaminglogin' => array('create' => "ENUM('off','on','multi') NOT NULL DEFAULT 'off'", 'modify' => "ENUM('on','off','multi') NOT NULL" ),
'auto_logout' => array('create' => "ENUM('on','off') NOT NULL DEFAULT 'off'", 'modify' => "ENUM('on','off') NOT NULL" ),
'homedevice' => array('create' => "VARCHAR(20) NOT NULL", 'modify' => "VARCHAR(20)" ),
'devicegroup' => array('create' => "VARCHAR(7) NOT NULL", 'modify' => "VARCHAR(7)" ),
),
'sccpbuttonconfig' => array(
'reftype' => array('create' => "enum('sccpdevice', 'sipdevice', 'sccpuser') NOT NULL default 'sccpdevice'",
'modify' => "enum('sccpdevice', 'sipdevice', 'sccpuser')" ),
'modify' => "enum('sccpdevice', 'sipdevice', 'sccpuser') NOT NULL" ),
)
);
// 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")
@ -198,7 +186,7 @@ function Get_DB_config($sccp_compatible)
'pickupexten' => array('drop' => "yes"),
'directed_pickup' => array('drop' => "yes"),
'cfwdnoanswer' => array('create' => "enum('yes','no') NULL default 'yes'", 'modify' => "enum('yes','no')"),
'park' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"),
'park' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'monitor' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
'_description' => array('rename' => "description"),
'_loginname' => array('drop' => "yes"),
@ -225,17 +213,17 @@ function Get_DB_config($sccp_compatible)
'displayontime' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'displayonduration' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'displayidletimeout' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'settingsaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'videocapability' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'webaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'webadmin' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'pcport' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'spantopcport' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'voicevlanaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'enablecdpswport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'enablecdppcport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'enablelldpswport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'enablelldppcport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'settingsaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'videocapability' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'webaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'webadmin' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'pcport' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'spantopcport' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off') NOT NULL"),
'voicevlanaccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'enablecdpswport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'enablecdppcport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'enablelldpswport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'enablelldppcport' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'firstdigittimeout' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'digittimeout' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'cfwdnoanswer_timeout' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
@ -245,7 +233,7 @@ function Get_DB_config($sccp_compatible)
'transfer_tone' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'callwaiting_tone' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
'callanswerorder' => array('create' => "enum('oldestfirst','latestfirst') NOT NULL default 'latestfirst'",
'modify' => "enum('oldestfirst','latestfirst')"),
'modify' => "enum('oldestfirst','latestfirst') NOT NULL"),
'sccp_tos' => array('create' => "VARCHAR(11) NOT NULL default '0x68'", 'modify' => "VARCHAR(11)"),
'sccp_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x4'", 'modify' => "VARCHAR(11)"),
'dev_sshPassword' => array('create' => "VARCHAR(25) NOT NULL default 'cisco'"),
@ -255,64 +243,26 @@ function Get_DB_config($sccp_compatible)
'profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0'"),
'dialrules' => array('create' => "VARCHAR(255) NULL DEFAULT NULL"),
'description' => array('create' => "VARCHAR(45) NULL DEFAULT NULL"),
'_hwlang' => array ('drop' => 'yes'),
'devlang' => array('create' => "VARCHAR(50) NULL default NULL", 'modify' => "VARCHAR(50)"),
'netlang' => array('create' => "VARCHAR(50) NULL default NULL", 'modify' => "VARCHAR(50)"),
'_devlang' => array('rename' => "devlang"),
'_netlang' => array('rename' => "netlang"),
'_logserver' => array('rename' => 'logserver'),
'_daysdisplaynotactive' => array('rename' => 'daysdisplaynotactive'),
'_displayontime' => array('rename' => 'displayontime'),
'_displayonduration' => array('rename' => 'displayonduration'),
'_displayidletimeout' => array('rename' => 'displayidletimeout'),
'_settingsaccess' => array('rename' => 'settingsaccess'),
'_videocapability' => array('rename' => 'videocapability'),
'_webaccess' => array('rename' => 'webaccess'),
'_webadmin' => array('rename' => 'webadmin'),
'_pcport' => array('rename' => 'pcport'),
'_spantopcport' => array('rename' => 'spantopcport'),
'_voicevlanaccess' => array('rename' => 'voicevlanaccess'),
'_enablecdpswport' => array('rename' => 'enablecdpswport'),
'_enablecdppcport' => array('rename' => 'enablecdppcport'),
'_enablelldpswport' => array('rename' => 'enablelldpswport'),
'_enablelldppcport' => array('rename' => 'enablelldppcport'),
'_firstdigittimeout' => array('rename' => 'firstdigittimeout'),
'_digittimeout' => array('rename' => 'digittimeout'),
'_cfwdnoanswer_timeout' => array('rename' => 'cfwdnoanswer_timeout'),
'_autoanswer_ring_time' => array('rename' => 'autoanswer_ring_time'),
'_autoanswer_tone' => array('rename' => 'autoanswer_tone'),
'_remotehangup_tone' => array('rename' => 'remotehangup_tone'),
'_transfer_tone' => array('rename' => 'transfer_tone'),
'_callwaiting_tone' => array('rename' => 'callwaiting_tone'),
'_callanswerorder' => array('rename' => 'callanswerorder'),
'_sccp_tos' => array('rename' => 'sccp_tos'),
'_sccp_cos' => array('rename' => 'sccp_cos'),
'_dev_sshPassword' => array('rename' => 'dev_sshPassword'),
'_dev_sshUserId' => array('rename' => 'dev_sshUserId'),
'_phonepersonalization' => array('rename' => '_phonepersonalization'),
'_loginname' => array('rename' => 'loginname'),
'_profileid' => array('rename' => 'profileid'),
'_dialrules' => array('rename' => 'dialrules'),
'_description' => array('rename' => 'description'),
'keepalive' => array('create' => "INT(11) DEFAULT '60'", 'modify' => 'INT(11)', 'def_modify' => "60")
'keepalive' => array('create' => "INT(11) DEFAULT '60'", 'modify' => 'INT(11)', 'def_modify' => "60"),
'park' => array('create' => "enum('yes','no') NULL default 'yes'", 'modify' => "enum('yes','no') NOT NULL")
),
'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')"),
'autocall_select' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'backgroundImageAccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'callLogBlfEnabled' => array('create' => "enum('3','2') NOT NULL default '2'", 'modify' => "enum('3','2')"),
'_regcontext' => array('rename' => 'regcontext'),
'_transfer_on_hangup' => array('rename' => 'transfer_on_hangup'),
'_autoselectline_enabled' => array('rename' => 'autoselectline_enabled'),
'_autocall_select' => array('rename' => 'autocall_select'),
'_backgroundImageAccess' => array('rename' => 'backgroundImageAccess'),
'_callLogBlfEnabled' => array('rename' => 'callLogBlfEnabled')
'transfer_on_hangup' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'autoselectline_enabled' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'autocall_select' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'backgroundImageAccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off') NOT NULL"),
'callLogBlfEnabled' => array('create' => "enum('3','2') NOT NULL default '2'", 'modify' => "enum('3','2') NOT NULL"),
),
'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') NOT NULL"),
'templatefound' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no') NOT NULL")
)
);
if ($sccp_compatible >= 433) {
@ -325,6 +275,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,10 +320,8 @@ 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)
@ -407,36 +356,36 @@ function InstallDB_updateSchema($db_config)
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";
return "{$carry} {$column} IS NOT NULL OR";
});
unset($column);
$sqlFields = array_reduce($fieldsArr, function($carry, $column) {
return "${carry} ${column} AS " . ltrim($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 = $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]}'," : "";
$carry .= (isset($columnArr[$key])) ? "{$key} = '{$columnArr[$key]}'," : "";
return $carry;
});
$sqlVar = rtrim($sqlVar, ",");
$stmt = $db->prepare("UPDATE ${table} SET ${sqlVar} WHERE name = '${name}'");
$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},";
return "{$carry} DROP COLUMN {$column},";
});
$sqlDrop = rtrim($sqlDrop, ", ");
$stmt = $db->prepare("ALTER TABLE ${table} ${sqlDrop}");
$stmt = $db->prepare("ALTER TABLE {$table} {$sqlDrop}");
$stmt->execute();
}
@ -479,11 +428,14 @@ function InstallDB_updateSchema($db_config)
$sql_modify .= "MODIFY COLUMN {$fld_id} {$tab_modif[$fld_id]['modify']} DEFAULT '{$tab_modif[$fld_id]['def_modify']}', ";
// def_modify has been used so unset
unset($tab_modif[$fld_id]['def_modify']);
/*
} else if (!empty($tab_modif[$fld_id]['create'])) {
// use create attributes
// use create attributes. This is dangerous as will overwrite defaults - drop this
// and require specific def_modify if really want to change defaults
$sql_modify .= "MODIFY COLUMN {$fld_id} {$tab_modif[$fld_id]['create']}, ";
*/
} else {
// No default to modify so leave unchanged
// No default to modify so leave default unchanged
$sql_modify .= "MODIFY COLUMN {$fld_id} {$tab_modif[$fld_id]['modify']}, ";
}
$count_modify ++;
@ -536,6 +488,7 @@ function InstallDB_updateSchema($db_config)
}
}
// only case left to handle is create as all others handled above
// This should never be used - creates should be handled by doctrine or will have dataloss on subsequent installs.
foreach ($tab_modif as $row_fld => $row_data) {
if (!empty($row_data['create'])) {
$sql_create .= "ADD COLUMN {$row_fld} {$row_data['create']}, ";
@ -573,137 +526,147 @@ function InstallDB_updateSchema($db_config)
}
outn("<li>" . _("Total modify count :") . $count_modify . "</li>");
// Force update of sccp devmodel to ensure changes are taken into account
// 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;
};
// 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, 5, '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");
@ -1017,13 +980,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>");
@ -1051,7 +1007,7 @@ function checkTftpServer() {
// TODO: Depending on distro, do we have write permissions
foreach ($possibleFtpDirs as $dirToTest) {
if (is_dir($dirToTest) && is_writable($dirToTest)) {
$tempFile = "${dirToTest}/{$remoteFileName}";
$tempFile = "{$dirToTest}/{$remoteFileName}";
file_put_contents($tempFile, $remoteFileContent);
// try to pull the written file through tftp.
@ -1133,7 +1089,6 @@ function cleanUpSccpSettings() {
$stmt = $db->prepare("SELECT keyword, sccpsettings.* FROM sccpsettings");
$stmt->execute();
$settingsFromDb = $stmt->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
// See if a previous version was installed
outn("<li>" . _("Checking for previous version of Sccp_manager.") . "</li>");
if (!isset($settingsFromDb['sccp_compatible']['data'])) {
@ -1141,20 +1096,6 @@ function cleanUpSccpSettings() {
} else {
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);
@ -1169,7 +1110,6 @@ function cleanUpSccpSettings() {
}
$settingsFromDb = array_merge($settingsFromDb, array_diff_key($thisInstaller->sccpvalues, $settingsFromDb));
unset($thisInstaller->sccpvalues);
// get chan-sccp defaults
foreach (array('general','device','line') as $section) {
@ -1222,6 +1162,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]);
}
@ -1267,7 +1209,6 @@ function cleanUpSccpSettings() {
$settingsFromDb[$key]['data'] = '';
$count++;
}
// Write settings back to db
$sql = "TRUNCATE sccpsettings";
$results = $db->query($sql);
@ -1283,9 +1224,27 @@ function cleanUpSccpSettings() {
)";
$results = $db->query($sql);
}
//Have saved settings, now need to reset db defaults which have possible been mangled by Doctrine
// TODO: This needs to be integrated better with InstallDB_updateSchema
foreach (['sccpdevice', 'sccpline'] as $table) {
$sql_modify = '';
$stmt = $db->prepare("DESCRIBE {$table}");
$stmt->execute();
$db_result = $stmt->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
foreach ($db_result as $key => $value) {
if (!empty($settingsFromDb[$key]['data'])) {
$sql_modify .= "ALTER COLUMN {$key} SET DEFAULT '{$settingsFromDb[$key]['data']}', ";
}
}
$sql_modify = rtrim($sql_modify, ', ');
$stmt = $db->prepare("ALTER TABLE {$table} {$sql_modify}");
$stmt->execute();
}
// 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.4.0.6</version>
<version>16.0.0.2</version>
<type>setup</type>
<category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher>
@ -9,8 +9,8 @@
<description>SCCP Phone and Extension Manager</description>
<menuitems>
<sccpsettings sort="1">Server Config</sccpsettings>
<sccp_adv sort="2">System Parameters</sccp_adv>
<sccp_phone sort="3">Phones Manager</sccp_phone>
<sccp_adv sort="2">Phone Types</sccp_adv>
<sccp_phone sort="3">Lines and Devices</sccp_phone>
</menuitems>
<changelog>
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
@ -41,6 +41,10 @@
* 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.1 * - Fix issue #32.
* Version 14.5.0.4 * - Fix issue where values with spaces are truncated. Preserve softkeys accross installs
* Version 16.0.0.1 * - Improve compliance and use of BMO to optimise performance
</changelog>
<location>https://github.com/chan-sccp/sccp_manager</location>
<depends>
@ -79,9 +83,9 @@
<field name="directrtp" type="string" notnull="false"/>
<field name="softkeyset" type="string" length="100" default="softkeyset" notnull="false"/>
<field name="audio_tos" type="string" length="11" default="0xB8" notnull="false"/>
<field name="audio_cos" type="string" length="1" default="6" notnull="false"/>
<field name="audio_cos" type="string" length="11" default="6" notnull="false"/>
<field name="video_tos" type="string" length="11" default="0x88" notnull="false"/>
<field name="video_cos" type="string" length="1" default="5" notnull="false"/>
<field name="video_cos" type="string" length="11" default="5" notnull="false"/>
<field name="conf_allow" type="string" default="on"/>
<field name="conf_play_general_announce" type="string" length="3" default="on" notnull="false"/>
<field name="conf_play_part_announce" type="string" default="on"/>
@ -108,37 +112,37 @@
<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="_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="_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="_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="_displayidletimeout" type="string" length="20" notnull="false"/>
<field name="settingsaccess" type="string" default="off"/>
<field name="settingsaccess" type="string"/>
<field name="_settingsaccess" type="string" notnull="false"/>
<field name="videocapability" type="string" default="off"/>
<field name="videocapability" type="string"/>
<field name="_videocapability" type="string" notnull="false"/>
<field name="webaccess" type="string" default="off"/>
<field name="webaccess" type="string"/>
<field name="_webaccess" type="string" notnull="false"/>
<field name="webadmin" type="string" default="off"/>
<field name="webadmin" type="string"/>
<field name="_webadmin" type="string" notnull="false"/>
<field name="pcport" type="string" default="on"/>
<field name="pcport" type="string"/>
<field name="_pcport" type="string" notnull="false"/>
<field name="spantopcport" type="string" default="on"/>
<field name="spantopcport" type="string"/>
<field name="_spantopcport" type="string" notnull="false"/>
<field name="voicevlanaccess" type="string" default="off"/>
<field name="voicevlanaccess" type="string"/>
<field name="_voicevlanaccess" type="string" notnull="false"/>
<field name="enablecdpswport" type="string" default="off"/>
<field name="enablecdpswport" type="string"/>
<field name="_enablecdpswport" type="string" notnull="false"/>
<field name="enablecdppcport" type="string" default="off"/>
<field name="enablecdppcport" type="string"/>
<field name="_enablecdppcport" type="string" notnull="false"/>
<field name="enablelldpswport" type="string" default="off"/>
<field name="enablelldpswport" type="string"/>
<field name="_enablelldpswport" type="string" notnull="false"/>
<field name="enablelldppcport" type="string" default="off"/>
<field name="enablelldppcport" type="string"/>
<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="_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"/>
@ -196,8 +200,8 @@
<field name="silencesuppression" type="string" default="off"/>
<field name="callgroup" type="string" length="45" notnull="false"/>
<field name="pickupgroup" type="string" length="45" notnull="false"/>
<field name="namedcallgroup" type="string" length="100" notnull="false"/>
<field name="namedpickupgroup" type="string" length="100" notnull="false"/>
<field name="namedcallgroup" type="string" length="255" notnull="false"/>
<field name="namedpickupgroup" type="string" length="255" notnull="false"/>
<field name="adhocNumber" type="string" length="45" notnull="false"/>
<field name="meetme" type="string" length="5" notnull="false"/>
<field name="meetmenum" type="string" length="45" notnull="false"/>
@ -249,6 +253,8 @@
<field name="loadinformationid" type="string" length="30" notnull="false"/>
<field name="enabled" type="integer" default="0" notnull="false"/>
<field name="nametemplate" type="string" length="50" notnull="false"/>
<field name="fwfound" type="string" length="50" notnull="false"/>
<field name="templatefound" type="string" length="50" notnull="false"/>
<key name="model" type="index">
<column name="model"/>
</key>

View file

@ -17,7 +17,7 @@ if (!defined('FREEPBX_IS_AUTH')) {
$spage = FreePBX::create()->Sccp_manager;
if (empty($spage->class_error)) {
$display_page = $spage->advServerShowPage();
$display_info = _("SCCP Advance Server Configuration");
$display_info = _("Phone Management");
} else {
$display_page = $spage->infoServerShowPage();
$display_info = _("SCCP Server Configuration");

View file

@ -72,9 +72,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
);
private $line_defaults = array();
public $delId = array();
public $cachedDeleteStatement;
public function __construct($parent_class = null) {
$this->freepbx = $parent_class;
$this->database = $parent_class->Database();
// Get system defaults [systemdefault] and sitedefaults [data] from sccpsettings.
@ -97,6 +98,14 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($raw_settings, $siteDefaults, $sccpDefaults);
}
public function __destruct() {
foreach ($this->delId as $clearId) {
if (isset($this->cachedDeleteStatement[$clearId])) {
$this->cachedDeleteStatement[$clearId]->execute();
}
}
}
public function getInfo() {
return array(
"rawName" => "sccp",
@ -110,6 +119,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
}
public function addDevice($id, $settings) {
// If editing, have first passed by delDevice, so have cached PDO statement
// to remove this device from sccpbuttonconfig. As this is an edit, clear that statement.
if (isset($this->cachedDeleteStatement[$id])) {
unset($this->cachedDeleteStatement[$id]);
}
// This is actually save line and is used by add and edit.
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
$settings['cid_num']['value'] = '';
@ -184,17 +199,22 @@ class Sccp extends \FreePBX\modules\Core\Driver {
}
public function delDevice($id) {
//Required by FreePBX.
// Delete associated default line buttons or will leave orphans
foreach (array($id) as $openId) {
$sth = $this->database->prepare("DELETE FROM sccpbuttonconfig WHERE name LIKE :openID AND buttontype = 'line'");
$openId = "{$openId}%";
$sth->bindParam(':openID', $openId);
/*Required by FreePBX.
FreePbx edit is a delete followed by an add. Do not want to delete the
sccpbuttonconfig if we are editing, so store the statement, and execute via the destructor
if no add has followed
*/
// Delete associated default line buttons or will leave orphans. Cache this statement
// execution is in the destructor
//when called from extensions as delete, id can be a list of ids
// TODO: Could be other buttons that refer this id (by name rather than id) - need to clear these as well.
foreach (array($id) as $clearId) {
$this->cachedDeleteStatement[$clearId] = $this->database->prepare("DELETE FROM sccpbuttonconfig WHERE name LIKE '{$clearId}%' AND buttontype = 'line'");
$this->delId[] = $clearId;
// Delete the line as requested - if edit will add again in addDevice
$sth = $this->database->prepare("DELETE FROM sccpline WHERE name = {$clearId}");
$sth->execute();
}
$sth = $this->database->prepare("DELETE FROM sccpline WHERE name = ?");
$sth->execute(array($id));
return true;
}
@ -413,21 +433,28 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($select);
break;
case 'SLG':
// namedcallgroup and namedpickupgroup.
//$extensionId = $display_info['id'];
$elementID = (string)$child->name;
$named_group = \FreePbx::sccp_manager()->dbinterface->getNamedGroup($elementID);
if (!empty($named_group[$elementID])) {
$setting[$elementID] = \FreePbx::sccp_manager()->dbinterface->getLineGroups($elementID, $deviceInfo['id']);
$named_group = \FreePbx::sccp_manager()->dbinterface->getNamedGroup('namedcallgroup');
if (!empty($named_group['namedcallgroup'])) {
/* This commented out code will display as a list
foreach ($named_group[$elementID] as $val) {
$select[] = array('value' => $val, 'text' => $val);
}
*/
$select = ltrim(implode(',', $named_group['namedcallgroup']), " ,");
}
// Disable and hide list elements if there are no valid values
$thisHelp = (string)$child->help . ". <br>Known sccp named groups are: " . $select;
//Need element (array)select in array below to have list.
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[(string)$child->name],
'tt' => (string)$child->help,
'select' => $select,
'value' => $setting[$elementID],
'tt' => $thisHelp,
'level' => 1,
'disable' => empty($named_group[$elementID][0]),
'hidden' => empty($named_group[$elementID][0]),
'disable' => empty($named_group),
'hidden' => empty($named_group),
'section' => $section,
'category' => $gn_category
);

View file

@ -1,13 +1,5 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Event *********************************************
@ -109,7 +101,8 @@ class SCCPShowDevice_Event extends Event
}
return $ret;
}
}
/*
public function getCodecsPreference()
{
// TODO unused method - to be deleted?
@ -121,7 +114,8 @@ class SCCPShowDevice_Event extends Event
}
return $ret;
}
}
*/
//}
class SCCPDeviceButtonEntry_Event extends Event
{
}

View file

@ -17,7 +17,6 @@ class AMIException extends \Exception
abstract class Message
{
const EOL = "\r\n";
const EOM = "\r\n\r\n";
@ -71,7 +70,8 @@ abstract class Message
print_r($value);
*/
}
/*
// Duplicate declaration - also declared in Response class where is used.
public function getVariable($key)
{
$key = strtolower($key);
@ -81,17 +81,11 @@ abstract class Message
}
return $this->variables[$key];
}
*/
protected function setKey($key, $value)
{
$key = strtolower((string) $key);
$this->keys[$key] = (string) $value;
/*
print_r('<br>----Set Key -------<br>');
print_r($key);
print_r($value);
*
*/
}
public function getKey($key)
@ -108,12 +102,12 @@ abstract class Message
{
return $this->variables;
}
/*
public function getActionID()
{
return $this->getKey('ActionID');
}
*/
public function getKeys()
{
return $this->keys;
@ -123,63 +117,74 @@ abstract class Message
{
return "Variable: $key=$value";
}
/*
// Obsolete - integrated into single method that calls for performance
protected function setSanitizedKey($key, $value)
{
$key = strtolower((string) $key);
$_string_key = array('actionid', 'descr');
if (array_search($key, $_string_key) !== false) {
$this->keys[$key] = (string) $this->sanitizeInput($value, 'string');
} else {
$this->keys[$key] = $this->sanitizeInput($value);
// Handle JSON here rather than in getVariable as have already broken data into array.
// Force preference here rather than test later as is faster.
$key = strtolower($key);
switch ($key) {
case 'json':
$this->keys['json'] = (string) $value;
break;
case 'response':
case 'actionid':
case 'desc':
$this->keys[$key] = (string) $value;
break;
case 'listitems';
$this->keys[$key] = $this->sanitizeInput($value,'numeric');
break;
default:
$this->keys[$key] = $this->sanitizeInput($value);
break;
}
}
*/
protected function sanitizeInput($value, $prefered_type = '')
{
if ($prefered_type == '') {
if (!isset($value) || $value === null || strlen($value) == 0) {
return null;
} elseif (is_numeric($value)) {
if ($prefered_type === '') {
// Find numeric first as this is coersion - is_string will always match!
if (is_numeric($value)) {
$prefered_type = 'numeric';
} elseif (is_string($value)) {
$prefered_type = 'string';
} else {
$prefered_type = 'string';
}
}
//if ($prefered_type !== '') {
switch ($prefered_type) {
case 'string':
if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) {
return (boolean) $value;
} elseif (filter_var($value, FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)) {
return (string) $value;
} elseif (filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE)) {
return (string) htmlspecialchars($value, ENT_QUOTES);
} elseif (empty($value)) {
// In rare cases, $value will be empty, and so treated as a string. Trap here
// to avoid performance hit on all message lines if testing earlier.
return;
} else {
throw new AMIException("Incoming String is not sanitary. Skipping: '" . $value . "'\n");
}
break;
case 'numeric':
//if (!isset($value) || $value === null || strlen($value) == 0) {
//return 0;
//}
if (filter_var($value, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL)) {
return intval($value, 0);
} elseif (filter_var($value, FILTER_VALIDATE_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND | FILTER_FLAG_ALLOW_SCIENTIFIC)) {
return (float) $value;
} else {
return (double) $value;
}
default:
throw new AMIException("Don't know how to convert: '" . $value . "'\n");
}
}
if ($prefered_type !== '') {
switch ($prefered_type) {
case 'string':
if (!isset($value) || $value === null || strlen($value) == 0) {
return '';
}
if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) {
return (boolean) $value;
} elseif (filter_var($value, FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)) {
return (string) $value;
} elseif (filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE)) {
return (string) htmlspecialchars($value, ENT_QUOTES);
} else {
throw new AMIException("Incoming String is not sanitary. Skipping: '" . $value . "'\n");
}
break;
case 'numeric':
if (!isset($value) || $value === null || strlen($value) == 0) {
return 0;
}
if (filter_var($value, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL)) {
return intval($value, 0);
} elseif (filter_var($value, FILTER_VALIDATE_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND | FILTER_FLAG_ALLOW_SCIENTIFIC)) {
return (float) $value;
} else {
return (double) $value;
}
default:
throw new AMIException("Don't know how to convert: '" . $value . "'\n");
break;
}
break;
}
//}
}
protected function finishMessage($message)
@ -229,6 +234,42 @@ abstract class Message
abstract class IncomingMessage extends Message
{
public function __construct($rawContent)
{
parent::__construct();
$this->rawContent = $rawContent;
$lines = explode(Message::EOL, $rawContent);
foreach ($lines as $line) {
$content = explode(':', $line);
$key = strtolower(array_shift($content));
// May now have an empty array, or an array with just ' ', both of which
// are rare and will be turned into an empty string below.
// Do not test for here, as most times will not be empty, and testing here
// would mean a performance hit given the number of lines handled
// Performance - integrate method here as is only called from here!
//$this->setSanitizedKey($name, trim(implode(':', $content)));
$value = trim(implode(':', $content));
// Handle JSON here rather than in old getVariable as have already broken data into array.
// Force preference here rather than test later as is faster.
switch ($key) {
case 'json':
$this->keys['json'] = (string) $value;
break;
case 'response':
case 'actionid':
case 'desc':
$this->keys[$key] = (string) $value;
break;
case 'listitems';
$this->keys[$key] = $this->sanitizeInput($value,'numeric');
break;
default:
$this->keys[$key] = $this->sanitizeInput($value);
break;
}
}
}
protected $rawContent;
@ -253,24 +294,6 @@ abstract class IncomingMessage extends Message
$ret[] = 'rawContent';
return $ret;
}
public function __construct($rawContent)
{
parent::__construct();
$this->rawContent = $rawContent;
$lines = explode(Message::EOL, $rawContent);
foreach ($lines as $line) {
$content = explode(':', $line);
$name = strtolower(trim($content[0]));
unset($content[0]);
$value = isset($content[1]) ? trim(implode(':', $content)) : '';
try {
$this->setSanitizedKey($name, $value);
} catch (AMIException $e) {
throw new AMIException("Error: '" . $e . "'\n Dump RawContent:\n" . $this->rawContent . "\n");
}
}
}
}
// namespace FreePBX\modules\Sccp_manager\aminterface\Message;
@ -335,8 +358,8 @@ class ExtensionStateListAction extends ActionMessage
public function __construct()
{
parent::__construct('ExtensionStateList');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
//$this->setKey('Segment', 'general');
//$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("ExtensionStateList");
}
}
@ -354,8 +377,8 @@ class SCCPShowSoftkeySetsAction extends ActionMessage
public function __construct()
{
parent::__construct('SCCPShowSoftkeySets');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
//$this->setKey('Segment', 'general');
//$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowSoftkeySets");
}
}
@ -366,8 +389,8 @@ class SCCPShowDeviceAction extends ActionMessage
public function __construct($devicename)
{
parent::__construct('SCCPShowDevice');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
//$this->setKey('Segment', 'general');
//$this->setKey('ResultFormat', 'command');
$this->setKey('DeviceName', $devicename);
$this->setResponseHandler("SCCPShowDevice");
}
@ -379,8 +402,8 @@ class SCCPShowDevicesAction extends ActionMessage
public function __construct()
{
parent::__construct('SCCPShowDevices');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
//$this->setKey('Segment', 'general');
//$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowDevices");
}
}
@ -403,9 +426,9 @@ class SCCPDeviceRestartAction extends ActionMessage
{
parent::__construct('SCCPDeviceRestart');
$this->setResponseHandler("Generic");
if (empty($Type)) {
$Type = "restart";
}
//if (empty($Type)) {
//$Type = "restart";
//}
$this->setKey('DeviceName', $DeviceName);
if (in_array(strtolower($Type), array('restart', 'full', 'reset'))) {
$this->setKey('Type', $Type);

View file

@ -70,9 +70,11 @@ abstract class Response extends IncomingMessage
{
$this->setKey('ActionId', $actionId);
}
public function getVariable($_rawContent, $_fields = '')
/*
public function getVariable(string $_rawContent, array $_fields)
{
dbug($_rawContent);
dbug($_fields);
$lines = explode(Message::EOL, $_rawContent);
foreach ($_fields as $key => $value) {
foreach ($lines as $data) {
@ -83,9 +85,8 @@ abstract class Response extends IncomingMessage
}
}
}
}
class GenericResponse extends Response
{
*/
}
//****************************************************************************
@ -106,7 +107,6 @@ class Generic_Response extends Response
$this->_events['ClosingEvent'] = new ResponseComplete_Event($rawContent);
$this->_completed = true;
$this->eventListIsCompleted = true;
}
}
@ -119,6 +119,7 @@ class Command_Response extends Generic_Response
private $_temptable;
public function __construct($rawContent)
{
//dbug($rawContent);
$this->_temptable = array();
parent::__construct($rawContent);
$lines = explode(Message::EOL, $rawContent);
@ -157,14 +158,15 @@ class SCCPJSON_Response extends Generic_Response
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->getVariable($rawContent, array("DataType" => "DataType:", "JSONRAW" => "JSON:"));
if (null !== $this->getKey('JSONRAW')) {
$this->setKey('Response', 'Success');
}
//dbug($rawContent);
//$this->getVariable($rawContent, array("DataType" => "DataType:", "JSONRAW" => "JSON:"));
//if (null !== $this->getKey('JSON')) {
//$this->setKey('Response', 'Success');
//}
}
public function getResult()
{
if (($json = json_decode($this->getKey('JSON'), true)) != false) {
if ($json = json_decode($this->getKey('JSON'), true)) {
return $json;
}
}
@ -250,32 +252,47 @@ class SCCPGeneric_Response extends Response
protected function ConvertTableData( $_tablename, array $_fkey, array $_fields)
{
/* except for softkeysets, $_fkey is a single element array so the Returned
array is a normal array. For softkey sets, need to return an associative
array with a second level.
*/
$result = array();
$_rawtable = $this->Table2Array($_tablename);
// Check that there is actually data to be converted
if (empty($_rawtable)) { return $result;}
foreach ($_rawtable as $_row) {
$all_key_ok = true;
// No need to test if $_fkey is array as array required
foreach ($_fkey as $_fid) {
if (empty($_row[$_fid])) {
$all_key_ok = false;
} else {
$set_name[$_fid] = $_row[$_fid];
}
}
$Data = &$result;
if ($all_key_ok) {
foreach ($set_name as $value_id) {
$Data = &$Data[$value_id];
}
// Label converter in case labels and keys are different
foreach ($_fields as $value_key => $value_id) {
$Data[$value_id] = $_row[$value_key];
}
if (empty($_rawtable)) {
return $result;
}
// Now check that fkey fields exist in the $_rawtable. If exists in
// the first element, Assume that it exists in all elements.
foreach ($_fkey as $_fid) {
if (!isset($_rawtable[0][$_fid])) {
return $result;
}
}
// could also use tablename here
$complexArray = true;
if (count($_fkey) === 1) {
$complexArray = false;
}
foreach ($_rawtable as $_rowArr) {
// $_row is a table element
$outputArr = array();
foreach ($_fields as $value_key => $value_id) {
$outputArr[$value_id] = $_rowArr[$value_key];
}
if ($complexArray) {
// We are returning softkey sets. Only looking for formatted value
$result[$_rowArr[$_fkey[0]]]['softkeys'] = $_rowArr[$_fkey[0]];
if (isset($result[$_rowArr[$_fkey[0]]][$_rowArr[$_fkey[1]]])) {
$result[$_rowArr[$_fkey[0]]][$_rowArr[$_fkey[1]]] .= "{$outputArr['label']}<br>";
} else {
$result[$_rowArr[$_fkey[0]]][$_rowArr[$_fkey[1]]] = "{$outputArr['label']}<br>";
}
} else {
$result[$_rowArr[$_fkey[0]]] = $outputArr;
}
}
//dbug($result);
return $result;
}
@ -375,7 +392,6 @@ class SCCPShowDevice_Response extends SCCPGeneric_Response
{
// This object has a list of events _events, and a list of tables _tables.
$result = array();
foreach ($this->_events as $trow) {
$result = array_merge($result, $trow->getKeys());
}

View file

@ -59,8 +59,7 @@ class aminterface
'pass' => '',
'port' => '5038',
'tsoket' => 'tcp://',
'timeout' => 30,
'enabled' => true
'timeout' => 30
);
$this->_eventListeners = array();
$this->_incomingMsgObjectList = array();
@ -76,33 +75,14 @@ class aminterface
}
}
}
if ($this->_config['enabled']) {
$this->load_subspace();
}
if ($this->_config['enabled']) {
// Ami is not hard disabled in __construct line 63.
if ($this->open()) {
// Can open a connection. Now check compatibility with chan-sccp.
// will return true if compatible.
if (!$this->get_compatible_sccp(true)[1]) {
// Close the open socket as will not use
$this->close();
}
}
}
$this->load_subspace();
$this->open();
}
public function info()
{
$Ver = '13.0.4';
if ($this->_config['enabled']){
return array('Version' => $Ver,
'about' => 'AMI data ver: ' . $Ver, 'test' => get_declared_classes());
} else {
return array('Version' => $Ver,
'about' => 'Disabled AMI ver: ' . $Ver);
}
$Ver = '16.0.0.1';
return array('Version' => $Ver, 'about' => 'AMI data ver: ' . $Ver);
}
/*
@ -161,7 +141,7 @@ class aminterface
$messageToSend = $message->serialize();
$length = strlen($messageToSend);
$this->_DumpMessage = '';
$this->_lastActionId = $message->getActionID();
$this->_lastActionId = $message->getKey('ActionID');
$this->_lastRequestedResponseHandler = $message->getResponseHandler();
$this->_lastActionClass = $message;
$this->_incomingRawMessage[$this->_lastActionId] = '';
@ -301,7 +281,7 @@ class aminterface
}
}
$response = new $responseClass($message);
$actionId = $response->getActionID();
$actionId = $response->getKey('ActionID');
if ($actionId === null) {
$response->setActionId($this->_lastActionId);
}
@ -368,7 +348,8 @@ class aminterface
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
foreach ($value as $key2 => $value2) {
$result[$key.'@'.$key2] = $key.'@'.$key2;
//$result[$key.'@'.$key2] = $key.'@'.$key2;
$result[$key.'@'.$key2] = ['key' => $key.'@'.$key2, 'exten' => $key, 'label' => $key.'@'.$key2];
}
}
}
@ -380,10 +361,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
$result[$key] = $key;
}
$result = $this->send($_action)->getResult();
}
return $result;
}
@ -486,7 +464,7 @@ class aminterface
{
// Initialise array with default values to eliminate testing later
$result = array();
$cmd_res = array();
//$cmd_res = array();
$cmd_res = ['sccp' => ['message' => 'legacy value', 'realm' => '', 'status' => 'ERROR']];
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('realtime mysql status');
@ -509,16 +487,4 @@ class aminterface
}
return $cmd_res;
}
public function get_compatible_sccp($revNumComp=false) {
// only called with args from installer to get revision and compatibility
$res = $this->getSCCPVersion();
if ($res['RevisionNum'] < 11063) {
$this->useAmiInterface = false;
}
if ($revNumComp) {
return array($res['vCode'], true);
}
return $res['vCode'];
}
}

View file

@ -22,7 +22,7 @@ class dbinterface
public function info()
{
$Ver = '14.0.0.1'; // This should be updated
$Ver = '16.0.0.1'; // This should be updated
return array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver);
}
@ -66,16 +66,19 @@ class dbinterface
$stmts->bindParam(':name', $data['name'],\PDO::PARAM_STR);
}
break;
case 'sccpHints':
$stmtU = $this->db->prepare('SELECT name, name, label FROM sccpline ORDER BY name');
break;
case 'phoneGrid':
switch ($data['type']) {
case "cisco-sip":
$stmts = $this->db->prepare("SELECT name, type, button, addon, description, 'not connected' AS status, '- -' AS address, 'N' AS new_hw
FROM sccpdeviceconfig WHERE type LIKE '%-sip' ORDER BY name");
FROM sccpdeviceconfig WHERE RIGHT(type,4) = '-sip' ORDER BY name");
break;
case "sccp": // Fall through to default intentionally
default:
$stmts = $this->db->prepare("SELECT name, type, button, addon, description, 'not connected' AS status, '- -' AS address, 'N' AS new_hw
FROM sccpdeviceconfig WHERE type not LIKE '%-sip' ORDER BY name");
FROM sccpdeviceconfig WHERE RIGHT(type,4) != '-sip' ORDER BY name");
break;
}
break;
@ -101,11 +104,11 @@ class dbinterface
} elseif (!empty($data['type'])) {
switch ($data['type']) {
case "cisco-sip":
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE TYPE LIKE '%-sip' ORDER BY name");
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE RIGHT(type,4) = '-sip' ORDER BY name");
break;
case "cisco": // Fall through to default intentionally
default:
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE TYPE not LIKE '%-sip' ORDER BY name");
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE RIGHT(type,4) != '-sip' ORDER BY name");
break;
}
} else { //no filter and no name provided - return all
@ -197,39 +200,35 @@ class dbinterface
* Get Sccp Device Model information
*/
function getDb_model_info($get = 'all', $format_list = 'all', $filter = array())
function getModelInfoFromDb($get = 'all', $format_list = 'all', $filter = array())
{
$sel_inf = '*, 0 as validate';
$sel_inf = "*, model";
if ($format_list === 'model') {
$sel_inf = "model, vendor, dns, buttons, '-;-' as validate";
$sel_inf = "model, vendor, dns, buttons";
}
switch ($get) {
case 'byciscoid':
if (!empty($filter)) {
if (!empty($filter['model'])) {
if (!strpos($filter['model'], 'loadInformation')) {
$filter['model'] = 'loadInformation' . $filter['model'];
}
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (loadinformationid = :model ) ORDER BY model");
$stmt->bindParam(':model', $filter['model'], \PDO::PARAM_STR);
} else {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
if (isset($filter['model'])) {
if (!strpos($filter['model'], 'loadInformation')) {
$filter['model'] = 'loadInformation' . $filter['model'];
}
break;
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (loadinformationid = :model ) ORDER BY model");
$stmt->bindParam(':model', $filter['model'], \PDO::PARAM_STR);
} else {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
}
break;
case 'byid':
if (!empty($filter)) {
if (!empty($filter['model'])) {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE model = :model ORDER BY model");
$stmt->bindParam(':model', $filter['model'],\PDO::PARAM_STR);
} else {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
}
break;
if (isset($filter['model'])) {
$stmtU = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE model = :model ORDER BY model");
$stmtU->bindParam(':model', $filter['model'],\PDO::PARAM_STR);
} else {
$stmtU = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
}
$stmtU->execute();
return $stmtU->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
break;
case 'extension':
case 'expansion':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns = 0) and (enabled = 1) ORDER BY model");
break;
case 'enabled':
@ -238,11 +237,14 @@ class dbinterface
case 'phones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns != 0) and (enabled = 1) ORDER BY model");
break;
case 'disabled':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns != 0) and (enabled = 0) ORDER BY model");
break;
case 'ciscophones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND vendor NOT LIKE '%-sip' ORDER BY model");
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND RIGHT(vendor,4) != '-sip' ORDER BY model");
break;
case 'sipphones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND vendor LIKE '%-sip' ORDER BY model");
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND RIGHT(vendor,4) = '-sip' ORDER BY model");
break;
case 'all': // Fall through to default
default:
@ -253,7 +255,7 @@ class dbinterface
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
}
function write($table_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "")
function write(string $table_name, $save_value = array(), string $mode = 'update', $key_fld = "", $hwid = "")
{
// mode clear - Empty table before update
// mode update - update / replace record
@ -264,7 +266,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)) {
@ -281,36 +283,36 @@ class dbinterface
case 'sccpdevmodel': // Fall through to next intentionally
case 'sccpdevice': // Fall through to next intentionally
case 'sccpuser':
$sql_key = "";
$sql_var = "";
foreach ($save_value as $key_v => $data) {
if (!empty($sql_var)) {
$sql_var .= ', ';
}
if ($data === $this->val_null) {
$sql_var .= $key_v . '= NULL';
} else {
$sql_var .= $key_v . ' = \'' . $data . '\''; //quote data as normally is string
}
if ($key_v === $key_fld) {
$sql_key = $key_v . ' = \'' . $data . '\''; //quote data as normally is string
}
}
if (!empty($sql_var)) {
$sql_key = '';
$stmt = '';
$formattedSQL = array_reduce(
array_keys($save_value), // pass in the array_keys instead of the array here
function ($carry, $key) use ($save_value) { // ... then 'use' the actual array here
return "{$carry}{$key} = '{$save_value[$key]}', ";
},
);
if (isset($formattedSQL)) { // if array is empty returns null
$formattedSQL = rtrim($formattedSQL,', '); // Remove the trailing ',' and any spaces.
switch ($mode) {
case 'delete':
$stmt = $this->db->prepare("DELETE FROM {$table_name} WHERE {$sql_key}");
if (array_key_exists($key_fld, $save_value)) {
$sql_key = "{$key_fld} = '{$save_value[$key_fld]}'"; //quote data as normally is string
$stmt = $this->db->prepare("DELETE FROM {$table_name} WHERE {$sql_key}");
}
break;
case 'update':
$stmt = $this->db->prepare("UPDATE {$table_name} SET {$sql_var} WHERE {$sql_key}");
if (array_key_exists($key_fld, $save_value)) {
$sql_key = "{$key_fld} = '{$save_value[$key_fld]}'"; //quote data as normally is string
$stmt = $this->db->prepare("UPDATE {$table_name} SET {$formattedSQL} WHERE {$sql_key}");
}
break;
case 'replace':
$stmt = $this->db->prepare("REPLACE INTO {$table_name} SET {$sql_var}");
$stmt = $this->db->prepare("REPLACE INTO {$table_name} SET {$formattedSQL}");
break;
// no default mode - must be explicit.
}
}
$result = $stmt->execute();
$result = (!empty($stmt)) ? $stmt->execute() : false;
break;
case 'sccpbuttons':
switch ($mode) {
@ -362,7 +364,7 @@ class dbinterface
switch ($dataid) {
case "DeviceById":
// TODO: This needs to be rewritten
$stmt = $this->db->prepare("SELECT keyword,data FROM sip WHERE id = '${line}'");
$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) {
@ -433,9 +435,15 @@ class dbinterface
return $result;
}
public function getLineGroups($element, $id){
$sth = $this->db->prepare("SELECT {$element} FROM sccpline WHERE name='{$id}'");
$sth->execute();
return $sth->fetchAll()[$element];
}
public function getNamedGroup($callGroup) {
$sql = "SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}";
$sth = $this->db->prepare($sql);
//$sql = "SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}";
$sth = $this->db->prepare("SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}");
$result = array();
$tech = array();
try {

View file

@ -145,36 +145,37 @@ class extconfigs
'onstealable' => 'redial,newcall,barge,intrcpt,cfwdall,pickup,gpickup,dnd',
'holdconf' => 'resume,newcall,endcall,join',
'uriaction' => 'default');
// Cisco Language Code / Directory
//
private $cisco_language = array('ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia', 'codepage' => 'ISO8859-1'),
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria', 'codepage' => 'ISO8859-1'),
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic', 'codepage' => 'ISO8859-1'),
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark', 'codepage' => 'ISO8859-1'),
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany', 'codepage' => 'ISO8859-1'),
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece', 'codepage' => 'ISO8859-1'),
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States', 'codepage' => 'ISO8859-1'),
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom', 'codepage' => 'ISO8859-1'),
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States', 'codepage' => 'ISO8859-1'),
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain', 'codepage' => 'ISO8859-1'),
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia', 'codepage' => 'ISO8859-1'),
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland', 'codepage' => 'ISO8859-1'),
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada', 'codepage' => 'ISO8859-1'),
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France', 'codepage' => 'ISO8859-1'),
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel', 'codepage' => 'ISO8859-1'),
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia', 'codepage' => 'ISO8859-1'),
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary', 'codepage' => 'ISO8859-1'),
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy', 'codepage' => 'ISO8859-1'),
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan', 'codepage' => 'ISO8859-1'),
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic', 'codepage' => 'ISO8859-1'),
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania', 'codepage' => 'ISO8859-1'),
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia', 'codepage' => 'ISO8859-1'),
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands', 'codepage' => 'ISO8859-1'),
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway', 'codepage' => 'ISO8859-1'),
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland', 'codepage' => 'ISO8859-1'),
'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'),
// Cisco Language Code / Directory
private $cisco_language = array(
'ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia', 'codepage' => 'ISO-8859-6'),
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria', 'codepage' => 'CP1251'),
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic', 'codepage' => 'CP1254'),
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark', 'codepage' => 'ISO-8859-1'),
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany', 'codepage' => 'ISO-8859-1'),
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece', 'codepage' => 'ISO-8859-7'),
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States', 'codepage' => 'ISO-8859-1'),
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom', 'codepage' => 'ISO-8859-1'),
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States', 'codepage' => 'ISO-8859-1'),
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain', 'codepage' => 'ISO-8859-1'),
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia', 'codepage' => 'ISO-8859-1'),
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland', 'codepage' => 'ISO-8859-1'),
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada', 'codepage' => 'ISO-8859-1'),
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France', 'codepage' => 'ISO-8859-1'),
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel', 'codepage' => 'CP1255'),
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia', 'codepage' => 'CP1252'),
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary', 'codepage' => 'CP1252'),
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy', 'codepage' => 'ISO-8859-1'),
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan', 'codepage' => 'SHIFT_JIS'),
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic', 'codepage' => 'EUC-KR'),
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania', 'codepage' => 'CP1252'),
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia', 'codepage' => 'ISO-8859-1'),
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands', 'codepage' => 'ISO-8859-1'),
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway', 'codepage' => 'ISO-8859-1'),
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland', 'codepage' => 'ISO-8859-1'),
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil', 'codepage' => 'ISO-8859-1'),
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal', 'codepage' => 'ISO-8859-1'),
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania', 'codepage' => 'ISO-8859-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'),

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';
@ -174,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();
@ -187,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">
@ -218,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";
@ -250,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>';
}
@ -261,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++;
@ -316,11 +337,14 @@ class formcreate
<?php
}
function addElementIS($child, $fvalues, $sccp_defaults,$npref, $disabledButtons) {
if ($npref == 'sccp_hw_') {
$this->buttonDefLabel = 'site';
$this->buttonHelpLabel = 'device';
}
function addElementIS($child, $fvalues, $sccp_defaults,$npref, $disabledButtons, $defButton = '') {
if ($npref == 'sccp_hw_') {
$this->buttonDefLabel = 'site';
$this->buttonHelpLabel = 'device';
}
if ($defButton == 'site'){
$this->buttonDefLabel = 'site';
}
$res_n = (string)$child->name;
$res_id = $npref.$res_n;
$res_ext = str_replace($npref,'',$res_n);
@ -363,86 +387,96 @@ class formcreate
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 ~438
if ($sccp_defaults[$res_n]['data'] != $res_v) {
$usingSiteDefaults = false;
}
//-- Start include of defaults button --
echo "<div class='col-md-3'>";
// Output current value
echo $res_v;
?>
</div>
<div class="col-md-4">
<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 " class=sccp-edit :checked ";
} else {
// reverting to chan-sccp default values
echo " data-default={$sccp_defaults[$res_n]['systemdefault']} class=sccp-restore ";
}
?>
>
<label
<?php
echo "for=usedefault_{$res_id} >";
echo ($usingSysDefaults) ? "Customise" : "Use {$this->buttonDefLabel} defaults";
?>
</label>
</span>
if ((!empty($sccp_defaults[$res_n]['systemdefault'])) || ($defButton == 'site')) {
// There is a system default, or we are referencing site defaults, so add button to customise or reset
// the closing } is after the code to include the button at line ~427
//-- Start include of defaults button --
echo "<div class='col-md-3'>";
// Output current value
echo $res_v;
?>
</div>
<div class="col-md-4">
<span class="radioset">
<input type="checkbox"
<?php
echo " data-for={$res_id} data-type=radio id=usedefault_{$res_id} ";
if ($usingSysDefaults) {
$res_v = $sccp_defaults[$res_n]['systemdefault'];
// Setting a site specific value
echo " class=sccp-edit :checked ";
} else if ($usingSiteDefaults) {
$res_v = $sccp_defaults[$res_n]['data'];
// Setting a site specific value
echo " class=sccp-edit :checked ";
} else {
// reverting to chan-sccp or site default values
if ($defButton == 'site') {
echo " data-default={$sccp_defaults[$res_n]['data']} class=sccp-restore ";
} else {
echo " data-default={$sccp_defaults[$res_n]['systemdefault']} class=sccp-restore ";
}
}
?>
>
<label
<?php
echo "for=usedefault_{$res_id} >";
echo ($usingSysDefaults || $usingSiteDefaults) ? "Customise" : "Use {$this->buttonDefLabel} defaults";
?>
</label>
</span>
</div>
</div>
</div>
</div>
<!-- <div class="row" id="edit_<?php echo $res_id; ?>" style="display: none"> -->
<div class="row" id="edit_<?php echo $res_id; ?>" style="display: none">
<div class="form-group <?php echo $res_id; ?>">
<div class="col-md-3">
<i><?php echo "Choose new {$this->buttonHelpLabel} value for {$res_n}"; ?></i>
</div>
<!-- Finish include of defaults button -->
<!-- <div class="row" id="edit_<?php echo $res_id; ?>" style="display: none"> -->
<div class="row" id="edit_<?php echo $res_id; ?>" style="display: none">
<div class="form-group <?php echo $res_id; ?>">
<div class="col-md-3">
<i><?php echo "Choose new {$this->buttonHelpLabel} value for {$res_n}"; ?></i>
</div>
<!-- Finish include of defaults button -->
<?php
// Close the conditional include of the defaults button opened at line ~385
}
?>
<div class="col-md-9 radioset " data-hide="on">
<?php
$i = 0;
$opt_hide = '';
if ($usingSysDefaults) {
$res_v = $sccp_defaults[$res_n]['systemdefault'];
}
if (!empty($child->option_hide)) {
$opt_hide = ' class="sccp_button_hide" data-vhide="'.$child->option_hide.'" data-clhide="'.$child->option_hide['class'].'" ';
}
<?php
$opt_hide = (!empty($child->option_hide)) ? ' class="sccp_button_hide" data-vhide="'.$child->option_hide.'" data-clhide="'.$child->option_hide['class'].'" ' : '';
if (!empty($child->option_show)) {
if (empty($opt_hide)) {
$opt_hide =' class="sccp_button_hide" ';
}
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
}
if ($res_id == 'sccpdevice_daysdisplaynotactive') {
// This is a multi select button list for daysDisplayNotActive which is an
// exception - its values are in a csv list - 1,2,7 for example
$currentValue = array();
foreach (explode(',',$res_v) as $resValue) {
$currentValue[$resValue - 1] = $resValue;
}
}
$i = 0;
foreach ($child->xpath('button') as $value) {
$opt_disabled = '';
if (in_array($value, $disabledButtons )) {
$opt_disabled = 'disabled';
}
$val_check = strtolower((string)$value[@value]);
if ($val_check == strtolower($res_v)) {
$val_check = "checked";
$opt_disabled = (in_array($value, $disabledButtons )) ? 'disabled' : '';
$valToCheck = strtolower((string)$value[@value]);
// TODO: Matching empty values - is this required?
$val_check = (($valToCheck == strtolower($res_v)) || ($valToCheck == '' && $res_v == '' )) ? 'checked' : '';
$tmpName = $res_id;
if ($res_id == 'sccpdevice_daysdisplaynotactive') {
if (isset($currentValue[$i])) {
$val_check = (($valToCheck == strtolower($currentValue[$i])) || ($valToCheck == '' && $currentValue[$i] == '' )) ? 'checked' : '';
}
echo "<input type=checkbox name= {$res_id}_{$i} id={$res_id}_{$i} value='{$value[@value]}' {$val_check} {$opt_hide} {$opt_disabled}>";
} else {
if ($val_check == '' || $val_check == 'none' ) {
if (strtolower($res_v) == 'none' || $res_v == '' ) {
$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++;
}
@ -454,7 +488,6 @@ class formcreate
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
}
@ -513,7 +546,7 @@ class formcreate
$select_opt[$key]= $key;
}
}
break;
case 'SLM':
if (function_exists('music_list')) {
$moh_list = music_list();
@ -524,9 +557,55 @@ class formcreate
$select_opt= $moh_list;
break;
case 'SLD':
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
$select_opt = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
$select_opt= $day_format;
break;
case 'SLDT':
$select_opt = array(
'0x00' => 'Silence',
'0x21' => 'Inside Dial Tone',
'0x22' => 'Outside Dial Tone',
'0x23' => 'Line Busy Tone',
'0x24' => 'Alerting Tone',
'0x25' => 'Reorder Tone',
'0x26' => 'Recorder Warning Tone',
'0x27' => 'Recorder Detected Tone',
'0x28' => 'Reverting Tone',
'0x29' => 'Receiver OffHook Tone',
'0x2A' => 'Partial Dial Tone',
'0x2B' => 'No Such Number Tone',
'0x2C' => 'Busy Verification Tone',
'0x2D' => 'Call Waiting Tone',
'0x2E' => 'Confirmation Tone',
'0x2F' => 'Camp On Indication Tone',
'0x30' => 'Recall Dial Tone',
'0x31' => 'Zip Zip',
'0x32' => 'Zip',
'0x33' => 'Beep Bonk',
'0x34' => 'Music Tone',
'0x35' => 'Hold Tone',
'0x36' => 'Test Tone',
'0x37' => 'DT Monitor Warning Tone',
'0x40' => 'Add Call Waiting',
'0x41' => 'Priority Call Wait',
'0x42' => 'Recall Dial',
'0x43' => 'Barg In',
'0x44' => 'Distinct Alert',
'0x45' => 'Priority Alert',
'0x46' => 'Reminder Ring',
'0x47' => 'Precedence RingBank',
'0x48' => 'Pre-EmptionTone',
'0x67' => '2105 HZ',
'0x68' => '2600 HZ',
'0x69' => '440 HZ',
'0x6A' => '300 HZ',
'0x77' => 'MLPP Pala',
'0x78' => 'MLPP Ica',
'0x79' => 'MLPP Vca',
'0x7A' => 'MLPP Bpa',
'0x7B' => 'MLPP Bnea',
'0x7C' => 'MLPP Upa'
);
break;
case 'SLK':
$softKeyList = array();
@ -571,10 +650,13 @@ class formcreate
<?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
foreach ($select_opt as $key => $val) {
// TODO: Clean this up - its a bunch of fixes
if (is_array($val)) {
$opt_key = (isset($val['id'])) ? $val['id'] : $key;
$opt_val = (isset($val['val'])) ? $val['val'] : $val;
} else if (\FreePBX::Sccp_manager()->is_assoc($select_opt)){
$opt_key = (isset($val['softkeys'])) ? $val['softkeys'] : $key;
$opt_val = (isset($val['softkeys'])) ? $val['softkeys'] : $val;
} else if ($this->is_assoc($select_opt)){
// have associative array
$opt_key = $key;
$opt_val = $val;
@ -719,11 +801,11 @@ class formcreate
}
switch ($child['type']) {
case 'SDM':
$model_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('ciscophones', 'model');
$model_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('ciscophones', 'model');
$select_opt= $model_list;
break;
case 'SDMS':
$model_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('sipphones', 'model');
$model_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('sipphones', 'model');
$select_opt= $model_list;
break;
case 'SDML':
@ -741,7 +823,7 @@ class formcreate
$child->default = $fvalues['defaultLine'];
break;
case 'SDE':
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model');
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('extension', 'model');
$extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
foreach ($extension_list as &$data) {
$d_name = explode(';', $data['model']);

View file

@ -15,7 +15,7 @@ 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)
@ -126,9 +126,9 @@ class xmlinterface
} else {
$lang = $data_values['devlang'];
}
if (isset($lang_info[$lang])) {
$xnode->name = $lang_info[$lang]['locale'];
$xnode->langCode = $lang_info[$lang]['code'];
if (isset($this->langCodeArray[$lang])) {
$xnode->name = $lang;
$xnode->langCode = $this->langCodeArray[$lang];
} else {
$xnode->name = '';
$xnode->langCode = '';
@ -152,11 +152,11 @@ 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
}
}
function create_SEP_XML($store_path, $data_values, $dev_config, $dev_id, $lang_info = array())
function create_SEP_XML($store_path, $data_values, $dev_config, $dev_id)
{
// 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
@ -251,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':
@ -403,7 +389,7 @@ class xmlinterface
}
}
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save
$this->saveXml($xml_work, $xml_name); // Save
return time();
}
@ -418,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) {
@ -461,7 +438,7 @@ class xmlinterface
return $res;
}
function create_SEP_SIP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
function create_SEP_SIP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '')
{
$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',
@ -728,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

@ -15,12 +15,8 @@ trait ajaxHelper {
case 'save_ruser':
case 'save_dialplan_template':
case 'delete_hardware':
case 'getPhoneGrid':
case 'getExtensionGrid':
case 'getDeviceModel':
case 'getUserGrid':
case 'getSoftKey':
case 'getDialTemplate':
case 'get_ext_files':
case 'create_hw_tftp':
case 'reset_dev':
@ -52,20 +48,14 @@ trait ajaxHelper {
switch ($cmd_id) {
case 'savesettings':
// Consolidate this into a separate method to improve legibility
$this->handleSubmit($request);
// TODO: Need to be more specific on reload and only reload if critical settings changed.
$res = $this->aminterface->core_sccp_reload();
return array('status' => true, 'message' => 'Data saved', 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => '');
return $this->saveServerSettings($request);
break;
case 'save_sip_device':
case 'save_device':
return $this->saveSccpDevice($request);
break;
case 'save_ruser':
//$res = $request;
$res = $this->handleRoamingUsers($request);
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'general');
return $this->handleRoamingUsers($request);
break;
case 'save_dialplan_template':
/* !TODO!: -TODO-: dialplan templates should be removed (only required for very old devices (like ATA) */
@ -82,7 +72,7 @@ trait ajaxHelper {
if (!empty($request['dialplan'])) {
$get_file = $request['dialplan'];
$res = $this->deleteDialPlan($get_file);
return array('status' => true, 'message' => 'Dial Template has been deleted ! ', 'table_reload' => true);
return array('status' => true, 'message' => 'Dial Template has been deleted !', 'table_reload' => true);
} else {
return array('status' => false, 'message' => print_r($res));
}
@ -98,7 +88,7 @@ trait ajaxHelper {
$this->aminterface->sccpDeviceReset($idv, 'reset');
}
}
return array('status' => true, 'table_reload' => true, 'message' => 'Hardware device has been deleted! ');
return array('status' => true, 'table_reload' => true, 'message' => 'Hardware device has been deleted!');
}
break;
case 'create_hw_tftp':
@ -119,7 +109,7 @@ trait ajaxHelper {
foreach ($models as $data) {
$ver_id = $this->createSccpDeviceXML($data['name']);
if ($ver_id == -1) {
return array('status' => false, 'message' => 'Error Create Configuration Divice :' . $data['name']);
return array('status' => false, 'message' => 'Error Creating Device Configuration: ' . $data['name']);
}
};
@ -217,7 +207,7 @@ trait ajaxHelper {
$this->dbinterface->write('sccpdevmodel', array('model' => $idv, 'enabled' => $model_set), 'update', "model");
}
}
return array('status' => true, 'table_reload' => true);
return array('status' => true, 'reload' => true , 'message' => ($model_set) ? "Devices Enabled" : "Devices Disabled");
break;
case 'model_delete':
if (!empty($request['model'])) {
@ -227,15 +217,15 @@ trait ajaxHelper {
break;
case 'getDeviceModel':
switch ($request['type']) {
case 'all':
case 'extension':
case 'disabled':
case 'expansion':
case 'enabled':
$devices = $this->getSccpModelInformation($request['type'], $validate = true);
break;
}
if (empty($devices)) {
return array();
}
//if (empty($devices)) {
//return array();
//}
return $devices;
break;
@ -243,7 +233,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);
}
@ -257,121 +247,14 @@ 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);
return array('status' => true, 'table_reload' => true);
$msg = $this->aminterface->core_sccp_reload();
return array('status' => true, 'reload' => true, 'message' => $msg['Response'] .' - Softkey sets updated');
}
break;
case 'getSoftKey':
$result = array();
$i = 0;
$keyl = 'default';
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
$result[$i]['softkeys'] = $keyl;
if ($keyl == 'default') {
foreach ($this->extconfigs->getExtConfig('keyset') as $key => $value) {
$result[$i][$key] = str_replace(',', '<br>', $value);
}
} else {
foreach ($this->getMyConfig('softkeyset', $keyl) as $key => $value) {
$result[$i][$key] = str_replace(',', '<br>', $value);
}
}
$i++;
}
return $result;
break;
case 'getExtensionGrid':
$lineList = $this->dbinterface->getSccpDeviceTableData($request['type']);
if (empty($lineList)) {
return array();
}
$activeDevices = $this->aminterface->sccp_get_active_device();
$uniqueLineList = array();
foreach ($lineList as $key => &$lineArr) {
if (array_key_exists($lineArr['mac'], $activeDevices)) {
$lineArr['line_status'] = "{$activeDevices[$lineArr['mac']]['status']} | {$activeDevices[$lineArr['mac']]['act']}";
}
if (array_key_exists($lineArr['name'], $uniqueLineList)) {
$lineList[$uniqueLineList[$lineArr['name']]]['mac'] .= '<br>' . $lineArr['mac'];
$lineList[$uniqueLineList[$lineArr['name']]]['line_status'] .= '<br>' . $lineArr['line_status'];
unset($lineList[$key]); // Drop this array as no longer used
continue;
}
$uniqueLineList[$lineArr['name']] = $key;
}
unset($lineArr, $uniqueLineList); // unset reference and temp vars.
return array_values($lineList); // Reindex array and return
break;
case 'getPhoneGrid':
$dbDevices = array();
// Find all devices defined in the database.
$dbDevices = $this->dbinterface->getSccpDeviceTableData('phoneGrid', array('type' => $request['type']));
// Return if only interested in SIP devices
if ($request['type'] == 'cisco-sip') {
return $dbDevices; //this may be empty
}
// Find all devices currently connected
$activeDevices = $this->aminterface->sccp_get_active_device();
foreach ($dbDevices as &$dev_id) {
if (!empty($activeDevices[$dev_id['name']])) {
// Device is in db and is connected
$dev_id['description'] = $activeDevices[$dev_id['name']]['descr'];
$dev_id['status'] = $activeDevices[$dev_id['name']]['status'];
$dev_id['address'] = $activeDevices[$dev_id['name']]['address'];
$dev_id['new_hw'] = 'N';
// No further action required on this active device
unset($activeDevices[$dev_id['name']]);
}
}
unset($dev_id); // unset reference.
if (!empty($activeDevices)) {
// Have a device that is connected but is not currently in the database
// This device must have connected via hotline or config in sccp.conf.
// Pass parameters to addDevice so that can be added to db.
foreach ($activeDevices as $dev_ids) {
$id_name = $dev_ids['name'];
$dev_data = $this->aminterface->sccp_getdevice_info($id_name);
if (!empty($dev_data['SCCP_Vendor']['model_id'])) {
$dev_addon = $dev_data['SCCP_Vendor']['model_addon'];
if (empty($dev_addon)) {
$dev_addon = null;
}
$dev_schema = $this->getSccpModelInformation('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id']));
if (empty($dev_schema)) {
$dev_schema[0]['model'] = "ERROR in Model Schema";
}
$dbDevices[] = array(
'name' => $id_name,
'mac' => $id_name,
'button' => '---',
'type' => $dev_schema[0]['model'],
'new_hw' => 'Y',
'description' => '*NEW* ' . $dev_ids['descr'],
'status' => '*NEW* ' . $dev_ids['status'],
'address' => $dev_ids['address'],
'addon' => $dev_addon
);
}
}
}
return $dbDevices;
break;
case 'getDialTemplate':
// ------------------------------- Old device support - In the development---
$result = $this->getDialPlanList();
if (empty($result)) {
$result = array();
}
return $result;
break;
case 'backupsettings':
// ------------------------------- Old device support - In the development---
$filename = $this->createSccpBackup();
@ -395,7 +278,8 @@ trait ajaxHelper {
}
}
function handleSubmit($request, $validateonly = false) {
function saveServerSettings($request, $validateonly = false) {
dbug($request);
$hdr_prefix = 'sccp_';
$hdr_arprefix = 'sccp-ar_';
$save_settings = array();
@ -440,38 +324,31 @@ 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
$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.
@ -489,57 +366,56 @@ trait ajaxHelper {
foreach (array('sccpdevice', 'sccpline') as $tableName) {
$key = (str_replace("{$tableName}_", '', $key, $count_mods));
if ($count_mods) {
$searchArr = ['daysdisplaynotactive_0', 'daysdisplaynotactive_1', 'daysdisplaynotactive_2', 'daysdisplaynotactive_3', 'daysdisplaynotactive_4', 'daysdisplaynotactive_5', 'daysdisplaynotactive_6'];
if (in_array($key, $searchArr, true)) {
$key = 'daysdisplaynotactive';
$value = (isset($save_settings[$key])) ? $save_settings[$key]['data'] . ',' . $value : $value;
}
// Have default to be saved to db table default
$tableName_def = "{$tableName}_def";
if ((array_key_exists($key, ${$tableName_def})) && (${$tableName_def}[$key]['data'] == $value)) {
if ((array_key_exists($key, {$$tableName_def})) && ({$$tableName_def}[$key]['data'] == $value)) {
// Value unchanged so ignore
} else {
$dbSaveArray[$key] = array('table' => $tableName, 'field' => $key, 'Default' => $value);
// Save these settings to sccpsettings as backup - Doctrine overwrites defaults in installer.
$save_settings[$key]= ['keyword' => $key, 'seq' => $this->sccpvalues[$key]['seq'], 'type' => $this->sccpvalues[$key]['type'], 'data' => $value, 'systemdefault' => ''];
}
// If have matched on device, cannot match on line
continue 2;
}
}
}
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
$save_settings = array_merge($save_settings, $extSettings);
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
//$this->saveSccpSettings($save_settings);
$this->dbinterface->write('sccpsettings', $save_settings, 'update');
$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"]);
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
$this->createDefaultSccpXml();
}
public function getMyConfig($var = null, $id = "noid") {
// TODO: this function has little purpose - need to integrate into AjaxHelper
switch ($var) {
case "softkeyset":
$final = array();
$i = 0;
if ($id == "noid") {
foreach ($this->sccp_conf_init as $key => $value) {
if ($this->sccp_conf_init[$key]['type'] == 'softkeyset') {
$final[$i] = $value;
$i++;
}
}
} else {
if (!empty($this->sccp_conf_init[$id])) {
if ($this->sccp_conf_init[$id]['type'] == 'softkeyset') {
$final = $this->sccp_conf_init[$id];
}
}
}
break;
}
return $final;
// TODO: Need to be more specific on reload and only reload if critical settings changed.
$res = $this->aminterface->core_sccp_reload();
return array('status' => true, 'message' => "Data saved - {$res['Response']}", 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => '');
}
public function getFilesFromProvisioner($request) {
@ -639,6 +515,7 @@ trait ajaxHelper {
}
function saveSccpDevice($get_settings, $validateonly = false) {
dbug($get_settings);
$hdr_prefix = 'sccp_hw_';
$hdr_arprefix = 'sccp_hw-ar_';
$hdr_vendPrefix = 'vendorconfig_';
@ -661,7 +538,7 @@ trait ajaxHelper {
}
}
foreach ($db_field as $key) {
$value = "";
$value = '';
switch ($key) {
case 'name':
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
@ -676,77 +553,100 @@ trait ajaxHelper {
$name_dev = $value;
}
break;
case 'daysdisplaynotactive' :
$searchArr = ['daysdisplaynotactive_0', 'daysdisplaynotactive_1', 'daysdisplaynotactive_2', 'daysdisplaynotactive_3', 'daysdisplaynotactive_4', 'daysdisplaynotactive_5', 'daysdisplaynotactive_6'];
foreach ($searchArr as $settingsVal) {
$value .= (isset($get_settings["sccpdevice_{$settingsVal}"])) ? $get_settings["sccpdevice_{$settingsVal}"] . ',' : '';
}
$value = rtrim($value,',');
break;
case 'phonecodepage':
// TODO: May be other exceptions so use switch. Historically this is the only one handled
// 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
$nonUtf8Phones = array( '7902', '7905', '7912', '7935', '7940', '7960');
if (!empty($get_settings["{$hdr_prefix}devlang"])) {
switch ($get_settings["{$hdr_prefix}devlang"]) {
case 'Arabic_Saudi_Arabia':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'ISO-8859-6' : 'utf-8';
break;
case 'Greek_Greece':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'ISO-8859-7' : 'utf-8';
break;
case 'Bulgarian_Bulgaria':
case 'Russian_Russian_Federation':
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'CP1251' : 'utf-8';
break;
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'CP1251' : 'utf-8';
break;
case 'Slovenian_Slovenia':
case 'Serbian_Republic_of_Montenegro':
case 'Serbian_Republic_of_Serbia':
case 'Croatian_Croatia':
case 'Hungarian_Hungary':
case 'Lithuanian_Lithuania':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'CP1252' : 'utf-8';
break;
case 'Czech_Czech_Republic':
case 'Slovak_Slovakia':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'CP1254' : 'utf-8';
break;
case 'Hebrew_Israel':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'CP1255' : 'utf-8';
break;
case 'Thai_Thailand':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'TIS-620' : 'utf-8';
break;
case 'Turkish_Turkey':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'ISO-8859-9' : 'utf-8';
break;
case 'Chinese_China':
case 'Chinese_Taiwan':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'GB2312' : 'utf-8';
break;
case 'Japanese_Japan':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'SHIFT_JIS' : 'utf-8';
break;
case 'Korean_Korea_Republic':
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, true)) ? 'EUC-KR' : 'utf-8';
break;
default:
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'ISO8859-1' : 'utf-8';
$value = (in_array($get_settings['sccp_hw_type'], $nonUtf8Phones, 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';
$this->convertArrayToCsv($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}"];
//dbug($key . " " . $value);
}
}
if (!empty($value)) {
$save_settings[$key] = $value;
@ -780,7 +680,5 @@ trait ajaxHelper {
$search = '?display=sccp_phone';
return array('status' => true, 'message' => $msg, 'reload' => true, 'toastFlag' => $toastFlag, 'search' => $search, 'hash' => $hash);
}
}
?>

View file

@ -5,41 +5,127 @@ namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait bmoFunctions {
//Need to reload freePBX for modifications below to work
/*
//want to catch extensions
public static function myConfigPageInits() {
return array("extensions");
return array('sccpsettings', 'sccp_phone','sccp_adv');
}
*/
public function doConfigPageInit($page) {
if ($page == "extensions") {
switch ($page) {
case 'sccpsettings':
break;
case 'sccp_phone':
// Get activeDevices once and pass to functions.
$activeDevices = $this->aminterface->sccp_get_active_device();
$this->extensionData = json_encode($this->getExtensionGrid('extGrid', $activeDevices));
$this->sccpPhoneData = json_encode($this->getPhoneGrid('sccp', $activeDevices));
$this->sipPhoneData = json_encode($this->getPhoneGrid('cisco-sip'));
break;
case 'sccp_adv':
$this->dialTemplateData = json_encode($this->getDialTemplate());
$this->softKeyData = json_encode(array_values($this->aminterface->sccp_list_keysets()));
$this->deviceModelData = json_encode($this->ajaxHandler($_REQUEST = array('command'=>'getDeviceModel', 'type'=>'enabled')));
break;
default:
break;
}
$this->doGeneralPost();
}
// Try to change extensions which is part of core
/*
public static function myGuiHooks() {
return array('core');
}
*/
/*
public function doGuiHook(&$cc) {
if ($_REQUEST['display'] == "extensions" ) {
if ($_REQUEST['tech_hardware'] == 'sccp_custom') {
function getPhoneGrid(string $type, $activeDevices =array()){
this is the add extensions form
On submit returns to extensions page. Users prefer that it returns
To Sccp Phone.
Below adds redirect URL, but it is not followed
$cc->setRedirectURL("config.php?display=sccp_phone");
so force redirect at end of addDevice in SccpClass
$dbDevices = array();
// Find all devices defined in the database.
$dbDevices = $this->dbinterface->getSccpDeviceTableData('phoneGrid', array('type' => $type));
// Return if only interested in SIP devices
if ($type == 'cisco-sip') {
return $dbDevices; //this may be empty
}
//$testData = $this->aminterface->sccp_getdevice_info('SEP0019305DC7F4');
//dbug($testData);
foreach ($dbDevices as &$dev_id) {
if (!empty($activeDevices[$dev_id['name']])) {
// Device is in db and is connected
$dev_id['description'] = $activeDevices[$dev_id['name']]['descr'];
$dev_id['status'] = $activeDevices[$dev_id['name']]['status'];
$dev_id['address'] = $activeDevices[$dev_id['name']]['address'];
$dev_id['new_hw'] = 'N';
// No further action required on this active device
unset($activeDevices[$dev_id['name']]);
}
}
unset($dev_id); // unset reference.
if (!empty($activeDevices)) {
// Have a device that is connected but is not currently in the database
// This device must have connected via hotline or config in sccp.conf.
// Pass parameters to addDevice so that can be added to db.
// TODO: Should use LoadInformationId as a key as this is unique $dev_data['SCCP_Vendor']['model_id'] (numeric)
foreach ($activeDevices as $dev_ids) {
$id_name = $dev_ids['name'];
$dev_data = $this->aminterface->sccp_getdevice_info($id_name);
if (!empty($dev_data['SCCP_Vendor']['model_id'])) {
$dev_addon = $dev_data['SCCP_Vendor']['model_addon'];
if (empty($dev_addon)) {
$dev_addon = null;
}
$dev_schema = $this->getSccpModelInformation('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id']));
if (empty($dev_schema)) {
$dev_schema[0]['model'] = "Model {$dev_data['SCCP_Vendor']['model_id']} not found in model Database";
} else if ( $dev_schema[0]['enabled'] == 0) {
// Need to enable this model in phone types
$this->dbinterface->write('sccpdevmodel', array('model'=> $dev_data['SCCP_Vendor']['model_id'], 'enabled' => 1), 'update' , 'model');
}
$dbDevices[] = array(
'name' => $id_name,
'mac' => $id_name,
'button' => '---',
'type' => $dev_schema[0]['model'],
'new_hw' => 'Y',
'description' => '*NEW* ' . $dev_ids['descr'],
'status' => '*NEW* ' . $dev_ids['status'],
'address' => $dev_ids['address'],
'addon' => $dev_addon
);
}
}
}
return $dbDevices;
}
*/
function getExtensionGrid(string $type, $activeDevices = array()) {
$lineList = $this->dbinterface->getSccpDeviceTableData($type);
if (empty($lineList)) {
return array();
}
//$activeDevices = $this->aminterface->sccp_get_active_device();
$uniqueLineList = array();
foreach ($lineList as $key => &$lineArr) {
if (array_key_exists($lineArr['mac'], $activeDevices)) {
$lineArr['line_status'] = "{$activeDevices[$lineArr['mac']]['status']} | {$activeDevices[$lineArr['mac']]['act']}";
}
if (array_key_exists($lineArr['name'], $uniqueLineList)) {
$lineList[$uniqueLineList[$lineArr['name']]]['mac'] .= '<br>' . $lineArr['mac'];
$lineList[$uniqueLineList[$lineArr['name']]]['line_status'] .= '<br>' . $lineArr['line_status'];
unset($lineList[$key]); // Drop this array as no longer used
continue;
}
$uniqueLineList[$lineArr['name']] = $key;
}
unset($lineArr, $uniqueLineList); // unset reference and temp vars.
return array_values($lineList); // Reindex array and return
}
function getDialTemplate() {
// ------------------------------- Old device support - In the development---
$result = array();
$result = $this->getDialPlanList();
return $result;
}
/* unused but FPBX API requires it */
public function install() {
@ -140,7 +226,7 @@ trait bmoFunctions {
public function getRightNav($request) {
global $amp_conf;
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
return load_view($amp_conf['AMPWEBROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('request' => $request));
return load_view($amp_conf['AMPWEBROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('data' => $this->sccpPhoneData));
}
}

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':
@ -90,17 +158,10 @@ trait helperfunctions {
return $def_val;
}
private function getTableEnums($table, $trim_underscore = true) {
private function getTableEnums($table) {
$enumFields = array();
$sccpTableDesc = $this->dbinterface->getSccpDeviceTableData("get_columns_{$table}");
foreach ($sccpTableDesc as $key => $data) {
// function has 2 roles: return actual table keys (trim_underscore = false)
// return sanitised keys to add defaults (trim_underscore = true)
if ($trim_underscore) {
// Remove any leading (or trailing but should be none) underscore
// These are only used to hide fields from chan-sccp for compatibility
$key = trim($key,'_');
}
$typeArray = explode('(', $data['Type']);
if ($typeArray[0] == 'enum') {
$enumOptions = explode(',', trim($typeArray[1],')'));
@ -207,6 +268,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');
@ -226,7 +301,7 @@ trait helperfunctions {
// write a sentinel to a tftp subdirectory to see if mapping is working
if (is_dir($testFtpDir) && is_writable($testFtpDir)) {
$tempFile = "${testFtpDir}/{$remoteFileName}";
$tempFile = "{$testFtpDir}/{$remoteFileName}";
file_put_contents($tempFile, $remoteFileContent);
// try to pull the written file through tftp.
// this way we can determine if mapping is active and using sccp_manager maps
@ -265,27 +340,27 @@ trait helperfunctions {
return true;
}
public function getChanSccpSettings() {
// This is a utility function for debug only, and is not used by core code
foreach (array('general','line', 'device') as $section) {
$sysConfig = $this->aminterface->getSCCPConfigMetaData($section);
dbug($sysConfig);
}
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 general settings, and initiate with allow/disallow and permit/deny keys in correct order
$this->sccp_conf_init['general'] = 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';
$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 +382,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 +401,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 +411,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,7 +420,7 @@ trait helperfunctions {
"#include sccp_custom.conf"
);
}
$cnf_wr->WriteConfig('sccp.conf', $this->sccp_conf_init);
$cnf_wr->WriteConfig('sccp.conf', $conf_init);
}
public function initVarfromXml() {

View file

@ -17,7 +17,7 @@
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
@ -31,6 +31,11 @@
</div>
</div>
<script>
$(function() {
$('#table-sccp-dialtemplate').bootstrapTable({data: <?php echo $this->dialTemplateData ?>});
})
function DispayDPActionsKeyFormatter(value, row, index) {
var exp_model = '';
exp_model += '<a href="?display=sccp_adv&tech_hardware=dialplan&extdisplay=' + row['id'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';

View file

@ -26,20 +26,19 @@ $keysetarray = $this->extconfigs->getExtConfig('keyset');
'uriaction' => array('default'));
*/
// ------------------------------------- Key Set Display information ---------------------------------------------------------
$keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Display Onhook', 'help' =>'help.'),
'connected' => array('sname' => 'CONNECTED', 'name' =>'Display Connected', 'help' =>'help.'),
'onhold' => array('sname' => 'ONHOLD', 'name' =>'Display onhold', 'help' =>'help.'),
'ringin' => array('sname' => 'RINGIN', 'name' =>'Display ringin', 'help' =>'help.'),
'offhook' => array('sname' => 'OFFHOOK', 'name' =>'Display offhook', 'help' =>'help.'),
'conntrans' => array('sname' => 'CONNTRANS', 'name' =>'Display conntrans', 'help' =>'help.'),
'digitsfoll' => array('sname' => 'DIGITSFOLL', 'name' =>'Display digitsfoll', 'help' =>'help.'),
'connconf' => array('sname' => 'CONNCONF', 'name' =>'Display connconf', 'help' =>'help.'),
'ringout' => array('sname' => 'RINGOUT', 'name' =>'Display ringout', 'help' =>'help.'),
'offhookfeat'=> array('sname' => 'OFFHOOKFEAT', 'name' =>'Display offhookfeat', 'help' =>'help.'),
'onhint' => array('sname' => 'ONHINT', 'name' =>'Display onhint', 'help' =>'help.'),
'onstealable'=> array('sname' => 'onstealable', 'name' =>'Display onstealable', 'help' =>'help.'),
'holdconf' => array('sname' => 'HOLDCONF', 'name' =>'Display holdconf', 'help' =>'help.'),
'uriaction' => array('sname' => '', 'name' =>'Display uriaction', 'help' =>'help.')
$keynamearray = array('ONHOOK' => array('sname' => 'ONHOOK', 'name' =>'Display Onhook', 'help' =>'help.'),
'CONNECTED' => array('sname' => 'CONNECTED', 'name' =>'Display Connected', 'help' =>'help.'),
'ONHOLD' => array('sname' => 'ONHOLD', 'name' =>'Display onhold', 'help' =>'help.'),
'RINGIN' => array('sname' => 'RINGIN', 'name' =>'Display ringin', 'help' =>'help.'),
'OFFHOOK' => array('sname' => 'OFFHOOK', 'name' =>'Display offhook', 'help' =>'help.'),
'CONNTRANS' => array('sname' => 'CONNTRANS', 'name' =>'Display conntrans', 'help' =>'help.'),
'DIGITSFOLL' => array('sname' => 'DIGITSFOLL', 'name' =>'Display digitsfoll', 'help' =>'help.'),
'CONNCONF' => array('sname' => 'CONNCONF', 'name' =>'Display connconf', 'help' =>'help.'),
'RINGOUT' => array('sname' => 'RINGOUT', 'name' =>'Display ringout', 'help' =>'help.'),
'OFFHOOKFEAT'=> array('sname' => 'OFFHOOKFEAT', 'name' =>'Display offhookfeat', 'help' =>'help.'),
'INUSEHINT' => array('sname' => 'INUSEHINT', 'name' =>'Display inusehint', 'help' =>'help.'),
'ONHOOKSTEALABLE'=> array('sname' => 'ONHOOKSTEALABLE', 'name' =>'Display onhookstealable', 'help' =>'help.'),
'HOLDCONF' => array('sname' => 'HOLDCONF', 'name' =>'Display holdconf', 'help' =>'help.')
);
?>
@ -53,20 +52,20 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-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) {
if ($i < 13) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
$i ++;
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
<th data-field="actions" data-formatter="DisplayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
@ -84,7 +83,9 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div>
<div class="modal-body">
@ -165,7 +166,12 @@ foreach ($keysetarray as $key => $value) {
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
$(function() {
$('#softkey-all').bootstrapTable({data: <?php echo $this->softKeyData ?>});
})
function DisplayActionsKeyFormatter(value, row, index) {
var exp_model = '';
if (row['softkeys'] !== 'default') {
exp_model += '<a href="#edit_softkeys" onclick="load_oncliсk(this, &quot;'+row['softkeys']+'&quot;)" data-toggle="modal" data-target=".edit_new_keyset"><i class="fa fa-pencil"></i></a>&nbsp;';

View file

@ -11,16 +11,18 @@ global $amp_conf;
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<div id="toolbar-model">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model"><i class="fa fa-bolt"></i> <?php echo _("Add model"); ?>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model">
<i class="fa fa-plus"></i> <?php echo _("Add model"); ?>
</button>
<button data-id="model_disabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" data-table="table-models" disabled data-section="all">
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disable') ?></span>
<button data-id="model_disabled" id=buttonDeviceDisable class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" data-table="table-models" disabled data-section="all">
<i class="glyphicon glyphicon-remove"></i>
<span><?php echo _('Disable') ?></span>
</button>
<button data-id="model_enabled" class="btn btn-danger sccp_update btn-tab-select" data-table="table-models" data-type="sccp_model" disabled data-section="all">
<i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enable') ?></span>
<button data-id="model_enabled" id=buttonDeviceEnable class="btn btn-success sccp_update btn-tab-select" data-table="table-models" data-type="sccp_model" disabled data-section="all">
<i class="fa fa-check"></i>
<span><?php echo _('Enable') ?></span>
</button>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@ -28,15 +30,18 @@ global $amp_conf;
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a class="dropitem" data-id="enabled" tabindex="-1" href="#"><span><?php echo _('Show Enabled') ?></span></a></li>
<li><a class="dropitem" data-id="extension" tabindex="-1" href="#"><span><?php echo _('Expansion Module')?></span></a></li>
<li><a class="dropitem" data-id="all" tabindex="-1" href="#"><span><?php echo _('Show All') ?></span></a></li>
<li><a class="dropitem" data-id="enabled" tabindex="-1" href="#">
<span><?php echo _('Show Enabled') ?></span></a></li>
<li><a class="dropitem" data-id="expansion" tabindex="-1" href="#">
<span><?php echo _('Show Expansion Modules')?></span></a></li>
<li><a class="dropitem" data-id="disabled" tabindex="-1" href="#">
<span><?php echo _('Show Disabled') ?></span></a></li>
</ul>
</div>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".get_ext_file_<?php echo $requestType; ?>"><i class="fa fa-bolt"></i> <?php echo _("Update Files from Provisioner"); ?>
</button>
</div>
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&command=getDeviceModel&type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<thead>
<tr>
<th data-checkbox="true"></th>
@ -45,8 +50,8 @@ global $amp_conf;
<th data-sortable="true" data-field="vendor"><?php echo _('Vendor');?></th>
<th data-sortable="false" data-formatter="DisplayDnsFormatter" data-field="dns"><?php echo _('Expansion Module');?></th>
<th data-sortable="false" data-field="buttons"><?php echo _('Buttons');?></th>
<th data-sortable="false" data-formatter="SetColFirmNf" data-field="loadimage"><?php echo _('Loadimage');?></th>
<th data-sortable="false" data-field="loadinformationid"><?php echo _('Loadinformation ID');?></th>
<th data-sortable="false" data-formatter="SetColFirmNf" data-field="loadimage"><?php echo _('Loadimage');?></th>
<th data-sortable="false" data-formatter="SetColTemplNf" data-field="nametemplate"><?php echo _('Model template');?></th>
<th data-field="actions" data-formatter="DispayActionsModelFormatter"><?php echo _('Actions');?></th>
</tr>
@ -63,84 +68,144 @@ global $amp_conf;
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Add new model');?></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_model"><?php echo _('Device Model');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_model"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_model" name="new_model" value="79XX">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_model-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_model"><?php echo _('Device Model');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_model"></i>
</div>
<div class="col-md-9">
<input type="text" class="form-control" id="new_model" name="new_model" value="79XX">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_model-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_vendor"><?php echo _('Vendor name');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_vendor"></i>
</div>
<div class="col-md-9">
<input type="text" class="form-control" id="new_vendor" name="new_vendor" value="CISCO">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_dns"><?php echo _('Expansion Module');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_dns"></i>
</div>
<div class="col-md-9">
<select name="new_dns" id="new_dns">
<option value="1" selected='selected'>Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0">Sidecar</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_dns-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_buttons"></i>
</div>
<div class="col-md-9">
<input type="number" min="1" min="96" class="form-control" id="new_buttons" name="new_buttons" value="1">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadimage"></i>
</div>
<div class="col-md-9">
<input type="text" class="form-control" id="new_loadimage" name="new_loadimage" value="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_loadimage-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_loadinformationid"><?php echo _('Load Information ID');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadinformationid"></i>
</div>
<div class="col-md-9">
<input type="text" class="form-control" id="new_loadinformationid" name="new_loadinformationid" value="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_loadinformationid-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_vendor"><?php echo _('Vendor name');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_vendor"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_vendor" name="new_vendor" value="CISCO">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_dns"><?php echo _('Expansion Module');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_dns"></i>
</div><div class="col-md-9">
<select name="new_dns" id="new_dns">
<option value="1" selected='selected'>Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0">Sidecar</option>
</select>
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_dns-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_buttons"></i>
</div><div class="col-md-9">
<input type="number" min="1" min="96" class="form-control" id="new_buttons" name="new_buttons" value="1">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadimage"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_loadimage" name="new_loadimage" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_loadimage-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_loadinformationid"><?php echo _('Load Information ID');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadinformationid"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_loadinformationid" name="new_loadinformationid" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_loadinformationid-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_nametemplate"><?php echo _('Model template XML');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_nametemplate"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_nametemplate" name="new_nametemplate" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_nametemplate-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_nametemplate"><?php echo _('Model template XML');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_nametemplate"></i>
</div>
<div class="col-md-9">
<input type="text" class="form-control" id="new_nametemplate" name="new_nametemplate" value="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_nametemplate-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _('Close');?></button>
@ -263,57 +328,13 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
</div>
</div>
<script>
function StatusIconFormatter(value, row) {
return (value === '1') ? '<i class="fa fa-check-square-o" style="color:green" title="<?php echo _("Device is enabled")?>"></i>' : '<i class="fa fa-square-o" title="<?php echo _("Device is disabled")?>"></i>';
}
function DisplayDnsFormatter(value, row, index) {
var exp_model = ['Expansion Module', 'Not Available', 'One ExpModule', 'Two ExpModule'];
return exp_model[value];
}
// function DispayInputFormatter(value, row, index) {
// return (value == null) ? '<input class="tabl-edit form-control" name="' + row['model'] + '_template" type="text" value="">' : '<input class="tabl-edit form-control" name="' + row['model'] + '_template" type="text" value="' + value + '">';
// }
function DispayActionsModelFormatter(value, row, index) {
var exp_model = '';
// exp_model += '<a href="#edit_model" class="btn btn-info" onclick="load_model(this, &quot;'+row['model']+'&quot;)" data-toggle="modal"><i class="fa fa-pencil"></i></a>';
exp_model += '<a href="#edit_model" onclick="load_model(this, &quot;'+row['model']+'&quot;)" data-toggle="modal"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="model" data-id="' + row['model'] + '"><i class="fa fa-trash"></i></a>';
return exp_model;
}
function SetColFirmNf(value, row, index) {
if (row['validate'].split(';')[0] === 'no') {
return "File not found<br />" + value;
}
return value;
}
function SetColTemplNf(value, row, index) {
if (row['validate'].split(';')[1] === 'no') {
return "File not found<br /> " + value ;
}
return value;
}
function SetRowColor(row, index) {
var tclass = "active";
if (row['enabled'] === 1) {
tclass = (index % 2 === 0) ? "info" : "info";
}
if ((row['validate'] === 'yes;yes') || (row['validate'] === 'yes;-')) {
// tclass = (row['enabled'] === '1') ? "danger" : "warning";
} else {
tclass = (row['enabled'] === '1') ? "danger" : "warning";
}
return {classes: tclass};
}
$(function() {
$('#table-models').bootstrapTable({data: <?php echo $this->deviceModelData ?>});
})
function load_model(elmnt,clr) {
// $("#edit_devmodel").text(clr);
var drow = $("#table-models").bootstrapTable('getRowByUniqueId',clr);
if (drow == null) {
alert(drow);
@ -327,4 +348,47 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
document.getElementById("editd_buttons").value = drow['buttons'];
}
}
function StatusIconFormatter(value, row) {
return (value === '1') ? '<i class="fa fa-check-square-o" style="color:green" title="<?php echo _("Device is enabled")?>"></i>' : '<i class="fa fa-square-o" title="<?php echo _("Device is disabled")?>"></i>';
}
function DisplayDnsFormatter(value, row, index) {
var exp_model = ['Expansion Module', 'Not Available', 'One ExpModule', 'Two ExpModule'];
return exp_model[value];
}
function DispayActionsModelFormatter(value, row, index) {
var exp_model = '';
// exp_model += '<a href="#edit_model" class="btn btn-info" onclick="load_model(this, &quot;'+row['model']+'&quot;)" data-toggle="modal"><i class="fa fa-pencil"></i></a>';
exp_model += '<a href="#edit_model" onclick="load_model(this, &quot;'+row['model']+'&quot;)" data-toggle="modal"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="model" data-id="' + row['model'] + '"><i class="fa fa-trash"></i></a>';
return exp_model;
}
function SetColFirmNf(value, row, index) {
//if (row['validate'].split(';')[0] === 'no') {
if (row['fwfound'] === 'no') {
return "File not found<br />" + value;
}
return value;
}
function SetColTemplNf(value, row, index) {
//if (row['validate'].split(';')[1] === 'no') {
if (row['templatefound'] === 'no') {
return "File not found<br /> " + value ;
}
return value;
}
function SetRowColor(row, index) {
var tclass = "active";
if (row['enabled'] === "1") {
tclass = "success";
}
if (row['fwfound'] !== 'yes') {
tclass = (row['enabled'] === "1") ? "danger" : "warning";
}
return {classes: tclass};
}
</script>

View file

@ -29,74 +29,78 @@ if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
$enumFields = $this->getTableEnums('sccpdevice');
$def_val['defaultLine'] = $this->dbinterface->getSccpDeviceTableData('getDefaultLine', array('id' => $dev_id))['name'];
foreach ($db_res as $key => $val) {
if (!empty($val)) {
switch ($key) {
case 'phonepersonalization':
$def_val['phonepersonalization'] = array("keyword" => 'phonepersonalization', "data" => $val, "seq" => "99");
break;
default:
// Overwrite existing defaults after checking that data is still valid after schema updates
// Do not strip underscores as these fields are new in the schema and so should be valid.
$enumFields = $this->getTableEnums('sccpdevice', false);
if (array_key_exists($key, $enumFields)){
// This field is (now) an enum. Check the current value is acceptable.
// Quote value as enum values are quoted.
if (in_array("'{$val}'", $enumFields[$key])) {
// The value is valid so will keep
$def_val[$key] = array('keyword' => $key, 'data' => $val, 'seq' => 99);
}
// Do not store value and let defaults apply
break;
if (empty($val)) {
continue;
}
switch ($key) {
case 'phonepersonalization':
$def_val['phonepersonalization'] = array("keyword" => 'phonepersonalization', "data" => $val, "seq" => "99");
break;
default:
// Overwrite existing defaults after checking that data is still valid after schema updates
if (array_key_exists($key, $enumFields)){
// This field is (now) an enum. Check the current value is acceptable.
// Quote value as enum values are quoted.
if (in_array("'{$val}'", $enumFields[$key])) {
// The value is valid so will keep
$def_val[$key] = array('keyword' => $key, 'data' => $val, 'seq' => 99);
}
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
// Need to assign defaultLine as not set in the db.
$def_val['defaultLine'] = $this->dbinterface->getSccpDeviceTableData('getDefaultLine', array('id' => $dev_id))['name'];
// Do not store (invalid) value and let defaults apply
break;
}
}
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
break;
}
}
}
// TODO: dev_id should always be set so do not need this??
if (empty($dev_id)) {
$dev_id = '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");
}
if (!empty($def_val['type'])) {
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$def_val['type']));
if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0];
if (!empty($def_val['type']['data'])) {
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$def_val['type']['data']));
if (isset($tmp_raw[$def_val['type']['data']])) {
$tmp_raw = $tmp_raw[$def_val['type']['data']];
}
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']);
}
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">
<pre>
<?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>';
}
if ($tmp_raw['fwfound'] === 'no') {
$device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
}
if ($tmp_raw['templatefound'] === 'no') {
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
}
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">
<pre>
<?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>
}
?>
</pre>
</div>
</div>
</div>
<br>
</div>
<br>
<?php }
}
} ?>
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
@ -105,40 +109,26 @@ if (!empty($def_val['type'])) {
<?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_device_id" value="'.$dev_id.'">';
}
echo '<input type="hidden" name="sccp_device_id" value="'.$dev_id.'">';
if ($_REQUEST['tech_hardware'] == 'cisco') {
echo '<input type="hidden" name="sccp_device_typeid" value="sccpdevice">';
if (empty($dev_id)) {
if ($dev_id === 'new') {
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_dev_vendor_display_conf', 1, 'sccpdevice', $def_val, 'site');
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)) {
if ($dev_id === 'new') {
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);

View file

@ -19,8 +19,8 @@ if ($_REQUEST['tech_hardware'] === 'cisco') {
} else {
$lines_list = $this->dbinterface->getSipTableData('extensionList');
}
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
// TODO: actually returning all hints - the filter is currently ignored.
$hint_list = $this->getHintInformation(array('context'=>'park-hints'));
$line_id =0;
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons

View file

@ -28,7 +28,6 @@ if (empty($form_prefix)) {
// $npref = 'vendorconfig';
// $napref = 'vendorconfig-ar';
}
if (empty($fvalues)) {
$fvalues = $sccp_defaults;
}
@ -48,6 +47,8 @@ if ($h_show==1) {
<?php
}
// Use BMO - this will return an Sccp_manager object if it already exists in BMO, or create one if not
$sccpManager = FreePBX::create()->Sccp_manager;
foreach ($items as $child) {
$disabledButtons = array();
if (empty($child->help)) {
@ -57,10 +58,10 @@ foreach ($items as $child) {
echo "<!-- Begin {$child->label} -->";
switch ($child['type']) {
case 'IE':
\FreePbx::sccp_manager()->formcreate->addElementIE($child, $fvalues, $sccp_defaults,$npref);
$sccpManager->formcreate->addElementIE($child, $fvalues, $sccp_defaults,$npref);
break;
case 'IED':
\FreePbx::sccp_manager()->formcreate->addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref);
$sccpManager->formcreate->addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref);
break;
case 'ISC':
// This is a special case for Provision mode. Set some parameters here and fall through to IS.
@ -69,7 +70,7 @@ foreach ($items as $child) {
$disabledButtons = array('off' => 'Off');
}
case 'IS':
\FreePbx::sccp_manager()->formcreate->addElementIS($child, $fvalues, $sccp_defaults,$npref, $disabledButtons);
$sccpManager->formcreate->addElementIS($child, $fvalues, $sccp_defaults,$npref, $disabledButtons, $defButton);
break;
case 'SLD':
case 'SLM':
@ -81,11 +82,12 @@ foreach ($items as $child) {
case 'SLA':
case 'SLZ':
case 'SL':
\FreePbx::sccp_manager()->formcreate->addElementSL($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
case 'SLDT':
$sccpManager->formcreate->addElementSL($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
break;
case 'SLDA':
case 'SLNA':
\FreePbx::sccp_manager()->formcreate->addElementSLNA($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
$sccpManager->formcreate->addElementSLNA($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
break;
case 'SDM':
case 'SDMS':
@ -93,16 +95,16 @@ foreach ($items as $child) {
case 'SDMF':
case 'SDE':
case 'SDD':
\FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);
$sccpManager->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);
break;
case 'ITED':
\FreePbx::sccp_manager()->formcreate->addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref);
$sccpManager->formcreate->addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref);
break;
case 'HLP':
\FreePbx::sccp_manager()->formcreate->addElementHLP($child, $fvalues, $sccp_defaults,$npref);
$sccpManager->formcreate->addElementHLP($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SLTZN':
\FreePbx::sccp_manager()->formcreate->addElementSLTZN($child, $fvalues, $sccp_defaults,$npref);
$sccpManager->formcreate->addElementSLTZN($child, $fvalues, $sccp_defaults,$npref);
break;
}
echo "<!-- END {$child->label} -->";

View file

@ -20,14 +20,14 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
<div id="toolbar-sccp-extension">
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=extGrid" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<thead>
<tr>
<th data-sortable="true" data-field="name"><?php echo _('Extension') ?></th>
<th data-sortable="true" data-field="label"><?php echo _('Display Name') ?></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device') ?></th>
<th data-sortable="true" data-field="line_status" class="text-center"><?php echo _('Status | Active') ?></th>
<th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
<th data-field="actions" data-formatter="DisplayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
@ -36,7 +36,12 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
</div>
</div>
<script>
function DispayPhoneActionsKeyFormatter(value, row, index) {
$(function() {
$('#table-sccp-extension').bootstrapTable({data: <?php echo $this->extensionData ?>});
})
function DisplayPhoneActionsKeyFormatter(value, row, index) {
var exp_dev = '';
var rmn_dev = '<?php echo $roming_enable ?>';
exp_dev += '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;';

View file

@ -31,7 +31,7 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
<table data-cookie="true" data-cookie-id-table="sccp-phone" id="table-sccp-phone"
data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" data-maintain-selected="true"
data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true"
data-search="true" class="table table-striped ext-list" id="table-sccp" data-id="name">
@ -39,12 +39,12 @@
<tr>
<th data-checkbox="true"></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="description"><?php echo _('Device Description') ?></th>
<th data-sortable="true" data-formatter="DisplayTypeFormatter" 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>
<th data-sortable="true" data-field="address"><?php echo _('Address') ?></th>
<th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatter"><?php echo _('Actions') ?></th>
<th data-field="actions" data-formatter="DisplayDeviceActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
@ -54,9 +54,14 @@
</div>
<script>
function DispayTypeFormatter(value, row, index) {
$(function() {
$('#table-sccp-phone').bootstrapTable({data: <?php echo $this->sccpPhoneData ?>});
})
function DisplayTypeFormatter(value, row, index) {
var exp_model = value;
if (row['addon'] !== null ) {
if (row['addon'] !== 'NONE' ) {
var posd = row['addon'].indexOf(';');
if (posd >0) {
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
@ -67,7 +72,7 @@
return exp_model;
}
function DispayDeviceActionsKeyFormatter(value, row, index) {
function DisplayDeviceActionsKeyFormatter(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&new_id=' + row['name'] + '&type='+ row['type'];

View file

@ -11,7 +11,6 @@
<table id="sccpnavgrid"
data-search="true"
data-toolbar="#toolbar-sccp-rnav"
data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
data-cache="false"
data-toggle="table"
class="table">
@ -22,7 +21,13 @@
</tr>
</thead>
</table>
<script type="text/javascript">
$(function() {
$('#sccpnavgrid').bootstrapTable({data: <?php echo $data ?>});
})
$("#sccpnavgrid").on('click-row.bs.table',function(e,row,elem){
if (row['new_hw'] == 'Y' ) {
window.location = '?display=sccp_phone&tech_hardware=cisco&new_id=' +row['name'] +'&' +row['type'];

View file

@ -21,7 +21,7 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></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"
<table data-cookie="true" data-cookie-id-table="sccp-sphone" id="table-sip-phone"
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">
@ -30,11 +30,11 @@
<th data-checkbox="true"></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-formatter="SipDisplayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="true" data-field="button" data-formatter="SipLineFormatter"><?php echo _('Line') ?></th>
<th data-sortable="true" data-field="status"><?php echo _('Status') ?></th>
<th data-sortable="true" data-field="address"><?php echo _('Address') ?></th>
<th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatterS"><?php echo _('Actions') ?></th>
<th data-field="actions" data-formatter="SipDisplayDeviceActionsKeyFormatterS"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
@ -45,9 +45,11 @@
<script>
$(function() {
$('#table-sip-phone').bootstrapTable({data: <?php echo $this->sipPhoneData ?>});
})
function DispayTypeFormatter(value, row, index) {
function SipDisplayTypeFormatter(value, row, index) {
var exp_model = value;
if (row['addon'] !== null ) {
var posd = row['addon'].indexOf(';');
@ -59,7 +61,7 @@
}
return exp_model;
}
function DispayDeviceActionsKeyFormatterS(value, row, index) {
function SipDisplayDeviceActionsKeyFormatterS(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&new_id=' + row['name'] + '&type='+ row['type'];
@ -74,7 +76,7 @@
}
return exp_model;
}
function LineFormatter(value, row, index) {
function SipLineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
@ -88,5 +90,5 @@
}
return result;
}
</script>

View file

@ -16,8 +16,9 @@
// now will populate from the db defaults.
$defaultVals = $this->getTableDefaults('sccpdevice', true);
echo $this->showGroup('sccp_srst', 1);
//echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccpdevice', $defaultVals);
echo $this->showGroup('sccp_dev_advconfig', 1);
?>
</form>

View file

@ -25,8 +25,12 @@
//echo $this->showGroup('sccp_dev_config', 1, 'sccpdevice', $def_val_device);
echo $this->showGroup('sccp_dev_config', 1);
echo $this->showGroup('sccp_dev_group_config', 1);
echo $this->showGroup('sccp_dev_advconfig', 1);
// Below moved to advanced
//echo $this->showGroup('sccp_dev_advconfig', 1);
echo $this->showGroup('sccp_dev_softkey', 1);
//echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_dev_vendor_display_conf', 1, 'sccpdevice', $def_val_device );
echo $this->showGroup('sccp_dev_vendor_access_conf', 1, 'sccpdevice', $def_val_device );
echo $this->showGroup('sccp_hotline_config', 1);
echo $this->showGroup('sccp_qos_config', 1, 'sccpdevice', $def_val_device);
?>

View file

@ -27,7 +27,7 @@ foreach ($ast_realtime as $key => $value) {
$conf_realtime = $this->extconfigs->validate_RealTime($ast_realm);
$db_Schema = $this->dbinterface->validate();
$mysql_info = $this->dbinterface->get_db_sysvalues();
$compatible = $this->aminterface->get_compatible_sccp();
$compatible = $core['vCode'];
$info = array();
//$info['srvinterface'] = $this->srvinterface->info();