Пререлиз 12.09.2017

Замена функции чтения sccp.conf
This commit is contained in:
PhantomVl 2017-09-12 17:08:52 +03:00 committed by Alex
commit 972b213b68
32 changed files with 6017 additions and 0 deletions

View file

@ -0,0 +1,49 @@
Conference - NOT CONFERENCE BRIDGE !!!!! ( Sccp Conference)
Conference Introduction
The integrated conference solution build in chan-sccp-b is based on asterisk's ConfBridge functionality. In stead of having to memorize the confbridge voice menu and having to press DTMF keys to control your conference we have opted to include a visual Cisco-XML menu, which give you (the Moderator) the ability to Kick, Mute and Promote another user to become an additional Moderator.
Note: You need to './configure --enable-conference ...' when you built the chan_sccp.so module. Note: A conference always requires at least one moderator.
Conference Settings
The standard conference settings are setup per device and contain:
param default description
conf_allow yes Allow the use of conference
conf_play_general_announce yes Playback General Announcements (like: 'You are Entering/Leaving the conference')
conf_play_part_announce yes Playback Personal/Participant Announcements, (like: 'You have been muted / You have been kicked')
conf_mute_on_entry no Mute new participants from the start, when they enter the conference (Preventing them to talk amongst one another). The Moderator will have to UnMute a participant manually to allow them to speak. Usefull in a classroom setting.
conf_music_on_hold_class 'default' Play music on hold of this class when no moderator is listening on the conference. If set to an empty string, no music on hold will be played.
conf_show_conflist yes Automatically show conference list to the moderator
Creating a New Conference (Conf Softkey)
Using the Conference Button makes it possible to set up a Simple Conference between 3 or more participant. (The actual minimum to start a conference is 2, but that doesn't make a lot of sense now does it.)
You already have 2 or more lines connected (One is active and the other(s) is/are on Hold), which you would like to put in a Conference; Simply Press the Conf Softkey Button.
If you do not already have these lines connected, that call some people first and then start the conference. It does not make sense to be conferencing on your own.
Conference List (ConfList Softkey)
When conf_show_conflist=yes or you press the ConfList Softkey, you will be presented with a Cisco-XML Menu, showing you all currently connected Participant. Something like this:
7970_Conference.png
You can use the Softkeys underneath the menu, for example:
Softkey Description
EndConf Hangup all participants and end the current conference
Kick Through a specific participant out of the conference (Call is hungup)
Mute Do not allow a specific participant to speak (The hear a voiceprompt stating that they have been muted (if conf_play_part_announce = yes), and the mute status is displayed on their display (if they have an sccp device))
Unmute Allow a specific participant to speak (The hear a voiceprompt stating that they have been unmuted (if conf_play_part_announce = yes), and the mute status is displayed on their display (if they have an sccp device)).
Promote Make a specific participant a moderator as well (giving them control over the conference as well). You can leave the conference by hanging up, without the conference being terminated.
Exit Leave the ConfList Menu, but remain connected to the conference. This makes it possible to put the conference onhold and invite someone new for examples. You need to press the ConfList Softkey to get back into the ConfList Menu.
Adding another Participant after the conference has already started (Join Softkey)
If you do need to add a person after having started the conference, then you need to exit the conflist menu, put the conference on hold and dial the new "future" participant, once that person has picked up, you press the join button on that new call and this new participant will be added to the conference and you will automatically resume the conference you where in before.
Once the conference is started you will be presented with the conflist menu which will allow you to control the conference directly from your phone (kick / mute participant and even promote one of the participant to become a secondary moderator, so that they can take over control of the conference and you are free to leave).
Q & A:
The Conference Softkey just created a two person conference
Question: Creating a conference call on my 7961 does not seem to work. Once I hit the Conference softbutton, it will create a conference but put me and the other person directly into the conference without giving me any way to call a third party.
Solution: Just put the first person on hold, dial the second person (and a third, fourth etc) and then press the conference button. All of the calls connected to your phone will automatically be put into the conference.

View file

@ -0,0 +1,20 @@
You can specifying 'useRedialMenu = yes' in the sccp.conf device section and the redial softkey will cause the "placed calls" list instead of immediately calling the last dialed number.
CallListStateUpdate (java phones)
If you add/enable the 'callLogBlfEnabled' xml entry in SEPXXX.cnf.xml under commonProfile, like so:
<commonProfile>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
and you have added hints for your local extension in your dialplan, like:
exten => _XX.,hint,SCCP/${EXTEN}
Then the placed calls list will include the status of the remote extension, like this:
PlacedCalls
Which does 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.

5
!Readme.txt/SEPXML.txt Normal file
View file

@ -0,0 +1,5 @@
http://usecallmanager.nz/sepmac-cnf-xml.html
http://usecallmanager.nz/line-keys-xml.html
http://usecallmanager.nz/user-locale.html
https://www.voip-info.org/wiki/view/Asterisk+phone+cisco+79x1+xml+configuration+files+for+SIP
https://www.voip-info.org/wiki/view/Asterisk+phone+cisco+7970+SIP

View file

@ -0,0 +1,42 @@
https://github.com/chan-sccp/chan-sccp/wiki/Adding-custom-background-images
General Information
Cisco IP Phones support either colored or monochrom background images in various resolutions (depending on model). The background can either be set up in sccp.conf server side or the user can be enabled to select a background image from a defined list of backgrounds. The image has to be a graphic file with .PNG extension. Other requirements apply, depending on phone model (see below).
Set background image server side
Background images can be set up server side in sccp.conf for most modern Cisco IP Phones by using a parameter in the device section. This image is pushed to the phone upon every restart.
[SEPXXXXXXXXX]
...
backgroundImage=http://PATH-TO-BACKGROUND-IMAGE/filename.png
!!!> Phone personalization needs to be set to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:
------------------------------------
<phonePersonalization>1</phonePersonalization>
------------------------------------
Enable user to pick a custom background image
When a user is allowed to pick his own background image in the user settings (true in device section of the SEPXXXX.xml config file), the phone searches for the List.xml (case-sensitive) file in the following directories. Depending on the phone model, the required file properties are as follows:
Phone Model Image Size Thumbnail Size Directory
7906 / 7911 95x34 23x8 /Desktops/95x34x1
7941 / 7961 320x196 80x49 /Desktops/320x196x4
7942 / 7962 320x196 80x49 /Desktops/320x196x4
7945 / 7965 320x212 80x53 /Desktops/320x212x16
7970 / 7971 320x212 80x53 /Desktops/320x212x12
7975 320x216 80x53 /Desktops/320x216x16
7985 800x600 not supported /Desktops/800x600x16
8941 / 8945 640x480 123x111 /Desktops/640x480x24
The Image file is used for the background of the phone display. An additional thumbnail is used as a preview image on the phone settings menu (on 7985 only the filename). The List.xml has to be in the above model-depending directory. The file has a Cisco IPPhoneImage syntax, example:
<CiscoIPPhoneImageList>
<ImageItem Image="TFTP:Desktops/640x480x24/sccp-tn.png"
URL="TFTP:Desktops/640x480x24/sccp.png"/>
<ImageItem Image="TFTP:Desktops/640x480x24/sccp_2-tn.png"
URL="TFTP:Desktops/640x480x24/sccp_2.png"/>
</CiscoIPPhoneImageList>
While the resolution is fix, the phones are able to reduce the color depth if the original image uses too many colors.

15
!Readme.txt/make_sccp.txt Normal file
View file

@ -0,0 +1,15 @@
git clone https://github.com/chan-sccp/chan-sccp chan-sccp_develop
./configure --enable-indications --enable-conference --enable-advanced-functions --enable-distributed-devicestate
make
make install
load = chan_sccp.so
noload = chan_skinny.so
preload = func_db.so
preload = res_odbc.so
preload = res_config_odbc.so
preload = cdr_adaptive_odbc.so
preload = app_voicemail.so

58
README.md Normal file
View file

@ -0,0 +1,58 @@
## Welcome to Chan_SCCP GUI Manager
```
______ _____ ______ __
| ____| | __ \| _ \ \ / /
| |__ _ __ ___ ___| |__) | |_) \ V /
| __| '__/ _ \/ _ \ ___/| _ < > <
| | | | | __/ __/ | | |_) / . \
|_| |_| \___|\___|_| |____/_/ \_\
Your Open Source Asterisk PBX GUI Solution
```
SCCP Manager is free software. Please see the file COPYING for details.
For documentation, please see the files in the doc subdirectory.
For building and installation instructions please see the INSTALL file.
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Documentation](https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
### Prerequisites
Make sure you have the following installed on your system:
- c-compiler:
- gcc >= 4.4 (note: older not supported, higher advised)
- clang >= 3.6 (note: older not supported, higher advised)
- gnu make
- pbx:
- asterisk >= 1.6.2 (absolute minimum)
- asterisk >= 13.7 or asterisk >= 14.0 recommended
- gui:
- freepbx >= 13.0.192
- Chan_SCCP module:
- configure flags ./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate
- creating mysql DB from sorce (mysql -u root asterisk < mysql-v5.sql)
- cofigure TFTP server
- cofigure DHCP server
- standard posix compatible applications like sed, awk, tr
### Setting up a FreePBX system
[See our WIKI](http://wiki.freepbx.org/display/FOP/Install+FreePBX)
### Setting up a Sccp manager
[See our WIKI] https://github.com/chan-sccp/chan-sccp/wiki/How-to-setup-the-chan_sccp-Module
### Module requred
SCCP channel driver Compiling:
./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate
or
./configure --enable-indications --enable-conference --enable-advanced-functions --enable-distributed-devicestate
copy all from sorce/conf/tftp to /tftpboot-directory
create mysql-db
cd sorce/conf
mysql -u root asterisk < mysql-v5.sql

1980
Sccp_manager.class.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 03.05.2017, 16:13:49
Author : Alex
*/
.sccpmultiselect {
min-height: 100px;
padding: 1px 1px;
}
.sccpbtn {
min-height: 10px;
padding: 1px 1px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

View file

@ -0,0 +1,76 @@
/**
* jQuery.SelectListActions
* https://github.com/esausilva/jquery.selectlistactions.js
*
* (c) http://esausilva.com
*/
(function ($) {
//Moves selected item(s) from sourceList to destinationList
$.fn.moveToList = function (sourceList, destinationList) {
var opts = $(sourceList + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
$(destinationList).append($(opts).clone());
};
//Moves all items from sourceList to destinationList
$.fn.moveAllToList = function (sourceList, destinationList) {
var opts = $(sourceList + ' option');
if (opts.length == 0) {
alert("Nothing to move");
}
$(destinationList).append($(opts).clone());
};
//Moves selected item(s) from sourceList to destinationList and deleting the
// selected item(s) from the source list
$.fn.moveToListAndDelete = function (sourceList, destinationList) {
var opts = $(sourceList + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
$(opts).remove();
$(destinationList).append($(opts).clone());
};
//Moves all items from sourceList to destinationList and deleting
// all items from the source list
$.fn.moveAllToListAndDelete = function (sourceList, destinationList) {
var opts = $(sourceList + ' option');
if (opts.length == 0) {
alert("Nothing to move");
}
$(opts).remove();
$(destinationList).append($(opts).clone());
};
//Removes selected item(s) from list
$.fn.removeSelected = function (list) {
var opts = $(list + ' option:selected');
if (opts.length == 0) {
alert("Nothing to remove");
}
$(opts).remove();
};
//Moves selected item(s) up or down in a list
$.fn.moveUpDown = function (list, btnUp, btnDown) {
var opts = $(list + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
if (btnUp) {
opts.first().prev().before(opts);
} else if (btnDown) {
opts.last().next().after(opts);
}
};
})(jQuery);

660
assets/js/sccp_manager.js Normal file
View file

@ -0,0 +1,660 @@
$(document).ready(function () {
$('.sortable').sortable({
update: function (event, ui) {
// console.log(ui.item.find('input').val(), ui.item.index())
ui.item.find('input').val(ui.item.index());
},
});
$('#ajaxcancel').on('click', function (e) {
// console.log('Calncel');
if ($(this).data('hash') != null) {
location.hash = $(this).data('hash');
}
if ($(this).data('href') != null) {
location.href = $(this).data('href');
}
if ($(this).data('path') != null) {
location.path = $(this).data('path');
}
if ($(this).data('search') != null) {
location.search = $(this).data('search');
}
if ($(this).data('reload') != null) {
location.reload();
}
});
$('#ajaxsubmit').on('click', function (e) {
var vdata = '';
var snd_command = 'savesettings';
$('.fpbx-submit').each(function () {
vdata = vdata + $(this).serialize() + '&';
});
if ($('.fpbx-submit').data('id') == "hw_edit") {
snd_command = 'save_hardware';
}
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
data: vdata,
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.hash != null) {
location.hash = data.hash;
}
if (data.href != null) {
location.href = data.href;
}
if (data.path != null) {
location.path = data.path;
}
if (data.search != null) {
location.search = data.search;
}
if (data.reload === true) {
location.reload();
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
});
$(".input-js-add").click(function(){
add_dynamic_input($(this),$(this).data('for'),"","");
});
// ----------------------- 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});
});
// ---------------------------------------
$('.btnMultiselect').click(function (e) {
var kid = $(this).data('id');
if ($(this).data('key') === 'Right') {
$('select').moveToListAndDelete('#source_' + kid, '#destination_' + kid);
}
if ($(this).data('key') === 'AllRight') {
$('select').moveAllToListAndDelete('#source_' + kid, '#destination_' + kid);
}
if ($(this).data('key') === 'Left') {
$('select').moveToListAndDelete('#destination_' + kid, '#source_' + kid);
}
if ($(this).data('key') === 'AllLeft') {
$('select').moveAllToListAndDelete('#destination_' + kid, '#source_' + kid);
}
e.preventDefault();
});
// Form.buttons - Form.adddevice
$('.lineselect').change(function (e) {
var kid = $(this).data('id');
var kval = $(this).val();
$('.lineselect_' + kid).each(function () {
switch (kval) {
case 'silent':
case 'monitor':
case 'line':
$(this).removeClass('hidden');
break;
case 'service':
case 'feature':
case 'speeddial':
case 'empty':
$(this).addClass('hidden');
break;
}
});
$('.linevalue_' + kid).each(function () {
switch (kval) {
case 'service':
case 'speeddial':
$(this).removeClass('hidden');
break;
case 'feature':
case 'silent':
case 'monitor':
case 'empty':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.linefeature_' + kid).each(function () {
switch (kval) {
case 'feature':
$(this).removeClass('hidden');
break;
case 'service':
case 'speeddial':
case 'silent':
case 'monitor':
case 'empty':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.linespeed_' + kid).each(function () {
if (kval == 'speeddial') {
$(this).removeClass('hidden');
} else {
$(this).addClass('hidden');
}
});
});
// Form.adddevice
$('.hw_select').change(function (e) {
// console.log('HwSelect');
var type_id = $('#sccp_hw_type').find(':selected').data('id');
var btn_dev = $('#sccp_hw_type').find(':selected').data('val');
// var btn_add=$('#sccp_hw_addon').find(':selected').data('val');
if (type_id === 1) {
if ($('#sccp_hw_addon').val() !== 'none') {
$('#sccp_hw_addon').val('none').change();
}
$('#sccp_hw_addon').attr("disabled", "disabled");
} else {
$('#sccp_hw_addon').removeAttr('disabled');
}
var btn_add = $('#sccp_hw_addon').find(':selected').data('val');
$('.line_button').each(function () {
if ($(this).data('id') < btn_dev + btn_add) {
$(this).removeClass('hidden');
$(this).removeAttr('hidden')
} else {
$(this).addClass('hidden');
}
});
});
// ----------------------- TEST Validate ----------------
$('.need-validate').on('change', function (e) {
var dev_class = $(this).attr('class');
var dev_id = $(this).val();
if (dev_class.includes('validate-netmask')) {
confirm(dev_id);
}
// confirm(dev_id);
});
// $('.sccp_test').on('click', function (e) {
// var dev_id = [];
// $('table').bootstrapTable('getSelections').forEach(function (entry) {
// dev_id.push(entry['name']);
// });
// dv = dev_id;
// confirm(dv);
// });
// ----------------------- TEST ----------------
$('.test').on('click', function (e) {
var dev_fld = ['onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat',
'onhint', 'onstealable', 'holdconf', 'uriaction'];
// var x=document.getElementById("source_onhook");
// var x=$("#source_onhook")[0];
// console.log(x.length);
var datas = '';
var tmp_val = '';
var dev_opt = '';
for (var i = 0; i < dev_fld.length; i++) {
dev_opt = $('#destination_' + dev_fld[i])[0];
tmp_val = '';
for (var n = 0; n < dev_opt.length; n++) {
if (n > 0) {
tmp_val += ',';
}
tmp_val += dev_opt.options[n].value;
}
datas += dev_fld[i] + '=' + tmp_val + '&';
}
;
// console.log(datas);
});
$('.sccp_update').on('click', function (e) {
// console.log($(this).data('id'));
// ----------------------- Server.keyset form ----------------
//
if ($(this).data('id') === 'keyset_add') {
var dev_cmd = 'updateSoftKey';
if ($(this).data('mode') === 'new') {
dev_cmd = 'updateSoftKey';
}
var dev_fld = ['onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat',
'onhint', 'onstealable', 'holdconf'];
var datas = 'id=' + $('#new_keySetname').val() + '&';
var tmp_val = '';
var dev_opt = '';
for (var i = 0; i < dev_fld.length; i++) {
tmp_val = '';
dev_opt = $('#destination_' + dev_fld[i])[0];
for (var n = 0; n < dev_opt.length; n++) {
if (n > 0) {
tmp_val += ',';
}
tmp_val += dev_opt.options[n].value;
}
datas += dev_fld[i] + '=' + tmp_val + '&';
}
;
}
// ----------------------- Server.model form ----------------
if ($(this).data('id') === 'model_add') {
var dev_cmd = 'model_add';
// var dev_fld = ["model","vendor","dns","buttons","loadimage","loadinformationid","validate","enabled"];
var dev_fld = ["model", "vendor", "dns", "buttons", "loadimage", "loadinformationid", "nametemplet"];
datas = 'enabled=0' + '&';
for (var i = 0; i < dev_fld.length; i++) {
datas = datas + dev_fld[i] + '=' + $('#new_' + dev_fld[i]).val() + '&';
}
;
// $("#add_new_model").modal('hide');
}
if ($(this).data('id') === 'model_applay') {
var dev_cmd = 'model_update';
var dev_fld = ["model", "loadimage", "nametemplet"];
datas = '';
for (var i = 0; i < dev_fld.length; i++) {
datas = datas + dev_fld[i] + '=' + $('#editd_' + dev_fld[i]).val() + '&';
}
;
// $("#edit_model").modal('hide');
}
if (($(this).data('id') === 'model_enabled') || ($(this).data('id') === 'model_disabled')) {
var dev_cmd = $(this).data('id');
var datas = '';
var i = 0;
$('table').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'model[' + i + ']=' + entry['model'] + '&';
i++;
});
}
// ----------------------- form ----------------
if ($(this).data('id') === 'create-cnf') {
var dev_cmd = 'create_hw_tftp';
}
if ($(this).data('id') === 'delete_hardware') {
var dev_cmd = $(this).data('id');
var datas = '';
var i = 0;
$('table').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'idn[' + i + ']=' + entry['name'] + '&';
i++;
});
if (!confirm(_('Are you sure you wish to delete selected device ?'))) {
dev_cmd = '';
}
}
if ($(this).data('id') === 'reset_dev') {
var dev_cmd = $(this).data('id');
var datas = '';
var i = 0;
$('table').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
i++;
});
if (datas === '') {
if (confirm('Resaet All device')) {
datas = 'name[0]=all';
} else {
dev_cmd = '';
}
}
}
if (dev_cmd !== '') {
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
data: datas,
success: function (data) {
// console.log(data);
if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.reload === true) {
location.reload();
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
}
});
$('#cr_sccp_phone_xml').on('click', function (e) {
// console.log("asasdasdasdasd");
// console.log($('#update-sccp-phone').find(':selected').data('val'));
});
});
//$("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 Enabled / Disabled butons ( 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);
});
$("table").on('check.bs.table', function (e, row) {
var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () {
$(this).removeAttr('disabled');
});
// console.log('Table select ' + id_fld);
});
$("table").on('uncheck.bs.table', function (e, row) {
var id_fld = $(this).data('id');
var id_count = $("table").bootstrapTable('getAllSelections').length;
if (id_count < 1) {
$(".btn-tab-select").each(function () {
$(this).attr('disabled', true);
});
}
// console.log('Table unselect ' + id_count);
});
$("table").on('uncheck-all.bs.table', function (rows) {
var id_fld = $(this).data('id');
var id_count = $("table").bootstrapTable('getAllSelections').length;
if (id_count < 1) {
$(".btn-tab-select").each(function () {
$(this).attr('disabled', true);
});
}
// console.log('Table unselect all' + id_fld);
});
//
$("table").on("post-body.bs.table", function () {
// console.log('Table ');
$(this).find(".clickable.delete").click(function () {
var id = $(this).data("id");
// console.log(id);
if (confirm(_("Are you sure you wish to delete this extension?"))) {
$.post("ajax.php", {command: "delete", module: "core", extensions: [id], type: "extensions"}, function (data) {
if (data.status) {
delete(extmap[id]);
$(".ext-list-sccp").bootstrapTable('remove', {
field: "name",
values: [id.toString()]
});
toggle_reload_button("show");
} else {
alert(data.message);
}
});
}
});
});
function load_oncliсk(e, data) {
// console.log('load_oncliсk');
var add_softkey = false;
var add_btn = false;
if (typeof e.href === 'undefined') {
add_softkey = false;
if (data == '*new*') {
add_softkey = true;
add_btn = true;
}
} else {
if (e.href.indexOf('#edit_softkeys')) {
add_softkey = true;
}
}
if (add_softkey) {
var dev_fld = ['onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat',
'onhint', 'onstealable', 'holdconf'];
if (add_btn) {
document.getElementById("new_keySetname").disabled = false;
data = 'SoftKeyset';
} else {
var datas = $('#softkey-all').bootstrapTable('getRowByUniqueId', data);
}
document.getElementById("new_keySetname").value = data;
document.getElementById("new_keySetname").disabled = !add_btn;
var opts = '';
var opts_idx = -1;
for (var i = 0; i < dev_fld.length; i++) {
opts = $('#destination_' + dev_fld[i] + ' option');
if (opts.length > 0) { // Remove all
$(opts).remove();
$('#source_' + dev_fld[i]).append($(opts).clone());
}
if (!add_btn) {
sv_data = datas[dev_fld[i]].split("<br>");
opts = $('#source_' + dev_fld[i] + ' option');
for (var n = 0; n < sv_data.length; n++) {
opts_idx = -1;
for (var j = 0; j < opts.length; j++) {
if (opts[j].value === sv_data[n]) {
opts_idx = j;
}
}
if (opts_idx => 0) {
$('#destination_' + dev_fld[i]).append($(opts[opts_idx]).clone());
$(opts[opts_idx]).remove();
}
}
}
}
}
}
function delete_oncliсk(e, data) {
var dev_cmd = '';
var datas = '';
if (e.href.indexOf('#delete_softkeys') > 0) {
dev_cmd = 'deleteSoftKey';
datas = "softkey=" + data;
}
if (e.href.indexOf('#delete_model') > 0) {
dev_cmd = 'model_delete';
datas = "model=" + data;
}
if (e.href.indexOf('#delete_hardware') > 0) {
dev_cmd = 'delete_hardware';
datas = "idn[0]=" + data;
}
// console.log("delete : " + data);
if (confirm(_('Are you sure you wish to delete "' + data.toUpperCase() + '" inormation ?'))) {
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
data: datas,
success: function (data) {
// console.log(data);
if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.reload === true) {
location.reload();
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
}
}
function add_dynamic_input(pe, pclass, vdefault) {
// We'd like a new one, please.
pcls = pe.data('for');
pname = pe.data('id');
jdata = JSON.parse(hex2bin(pe.data('json')));
var last = $("."+pcls+":last"),
ourid = last.data('nextid'),
nextid = ourid + 1;
var html = "<div class = '" + pcls +" 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 += "</div>\n";
last.after(html);
}
var theForm = document.editIax;
/* Insert a iax_setting/iax_value pair of text boxes */
(function ($) {
//Moves selected item(s) from sourceList to destinationList
$.fn.moveToList = function (sourceList, destinationList) {
var opts = $(sourceList + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
$(destinationList).append($(opts).clone());
};
//Moves all items from sourceList to destinationList
$.fn.moveAllToList = function (sourceList, destinationList) {
var opts = $(sourceList + ' option');
if (opts.length == 0) {
alert("Nothing to move");
}
$(destinationList).append($(opts).clone());
};
//Moves selected item(s) from sourceList to destinationList and deleting the
// selected item(s) from the source list
$.fn.moveToListAndDelete = function (sourceList, destinationList) {
var opts = $(sourceList + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
$(opts).remove();
$(destinationList).append($(opts).clone());
};
//Moves all items from sourceList to destinationList and deleting
// all items from the source list
$.fn.moveAllToListAndDelete = function (sourceList, destinationList) {
var opts = $(sourceList + ' option');
if (opts.length == 0) {
alert("Nothing to move");
}
$(opts).remove();
$(destinationList).append($(opts).clone());
};
//Removes selected item(s) from list
$.fn.removeSelected = function (list) {
var opts = $(list + ' option:selected');
if (opts.length == 0) {
alert("Nothing to remove");
}
$(opts).remove();
};
//Moves selected item(s) up or down in a list
$.fn.moveUpDown = function (list, btnUp, btnDown) {
var opts = $(list + ' option:selected');
if (opts.length == 0) {
alert("Nothing to move");
}
if (btnUp) {
opts.first().prev().before(opts);
} else if (btnDown) {
opts.last().next().after(opts);
}
};
})(jQuery);
/*
String.prototype.hex2bin = function()
{
var i = 0, len = this.length, result = "";
//Converting the hex string into an escaped string, so if the hex string is "a2b320", it will become "%a2%b3%20"
for(; i < len; i+=2)
result += '%' + this.substr(i, 2);
return unescape(result);
}
*/
function hex2bin(hex)
{
var bytes = [], str;
for(var i=0; i< hex.length-1; i+=2)
bytes.push(parseInt(hex.substr(i, 2), 16));
return String.fromCharCode.apply(String, bytes);
}

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

@ -0,0 +1,222 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.0.A
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'context',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'description',
"musicclass" => 'musicclass',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup'
);
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => _("Sccp"),
"description" => _("Sccp Device")
);
}
public function addDevice1($id, $settings) {
$sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value']='';
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
$sql = 'INSERT INTO sccpline (name, id';
$sqlv = 'values ("'.$id.'", "'.$id.'"';
foreach($this->data_fld as $key => $val) {
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
$sql .= ', '.$key;
$sqlv .= ", '".$settings[$val]['value']."' ";
}
}
}
$sql .= ") ".$sqlv.");";
$sth = $this->database->prepare($sql);
$sth->execute();
return true;
}
public function delDevice($id) {
$sql = "DELETE FROM sccpline WHERE id = ?";
$sth = $this->database->prepare($sql);
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
$sccp_line = array();
$sql = "SELECT id";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
$sql .= " FROM sccpline WHERE id = ?";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result;
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"pin" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "",
"flag" => $flag++
),
"context" => array(
"value" => "from-internal",
"flag" => $flag++
),
"callgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
"pickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"transfer" => array(
"value" => "yes",
"flag" => $flag++
),
"adhocNumber" => array(
"value" => "",
"flag" => $flag++
),
"echocancel" => array(
"value" => "no",
"flag" => $flag++
),
"dnd" => array(
"value" => "no",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "no",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("Settings");
$category = "general";
$tmparr = array();
$tt = _("The SCCP channel number for this port.");
$tmparr['incominglimit'] = array('prompttext' => _('Line incoming limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
$tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing.");
$tmparr['context'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1);
$tt = _("Phone call group callgroup=1,3-4");
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Phone pickup group pickupgroup=1,3-4");
$tmparr['namedcallgroup'] = array('prompttext' => _('Call group name'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("sets the named caller groups this line is a member of (ast111)");
$tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Phone pincode");
$tmparr['namedpickupgroup'] = array('prompttext' => _('Pickup group name'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Sets the named pickup groups this line is a member of (this phone can pickup calls from remote phones which are in this caller group (ast111)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1);
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Allow call transfer.");
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Echo calcel");
$tmparr['echocancel'] = array('prompttext' => _('Echo calcel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'UserDefined', 'text' => 'UserDefined');
$tt = _("Do Not Disturb.");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'user', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression.");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){
$moh_list = music_list();
} else {
$moh_list = array('default');
}
foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
$tt = _("Musik On Hold ");
$tmparr['musicclass'] = array('prompttext' => _('Musik On Hold'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1);
$devopts = $tmparr;
return $devopts;
}
}

50
conf/sccp.conf Normal file
View file

@ -0,0 +1,50 @@
;=========================================================================================
;
; general definitions
;
;=========================================================================================
[general]
servername=VPBXSCCP
keepalive=60
debug=1
context=from-internal-xfer
bindaddr=0.0.0.0
port=2000
deny=0.0.0.0/0.0.0.0
permit=0.0.0.0/0.0.0.0
dateformat=D.M.Y
disallow=all
allow=alaw
allow=ulaw
firstdigittimeout=16
digittimeout=8
autoanswer_ring_time=1
autoanswer_tone=0x32
remotehangup_tone=0x32
transfer_tone=0
callwaiting_tone=0x2d
musicclass=default
language=en
echocancel=on
silencesuppression=off
private=on
directed_pickup_modeanswer=on
callanswerorder=oldestfirst
sccp_tos=0x68
sccp_cos=4
audio_tos=0xB8
audio_cos=6
video_tos=0x88
video_cos=5
hotline_enabled=yes
hotline_context=default
hotline_extension=111
devicetable=sccpdevice
linetable=sccpline
[KeySet1] ; Managed by sccp_manager
type=softkeyset
onhook=redial,newcall,cfwdall,dnd,pickup,gpickup,private
connected=hold,endcall,park,select,cfwdall,cfwdbusy
onhold=newcall

59
functions.inc.php Normal file
View file

@ -0,0 +1,59 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
function removeSimpleXmlNode($node)
{
$dom = dom_import_simplexml($node);
$dom->parentNode->removeChild($dom);
}
function replaceSimpleXmlNode($xml, SimpleXMLElement $element) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),TRUE
);
$dom->parentNode->replaceChild($import, $dom);
}
*/
function after($this, $inthat) {
if (!is_bool(strpos($inthat, $this)))
return substr($inthat, strpos($inthat, $this) + strlen($this));
}
function after_last($this, $inthat) {
if (!is_bool(strrevpos($inthat, $this)))
return substr($inthat, strrevpos($inthat, $this) + strlen($this));
}
function before($this, $inthat) {
return substr($inthat, 0, strpos($inthat, $this));
}
function before_last($this, $inthat) {
return substr($inthat, 0, strrevpos($inthat, $this));
}
function between($this, $that, $inthat) {
return before($that, after($this, $inthat));
}
function between_last($this, $that, $inthat) {
return after_last($this, before_last($that, $inthat));
}
function strrevpos($instr, $needle) {
$rev_pos = strpos(strrev($instr), strrev($needle));
if ($rev_pos === false)
return false;
else
return strlen($instr) - $rev_pos - strlen($needle);
}
?>

249
install.php Normal file
View file

@ -0,0 +1,249 @@
<?php
if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
global $db;
global $amp_conf;
global $version;
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
$table_req = array('sccpdevice', 'sccpline', 'buttonconfig', 'sccpdeviceconfig');
$sql = <<< END
CREATE TABLE IF NOT EXISTS `sccpsettings` (
`keyword` VARCHAR (50) NOT NULL default '',
`data` VARCHAR (255) NOT NULL default '',
`seq` TINYINT (1),
`type` TINYINT (1) NOT NULL default '0',
PRIMARY KEY (`keyword`,`seq`,`type`)
)
END;
$ss = FreePBX::create()->Sccp_manager;
outn(_("checking for requery Sccp_manager table.."));
foreach ($table_req as $value) {
$check = $db->getRow("SELECT 1 FROM `$value` LIMIT 0", DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) {
// print_r("none, creating table :". $value);
out(_("none, Can't fient table: " . $value));
out(_("none, Plz. Open chai-sccp/conf directory to create DB scheme"));
die(_("none, creating table: " . $value));
}
}
$version = FreePBX::Config()->get('ASTVERSION');
outn(_("checking Version : ").$version);
if (!empty($version)) {
// Woo, we have a version
if (version_compare($version, "12.2.0", ">=")) {
$ver_compatable = true;
}
} else {
// Well. I don't know what version of Asterisk I'm running.
// Assume less than 12.
$ver_compatable = false;
die('Versin is not comapable');
}
out(_("none, creating table"));
$check = $db->query($sql);
// sql($sql);
if (db::IsError($check)) {
die_freepbx("Can not create sccpdevmodel table\n");
}
$sql = "CREATE TABLE IF NOT EXISTS `sccpdevmodel` (
`model` varchar(20) NOT NULL DEFAULT '',
`vendor` varchar(40) DEFAULT '',
`dns` int(2) DEFAULT '1',
`buttons` int(2) DEFAULT '0',
`loadimage` varchar(40) DEFAULT '',
`loadinformationid` VARCHAR(30) NULL DEFAULT NULL,
`enabled` INT(2) NULL DEFAULT '0',
`nametemplet` VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (`model`),
KEY `model` (`model`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1";
$check = $db->query($sql);
if (db::IsError($check)) {
die_freepbx("Can not create sccpsettings table\n");
}
if ($db->getAll('SHOW COLUMNS FROM sccpdevice WHERE FIELD = "pickupexten"')) {
out(_("none, modify table from old scheme"));
$sql = "ALTER TABLE `sccpdevice`
CHANGE COLUMN `pickupexten` `directed_pickup` VARCHAR(5) NULL DEFAULT 'yes',
CHANGE COLUMN `pickupcontext` `directed_pickup_context` VARCHAR(100) NULL DEFAULT '' ,
CHANGE COLUMN `pickupmodeanswer` `directed_pickup_modeanswer` VARCHAR(5) NULL DEFAULT 'yes'";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
if (!$db->getAll('SHOW COLUMNS FROM sccpdevmodel WHERE FIELD = "loadinformationid"')) {
out(_("none, modify table from old scheme"));
$sql = "ALTER TABLE `sccpdevmodel` ADD `loadinformationid` varchar(30);";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
if (!$db->getAll('SHOW COLUMNS FROM sccpdevmodel WHERE FIELD = "nametemplet"')) {
out(_("none, modify table from old scheme"));
$sql = "ALTER TABLE `sccpdevmodel` ADD COLUMN `enabled` INT(2) NULL DEFAULT '0', ADD COLUMN `nametemplet` VARCHAR(50) NULL DEFAULT NULL,";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
if (!$db->getAll('SHOW COLUMNS FROM sccpdevice WHERE FIELD = "hwlang"')) {
out(_("none, modify table from old scheme"));
$sql = "ALTER TABLE `sccpdevice` ADD COLUMN `hwlang` varchar(12) NULL DEFAULT NULL,
ADD COLUMN `useRedialMenu` VARCHAR(5) NULL DEFAULT 'no' AFTER `hwlang`
";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
if (!$db->getAll('SHOW COLUMNS FROM sccpdevice WHERE FIELD = "dtmfmode"')) {
out(_("none, modify table from old scheme"));
$sql = "ALTER TABLE `sccpdevice` ADD COLUMN `dtmfmode` varchar(10) default NULL";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
if (!$db->getAll('SHOW COLUMNS FROM sccpline WHERE FIELD = "adhocNumber"')) {
out(_("none, modify sccpline table from old scheme"));
$sql = "ALTER TABLE `sccpline`
ADD COLUMN `namedcallgroup` VARCHAR(45) NULL DEFAULT NULL AFTER `setvar`,
ADD COLUMN `namedpickupgroup` VARCHAR(45) NULL DEFAULT NULL AFTER `namedcallgroup`,
ADD COLUMN `adhocNumber` VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`,
ADD COLUMN `meetme` VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`,
ADD COLUMN `meetmenum` VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`,
ADD COLUMN `meetmeopts` VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`,
ADD COLUMN `regexten` VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`;";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not add loadinformationid into sccpdevmodel table\n");
}
}
out(_("none, Uptade Table Info"));
//$sql = "REPLACE INTO `sccpdevmodel` VALUES ('7925','CISCO',1,1,'',''),('7902','CISCO',1,1,'CP7902080002SCCP060817A','loadInformation30008'),('7905','CISCO',1,1,'CP7905080003SCCP070409A','loadInformation20000'),('7906','CISCO',1,1,'SCCP11.8-3-1S','loadInformation369'),('7910','CISCO',1,1,'P00405000700','loadInformation6'),('7911','CISCO',1,1,'SCCP11.8-3-1S','loadInformation307'),('7912','CISCO',1,1,'CP7912080003SCCP070409A','loadInformation30007'),('7914','CISCO',0,14,'S00105000300','loadInformation124'),('7920','CISCO',1,1,'cmterm_7920.4.0-03-02','loadInformation30002'),('7921','CISCO',1,1,'CP7921G-1.0.3','loadInformation365'),('7931','CISCO',1,1,'SCCP31.8-3-1S','loadInformation348'),('7936','CISCO',1,1,'cmterm_7936.3-3-13-0','loadInformation30019'),('7937','CISCO',1,1,'','loadInformation431'),('7940','CISCO',1,2,'P00308000500','loadInformation8'),('Digital Access+','CISCO',1,1,'D00303010033','loadInformation42'),('7941','CISCO',1,2,'P00308000500','loadInformation115'),('7941G-GE','CISCO',1,2,'P00308000500','loadInformation309'),('7942','CISCO',1,2,'P00308000500','loadInformation434'),('Digital Access','CISCO',1,1,'D001M022','loadInformation40'),('7945','CISCO',1,2,'P00308000500','loadInformation435'),('7960','CISCO',3,6,'P00308000500','loadInformation7'),('7961','CISCO',3,6,'P00308000500','loadInformation30018'),('7961G-GE','CISCO',3,6,'P00308000500','loadInformation308'),('7962','CISCO',3,6,'P00308000500','loadInformation404'),('7965','CISCO',3,6,'P00308000500','loadInformation436'),('7970','CISCO',3,8,'SCCP70.8-3-1S','loadInformation30006'),('7971','CISCO',3,8,'SCCP70.8-3-1S','loadInformation119'),('7975','CISCO',3,8,'SCCP70.8-3-1S','loadInformation437'),('7985','CISCO',3,8,'cmterm_7985.4-1-4-0','loadInformation302'),('ATA 186','CISCO',1,1,'ATA030203SCCP051201A','loadInformation12'),('IP Communicator','CISCO',1,1,'','loadInformation30016'),('12 SP','CISCO',1,1,'','loadInformation3'),('12 SP+','CISCO',1,1,'','loadInformation2'),('30 SP+','CISCO',1,1,'','loadInformation1'),('30 VIP','CISCO',1,1,'','loadInformation5'),('7914,7914','CISCO',0,28,'S00105000300','loadInformation124'),('7915','CISCO',0,14,'',''),('7916','CISCO',0,14,'',''),('7915,7915','CISCO',0,28,'',''),('7916,7916','CISCO',0,28,'',''),('CN622','MOTOROLA',1,1,'','loadInformation335'),('ICC','NOKIA',1,1,'',''),('E-Series','NOKIA',1,1,'',''),('3911','CISCO',1,1,'','loadInformation446'),('3951','CISCO',1,1,'','loadInformation412');";
$sql = "REPLACE INTO `sccpdevmodel` (`model`, `vendor`, `dns`, `buttons`, `loadimage`, `loadinformationid`, `enabled`, `nametemplet`) 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, 0, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL), ('6911', 'CISCO', 1, 0, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL), ('6921', 'CISCO', 1, 0, 'SCCP69xx.9-2-1-0', 'loadInformation496', 0, NULL), ('6941', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation495', 0, NULL), ('6945', 'CISCO', 1, 0, 'SCCP6945.9-2-1-0', 'loadInformation564', 0, NULL), ('6961', 'CISCO', 1, 0, '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-2-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7910', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7911', 'CISCO', 1, 1, 'SCCP11.9-2-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', 'loadInformation227', 1, NULL), ('7915,7915', 'CISCO', 0, 48, 'B015-1-0-4', 'loadInformation228', 1, NULL), ('7916', 'CISCO', 0, 24, 'B015-1-0-4', 'loadInformation229', 1, NULL), " .
"('7916,7916', 'CISCO', 0, 48, 'B016-1-0-4', 'loadInformation230', 1, NULL), ('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL), ('7921', 'CISCO', 1, 1, 'CP7921G-1.4.1SR1', 'loadInformation365', 0, NULL),('7925', 'CISCO', 1, 2, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, NULL), ('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-4-0', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'), ('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_796x_template'), " .
"('7941', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7942', 'CISCO', 1, 2, 'SCCP42.9-2-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7945', 'CISCO', 1, 2, 'SCCP45.9-2-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_796x_template'), ('7961', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7962', 'CISCO', 3, 6, 'SCCP42.9-2-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7965', 'CISCO', 3, 6, 'SCCP45.9-2-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7970', 'CISCO', 3, 8, 'SCCP70.9-2-1S', 'loadInformation30006', 0, NULL), ('7971', 'CISCO', 1, 2, 'SCCP75.9-2-1S', 'loadInformation119', 0, NULL), ('7975', 'CISCO', 3, 8, 'SCCP75.9-2-1S', 'loadInformation437', 0, NULL), ('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL), ('8941', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation586', 0, NULL), ('8945', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation585', 0, NULL), ('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, NULL), ('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, NULL), ('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), " .
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 0, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not REPLACE defaults into sccpdevmodel table\n");
}
$sql = "ALTER TABLE sccpline
ALTER COLUMN incominglimit SET DEFAULT '2',
ALTER COLUMN transfer SET DEFAULT 'on',
ALTER COLUMN vmnum SET DEFAULT '*97',
ALTER COLUMN musicclass SET DEFAULT 'default',
ALTER COLUMN echocancel SET DEFAULT 'on',
ALTER COLUMN silencesuppression SET DEFAULT 'off',
CHANGE COLUMN `dnd` `dnd` VARCHAR(12) NULL DEFAULT 'off'
";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not modify sccpline table\n");
}
$sql = "ALTER TABLE sccpdevice
ALTER COLUMN transfer SET DEFAULT 'on',
ALTER COLUMN cfwdall SET DEFAULT 'on',
ALTER COLUMN cfwdbusy SET DEFAULT 'on',
ALTER COLUMN dtmfmode SET DEFAULT 'outofband',
ALTER COLUMN dndFeature SET DEFAULT 'on',
ALTER COLUMN directrtp SET DEFAULT 'off',
ALTER COLUMN earlyrtp SET DEFAULT 'progress',
ALTER COLUMN mwilamp SET DEFAULT 'on',
ALTER COLUMN mwioncall SET DEFAULT 'on',
ALTER COLUMN private SET DEFAULT 'on',
ALTER COLUMN privacy SET DEFAULT 'off',
ALTER COLUMN nat SET DEFAULT 'off',
ALTER COLUMN softkeyset SET DEFAULT 'softkeyset'
";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not modify sccpdevice table\n");
}
$sql = "DROP TRIGGER IF EXISTS trg_buttonconfig;
DELIMITER $$
CREATE TRIGGER trg_buttonconfig BEFORE INSERT ON buttonconfig
FOR EACH ROW
BEGIN
IF NEW.`type` = 'line' THEN
IF (SELECT COUNT(*) FROM `sccpline` WHERE `sccpline`.`name` = SUBSTRING_INDEX(NEW.`name`,'!',1)) = 0
THEN
UPDATE `Foreign key contraint violated: line does not exist in sccpline` SET x=1;
END IF;
END IF;
END$$
DELIMITER ;";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not modify sccpdevice table\n");
}
$sql = "CREATE OR REPLACE
ALGORITHM = MERGE
VIEW sccpdeviceconfig AS
SELECT GROUP_CONCAT( CONCAT_WS( ',', buttonconfig.type, buttonconfig.name, buttonconfig.options )
ORDER BY instance ASC
SEPARATOR ';' ) AS button, sccpdevice.*
FROM sccpdevice
LEFT JOIN buttonconfig ON ( buttonconfig.device = sccpdevice.name )
GROUP BY sccpdevice.name;";
$sql = "CREATE OR REPLACE
ALGORITHM = MERGE
VIEW sccpdeviceconfig AS
SELECT GROUP_CONCAT( CONCAT_WS( ',', buttonconfig.type, buttonconfig.name, buttonconfig.options )
ORDER BY instance ASC
SEPARATOR ';' ) AS button,
`sccpdevice`.`type` AS `type`,`sccpdevice`.`addon` AS `addon`,`sccpdevice`.`description` AS `description`,`sccpdevice`.`tzoffset` AS `tzoffset`,
`sccpdevice`.`transfer` AS `transfer`,`sccpdevice`.`cfwdall` AS `cfwdall`,`sccpdevice`.`cfwdbusy` AS `cfwdbusy`,`sccpdevice`.`imageversion` AS `imageversion`,
`sccpdevice`.`deny` AS `deny`,`sccpdevice`.`permit` AS `permit`,`sccpdevice`.`dndFeature` AS `dndFeature`,`sccpdevice`.`directrtp` AS `directrtp`,
`sccpdevice`.`earlyrtp` AS `earlyrtp`,`sccpdevice`.`mwilamp` AS `mwilamp`,`sccpdevice`.`mwioncall` AS `mwioncall`,`sccpdevice`.`directed_pickup` AS `directed_pickup`,
`sccpdevice`.`directed_pickup_context` AS `directed_pickup_context`,`sccpdevice`.`directed_pickup_modeanswer` AS `directed_pickup_modeanswer`,
`sccpdevice`.`private` AS `private`,`sccpdevice`.`privacy` AS `privacy`,`sccpdevice`.`nat` AS `nat`,`sccpdevice`.`softkeyset` AS `softkeyset`,
`sccpdevice`.`audio_tos` AS `audio_tos`,`sccpdevice`.`audio_cos` AS `audio_cos`,`sccpdevice`.`video_tos` AS `video_tos`,`sccpdevice`.`video_cos` AS `video_cos`,
`sccpdevice`.`conf_allow` AS `conf_allow`,`sccpdevice`.`conf_play_general_announce` AS `conf_play_general_announce`,
`sccpdevice`.`conf_play_part_announce` AS `conf_play_part_announce`,`sccpdevice`.`conf_mute_on_entry` AS `conf_mute_on_entry`,
`sccpdevice`.`conf_music_on_hold_class` AS `conf_music_on_hold_class`,`sccpdevice`.`conf_show_conflist` AS `conf_show_conflist`,
`sccpdevice`.`setvar` AS `setvar`,`sccpdevice`.`disallow` AS `disallow`,`sccpdevice`.`allow` AS `allow`,`sccpdevice`.`backgroundImage` AS `backgroundImage`,
`sccpdevice`.`ringtone` AS `ringtone`,`sccpdevice`.`name` AS `name`,`sccpdevice`.`dtmfmode` AS `dtmfmode`,`sccpdevice`.`useRedialMenu` AS `useRedialMenu`
FROM sccpdevice
LEFT JOIN buttonconfig ON ( buttonconfig.device = sccpdevice.name )
GROUP BY sccpdevice.name;";
$check = $db->query($sql);
if (DB::IsError($check)) {
die_freepbx("Can not modify sccpdevice table\n");
}
// $ss->save_submit($request);
// $ss->sccp_create_sccp_init();
// $ss->sccp_db_save_setting();
//}

21
module.xml Normal file
View file

@ -0,0 +1,21 @@
<module>
<rawname>sccp_manager</rawname>
<name>SCCP Manager</name>
<version>13.0.0.1</version>
<type>setup</type>
<category>SCCP Connectivity</category>
<publisher>Alex GP</publisher>
<description>SCCP Phone and Extention Manager</description>
<menuitems>
<sccpsettings sort="1">SCCP Server Config</sccpsettings>
<sccp_phone sort="2">SCCP Phones Manager</sccp_phone>
</menuitems>
<changelog>
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
</changelog>
<location></location>
<supported>
<version>13.0.0.1</version>
</supported>
<md5sum></md5sum>
</module>

49
page.sccp_phone.php Normal file
View file

@ -0,0 +1,49 @@
<?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
// License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2015 Sangoma Technologies.
//
// vim: set ai ts=4 sw=4 ft=php:
// SccpSettings page. Re-written for usage with chan_sccp
// AGPL v3 Licened
// Note that BEFORE THIS IS CALLED, the Sipsettings configPageinit
// function is called. This is where you do any changes. The page.foo.php
// is only for DISPLAYING things. MVC is a cool idea, ya know?
//
$spage = FreePBX::create()->Sccp_manager;
$display_page = $spage->PhoneShowPage();
$display_info = _("SCCP Phone Manager");
?>
<div class="container-fluid">
<h1><?php echo $display_info?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach($display_page as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach($display_page as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>

42
page.sccpsettings.php Normal file
View file

@ -0,0 +1,42 @@
<?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
// License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2015 Sangoma Technologies.
// vim: set ai ts=4 sw=4 ft=php:
// SccpSettings page. Re-written for usage with chan_sccp
// AGPL v3 Licened
//
$spage = FreePBX::create()->Sccp_manager;
?>
<div class="container-fluid">
<h1><?php echo _("SCCP Server Settings")?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach($spage->myShowPage() as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach($spage->myShowPage() as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>

31
uninstall.php Normal file
View file

@ -0,0 +1,31 @@
<?php
/* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
global $db;
$version = FreePBX::Config()->get('ASTVERSION');
echo "dropping table sccpdevmodel..";
sql("DROP TABLE IF EXISTS `sccpdevmodel`");
echo "dropping table sccpsettings..";
sql("DROP TABLE IF EXISTS `sccpsettings`");
if (!empty($version)) {
// Woo, we have a version
if (version_compare($version, "14.0.0", "<=")) {
echo "Deleting key FROM kvstore..";
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'");
}
/* DROP VIEW `sccpdeviceconfig`;
DROP TABLE `buttonconfig`;
DROP TABLE `sccpdevice`;
DROP TABLE `sccpdevmodel`;
DROP TABLE `sccpline`;
DROP TABLE `sccpsettings`;
*
*/
}
echo "done<br>\n";
?>

57
views/form.adddevice.php Normal file
View file

@ -0,0 +1,57 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$def_val = null;
$dev_id = null;
if (!empty($_REQUEST['id'])) {
// print_r($_REQUEST);
//
// get model Info
$dev_id = $_REQUEST['id'];
$db_res = $this->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
foreach ($db_res as $key => $val) {
if (!empty($val)) {
switch ($key) {
case 'name':
$key = 'mac';
$val = str_replace('SEP', '', $val);
break;
case 'hwlang':
$tmpar = explode(":",$val);
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
break;
case 'permit':
case 'deny':
$def_val[$key . '_net'] = array("keyword" => $key, "data" => before('/', $val), "seq" => "99");
$key = $key . '_mask';
$val = after('/', $val);
break;
}
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
}
}
}
?>
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="adddevice_form">
<input type="hidden" name="Submit" value="Submit">
<?php
if (empty($dev_id)){
echo '<input type="hidden" name="sccp_deviceid" value="new">';
echo $this->ShowGroup('sccp_hw_dev', 1, 'sccp_hw_', $def_val);
} else {
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
echo $this->ShowGroup('sccp_hw_dev_edit', 1, 'sccp_hw_', $def_val);
}
echo $this->ShowGroup('sccp_hw_dev2', 1, 'sccp_hw_', $def_val);
echo $this->ShowGroup('sccp_hw_dev_advance', 1, 'sccp_hw_', $def_val);
echo $this->ShowGroup('sccp_hw_dev_conference', 1, 'sccp_hw_', $def_val);
echo $this->ShowGroup('sccp_hw_dev_network', 1, 'sccp_hw_', $def_val);
?>
</form>

201
views/form.buttons.php Normal file
View file

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

523
views/formShow.php Normal file
View file

@ -0,0 +1,523 @@
<?php
/*
* IE - Text Input
* IED - Text Input Dynamic
* IS - Radio box
* SL - Select element
* Input element Select SLD - Date format
* SLZ - Time Zone
* SLZN - Time Zone List
* SLT - TFTP Lang
* SLM - Music on hold
* SLK - System KeySet
* * Input element Select SLS - System Language
* Input element Select SDM - Model List
* SDE - Extension List
*/
$npref = $form_prefix.'_';
$napref = $form_prefix.'-ar_';
if (empty($form_prefix)){
$npref = "sccp_";
$napref ="sccp-ar_";
}
$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",
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
$mysql_table = array("sccpdevice","sccpdeviceconfig");
$time_zone_name = timezone_identifiers_list();
$time_zone = array("-12", "-11", "-10", "-09", "-08", "-07", "-06", "-05", "-04", "-03", "-02", "-01", "00",
"01","02","03","04","05","06","07","08","09","10","11","12");
if (\FreePBX::Modules()->checkStatus("soundlang")) {
$syslangs = \FreePBX::Soundlang()->getLanguages();
if (!is_array($syslangs)) {
$syslangs = array();
}
}
if (function_exists('music_list')){
$moh_list = music_list();
// $cur = (isset($mohsilence) && $mohsilence != "" ? $mohsilence : 'default');
}
if (!is_array($moh_list)){
$moh_list = array('default');
}
$sofkey_list = \FreePBX::Sccp_manager()-> sccp_list_keysets();
$model_list = \FreePBX::Sccp_manager()->get_db_SccpTableData("HWDevice");
$extension_list = \FreePBX::Sccp_manager()->get_db_SccpTableData("HWextension");
$extension_list[]=array(model=>'none', vendor=>'CISCO', dns=>'0');
$items = $itm -> children();
//print_r($sofkey_list);
//print_r($syslangs);
//print_r($moh_list);
if ($h_show==1) {
?>
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
</div>
<div class="section" data-id="<?php echo $npref.$itm['name'];?>">
<?php
}
foreach ($items as $child) {
if ($child['type'] == 'IE') {
$res_input = '';
$res_name = '';
$res_id = $npref.$child->input[0]->name;
if (empty($child->nameseparator)) {
$child->nameseparator = ' / ';
}
$i = 0;
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9">
<?php
foreach ($child->xpath('input') as $value) {
$res_n = (string)$value->name;
$res_name = $npref . $res_n;
if (empty($res_id)) {
$res_id = $res_name;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$value->value = $fvalues[$res_n]['data'];
}
}
if (empty($value->value)) {
$value->value = $value->default;
}
if (empty($value->type)) {
$value->type = 'text';
}
if (empty($value->class)) {
$value->class = 'form-control';
}
if ($i > 0) echo $child->nameseparator;
//
echo '<input type="' . $value->type . '" class="' . $value->class . '" id="' . $res_id . '" name="' . $res_name . '" value="' . $value->value.'"';
if (isset($value->options)){
foreach ($value->options ->attributes() as $optkey =>$optval){
echo ' '.$optkey.'="'.$optval.'"';
}
}
if (!empty($value->min)) echo ' min="'.$value->min.'"';
if (!empty($value->max)) echo ' max="'.$value->max.'"';
echo '>';
$i ++;
}
?>
</div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'IED') {
$res_input = '';
$res_name = '';
$res_n = (string)$child->name;
// $res_value
$lnhtm = '';
$res_id = $napref.$child->name;
$i = 0;
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_value = explode(';', $fvalues[$res_n]['data']);
}
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
// $res_value = explode('/', (string) $child->default);
}
echo '<!-- Begin '.$child->label.' -->';
?>
<!--Local Networks-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"><div class = "col-sm-7">
<?php
foreach ($res_value as $dat_v) {
?>
<div class = "<?php echo $res_id;?> form-group form-inline" data-nextid=<?php echo $i+1;?> >
<?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'];
if (!empty($value->class)) {
$opt_at[$fields_id]['class']='form-control ' .(string)$value->class;
}
$opt_at[$fields_id]['nameseparator']=(string)$value['nameseparator'];
echo '<input type="text" name="'. $res_n.'" class="'.$opt_at[$fields_id]['class'].'" value="'.$res_vf[$i2].'"';
if (isset($value->options)){
foreach ($value->options ->attributes() as $optkey =>$optval){
$opt_at[$fields_id]['options'][$optkey]=(string)$optval;
echo ' '.$optkey.'="'.$optval.'"';
}
}
echo '> '.(string)$value['nameseparator'].' ';
$i2 ++;
}
echo '</div>';
$i++;
}
?>
</div>
<div class = "col-sm-5">
<?php
// print_r($opt_at);
// print_r(json_encode($opt_at));
// print_r(bin2hex(json_encode($opt_at)));
echo '<input type="button" id="'.$res_id.'-btn" data-id="'.$res_id.'" data-for="'.$res_id.'"data-json="'.bin2hex(json_encode($opt_at)).'" class="input-js-add" value="'._($child->button).'" />';
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'IS') {
$res_n = (string)$child->name;
$res_id = $npref.$child->name;
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"><div class="form-group">
<div class="col-md-3 radioset">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9 radioset">
<?php
$i = 0;
// $res_v = 'no';
if (empty($child->default)) {
$res_v = 'no';
} else {
$res_v = (string)$child->default;
}
if (!empty($child->value)) {
$res_v = (string)$child->value;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_v = (string)$fvalues[$res_n]['data'];
}
}
foreach ($child->xpath('button') as $value) {
echo '<input type="radio" name="' . $res_id . '" id="' . $res_id. '_' . $i .'" value="' . $value[@value] . '"' . (strtolower((string)$value[@value]) == strtolower($res_v) ? " checked" : "") . '>';
echo '<label for="' . $res_id. '_' . $i . '">' . $value . '</label>';
$i++;
}
?>
</div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SLD - Date format
* SLZ - Time Zone
* SLT - TFTP Lang
* SLM - Music on hold
* SLK - System KeySet
*/
if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK'|| $child['type'] == 'SLZ' || $child['type'] == 'SLZN') {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
if ($child['type'] == 'SLD') {
$select_opt= $day_format;
}
// if ($child['type'] == 'SLT') {
// $select_opt= $tftp_lang;
// }
if ($child['type'] == 'SLM') {
$select_opt= $moh_list;
}
if ($child['type'] == 'SLK') {
$select_opt= $sofkey_list;
}
if ($child['type'] == 'SLZ') {
$select_opt= $time_zone;
}
if ($child['type'] == 'SLZN') {
$select_opt= $time_zone_name;
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"><div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
foreach ($select_opt as $key) {
echo '<option value="' . $key . '"';
if ($key == $child->value) {
echo ' selected="selected"';
}
echo '>' . $key . '</option>';
}
?> </select>
</div></div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SLS - System Language
*/
if ($child['type'] == 'SLS' || $child['type'] == 'SLT') {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if ($child['type'] == 'SLS') {
$select_opt= $syslangs;
}
if ($child['type'] == 'SLT') {
$select_opt= $tftp_lang;
}
if (empty($child->class)) {
$child->class = 'form-control';
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <!-- <div class = "lnet form-group form-inline" data-nextid=1> --> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
foreach ($select_opt as $key => $val) {
echo '<option value="' . $key . '"';
if ($key == $child->value) {
echo ' selected="selected"';
}
echo '>' . $val. '</option>';
}
?> </select>
<!-- </div> --> </div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<!--END System Language-->
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select
*/
if ($child['type'] == 'SL') {
$res_n = (string)$child->name;
$res_id = $npref.$child->name;
if (empty($child ->class)) {
$child->class = 'form-control';
}
echo '<!-- Begin '.$child->label.' -->';
?>
<!--System Language-->
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
foreach ($child->xpath('select') as $value) {
if (!empty($value[@value])) {
$key = $value[@value];
} else {
$key = (string)$value;
}
echo '<option value="' . $key . '"';
if (strtolower((string)$key) == strtolower((string)$child->value)) {
echo ' selected="selected"';
}
echo '>' . (string)$value. '</option>';
}
?> </select>
</div> </div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<!--END System Language-->
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SDM - Model List
* SDE - Extension List
*/
if ($child['type'] == 'SDM' || $child['type'] == 'SDE' ) {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
if ($child['type'] == 'SDM') {
$select_opt= $model_list;
}
if ($child['type'] == 'SDE') {
$select_opt= $extension_list;
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"><div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
$fld = (string)$child->select['name'];
$flv = (string)$child->select;
$flk = (string)$child->select['dataid'];
$flkv= (string)$child->select['dataval'];
$key = (string)$child->default;
foreach ($select_opt as $data) {
echo '<option value="' . $data[$fld] . '"';
if ($key == $data[$fld]) {
echo ' selected="selected"';
}
if (!empty($flk)){
echo ' data-id="'.$data[$flk].'"';
}
if (!empty($flkv)){
echo ' data-val="'.$data[$flkv].'"';
}
echo '>' . $data[$flv] . '</option>';
}
?> </select>
</div></div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
}
?>
<?php
if ($h_show==1) {
echo '</div>';
}
?>

5
views/formShowError.php Normal file
View file

@ -0,0 +1,5 @@
<div class="element-container"> <div class="row"> <div class="form-group">
<div class="col-md-3"> <label class="control-label" for="ERROR">Error Load form config </label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i>
</div></div></div></div>

View file

@ -0,0 +1,39 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
// vim: set ai ts=4 sw=4 ft=phtml:
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<h1><?php echo _("Extensions (Line)") ?></h1>
<div id="toolbar-sccp-extension">
<a class="btn btn-default" href="config.php?display=extensions&amp;tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
<button id="remove-sccp-extension" class="btn btn-danger btn-remove" data-type="extensions" data-section="sccp-extension" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&amp;command=getExtensionGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
<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-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<script>
function DispayPhoneActionsKeyFormatter(value, row, index) {
return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
</script>

68
views/hardware.phone.php Normal file
View file

@ -0,0 +1,68 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
// vim: set ai ts=4 sw=4 ft=phtml:
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<h1><?php echo _("Device Phone") ?></h1>
<div id="toolbar-sccp-phone">
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
<button name="cr_sccp_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
</button>
<button name="reset_sccp_phone" class="btn sccp_update btn-default" data-id="reset_dev">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="true" data-field="mac"><?php echo _('MAC') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Descr') ?></th>
<th data-sortable="true" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="false" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th>
<th data-sortable="false" data-field="status"><?php echo _('Status') ?></th>
<th data-sortable="false" data-field="address"><?php echo _('Address') ?></th>
<th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<script>
function DispayDeviceActionsKeyFormatter(value, row, index) {
var exp_model = '';
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '<a href="#delete_hardware" onclick="delete_oncliсk(this, &quot;'+row['name']+'&quot;)"><i class="fa fa-trash"></i></a>';
return exp_model;
}
function LineFormatter(value, row, index) {
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
return result;
}
</script>

849
views/sccpgeneral.xml Normal file
View file

@ -0,0 +1,849 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<root>
<page_group name="sccp_hidden"><label>SCCP Hiden Server config</label>
<item type="IE" id="1" seq="10"><label>Phone ssh login</label>
<input>
<name>dev_sshUserId</name>
<default>cisco</default>
</input>
<help>Help.</help>
</item>
<item type="IE" id="1" seq="10"><label>Phone ssh password</label>
<input>
<name>dev_sshPassword</name>
<default>cisco</default>
</input>
<help>Help.</help>
</item>
<item type="IE" id="1" seq="10"><label>Phone protocol</label>
<input>
<name>dev_deviceProtocol</name>
<default>SCCP</default>
</input>
<help>Help.</help>
</item>
</page_group>
<page_group name="sccp_general">
<label>SCCP Server config</label>
<item type="DS" id="1"><label>Display</label>
<help>Help.</help>
</item>
<item type="IE" id="2"><label>SCCP Server Name</label>
<input>
<name>servername</name>
<default>Vt</default>
</input>
<help>Servername: This is the type of server - usually, it will be Asterisk.</help>
</item>
<item type="IE" id="3"> <label>Bind Address : [ Port ]</label>
<input>
<name>bindaddr</name>
<default>0.0.0.0</default>
<class>sccp-custom</class>
</input>
<input>
<name>port</name>
<default>2000</default>
<class>sccp-custom</class>
</input>
<help>Bind Address: The address to bind to for SCCP. In general, it should be set to '0.0.0.0'. If you find problems with one-way audio, you can set this to a specific address in the server. Note that '127.0.0.1' is always wrong here.</help>
<nameseparator> : </nameseparator>
</item>
<item type="IE" id="4"> <label>External Ip</label>
<input>
<name>externip</name>
<default></default>
<class>sccp-custom</class>
<options placeholder="Provider IP"></options>
</input>
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help>
<nameseparator> / </nameseparator>
</item>
<item type="IE" id="5"><label>SCCP SERVER Keepalive</label>
<input>
<name>keepalive</name>
<default>60</default>
<class>sccp-custom</class>
<type>number</type>
<options min="60" max="300"></options>
</input>
<help>Time between Keep Alive checks. Valid range is 60-300 seconds. After much trial-and-error, the minimum (60) seems to work just fine.</help>
</item>
<item type="IS" id="6"><name>debug</name> <label>SCCP DEBUG</label>
<default>none</default>
<button value="none">No</button>
<button value="core">Core</button>
<button value="sccp">SCCP</button>
<button value="device">Device</button>
<button value="all">All</button>
<help>Debug: Enable debugging level in SCCP module.</help>
</item>
</page_group>
<page_group name="sccp_net"><label>SCCP Networks</label>
<item type="IED" id="1" seq="0">
<label>Alow Networks / Mask</label>
<name>permit</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}$"/></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<button>Add Alow network</button>
<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>
<button>Add Deny network</button>
<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="3" seq="0">
<label>Local Networks / Mask </label>
<name>localnet</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>
<button>Add local networks</button>
<help>All RFC 1918 addresses are local networks, example '192.168.1.0/255.255.255.0'</help>
</item>
</page_group>
<page_group name="sccp_lang"><label>SCCP Language</label>
<item type="SLS" id="1"><label>SCCP System Language</label>
<name>language</name>
<default>English</default>
<select></select>
<help>SCCP Language: This is the language for your hints and other features of the phone. If you don't have any languages installed or are using a single language, you can leave this blank.</help>
</item>
<item type="SLT" id="2"><label>SCCP Network Device Language</label>
<name>netlang</name>
<default>English_United_States</default>
<select></select>
<help>The Network locales allows the phone to play tones (ringing, busy etc.) native to the phone's country.</help>
</item>
<item type="SLT" id="3"><label>SCCP Phone Device Language</label>
<name>devlang</name>
<default>Russian_Russia</default>
<select> </select>
<help>The user locale allows the phone to display text (menu items, soft keys etc.) native to the phone's language. </help>
</item>
</page_group>
<page_group name="sccp_dev_config"><label>SCCP Device config</label>
<item type="IE" id="1"> <label>First Digit Timeout</label>
<input>
<name>firstdigittimeout</name>
<default>16</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="120"></options>
</input>
<help>First Digit Timeout: The amount of time after your first digit to start dialing automatically. This can be over-ridden with settings in your dialplan.xml or by using the 'immediate dial' button.</help>
</item>
<item type="IE" id="2"> <label>Digit Timeout</label>
<input>
<name>digittimeout</name>
<default>8</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="120"></options>
</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>Autoanswer Ring Time</label>
<input>
<name>autoanswer_ring_time</name>
<default>0</default>
<class>sccp-custom</class>
<type>number</type>
<options min="0" max="120"></options>
</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="8"><name>echocancel</name> <label>Echo Cancel</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Echo Cancel: Echo Cancellation (On or Off).</help>
</item>
<item type="IS" id="9"><name>silencesuppression</name> <label>Silence Suppression</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Silence Suppression: Slience Suppression on the phone.</help>
</item>
<item type="IS" id="10"><name>private</name> <label>Private Calling</label>
<default>yes</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Private Calling Enabled: Place a call with privacy Options (no Caller ID) turned on. Needs to be supported in Asterisk to work through SIP and DAHDI trunks.</help>
</item>
<item type="IS" id="11"><name>directed_pickup_modeanswer</name> <label>Directed Pickup</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</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="12"><name>callanswerorder</name> <label>Call Answer Order</label>
<default>oldestfirst</default>
<button value="oldestfirst">Oldestfirst</button>
<button value="latestfirst">Latestfirst</button>
<help>Call Answer Order: Which call should be answered first? The most common choice is "oldestfirst", but other orders are supported.</help>
</item>
<item type="IS" id="13"><name>mwilamp</name> <label>Message Lamp</label>
<default>on</default>
<button value="on">ON</button>
<button value="off">OFF</button>
<button value="wink">Wink</button>
<button value="flash">Flash</button>
<button value="blink">Blink</button>
<help> Set the MWI lamp style when MWI active to on, off, wink, flash or blink</help>
</item>
<item type="IS" id="14"><name>mwioncall</name> <label>Message Lamp On Call</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Set the MWI on call.</help>
</item>
</page_group>
<page_group name="sccp_dev_ntp"><label>SCCP NTP Service config</label>
<item type="IS" id="1" seq="98"><name>ntp_config_enabled</name> <label>NTP Server Enabled</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Enabling NTP settings in device configuration.</help>
</item>
<item type="IE" id="2" seq="10"><label>NTP Server name (ip)</label>
<input>
<name>ntp_server</name>
<default>pool.ntp.org</default>
<value>pool.ntp.org</value>
</input>
<help>Help.</help>
</item>
<item type="IS" id="3" seq="10"><name>ntp_server_mode</name> <label>Call Answer Order</label>
<default>unicast</default>
<button value="unicast">Unicast</button>
<button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button>
<button value="manycast">Manycast</button>
<help>.</help>
</item>
</page_group>
<page_group name="sccp_dev_time"><label>SCCP Time Service config</label>
<item type="SLD" id="1" seq="1"><label>Display Day Format</label>
<name>dateformat</name>
<select>
<default>D.M.Y</default>
</select>
<help>Date Format: The date format for the on-screen display. Can be one of the following: (D-M-YA, M.D.Y, Y/M/D) where 'D' is Day, 'M' is Month, 'Y' is Year, 'A' is 24-hour, 'a' is 12-hour, and the separators can be '.','-','/'"</help>
</item>
<item type="SLZN" id="2" seq="95"><label>Time Zone</label>
<name>ntp_timezone</name>
<select>
<default>UTC</default>
</select>
<help></help>
</item>
</page_group>
<page_group name="sccp_dev_url">
<label>SCCP URL Service config</label>
<item type="IE" id="1" seq="10"><label>Phone Service URL</label>
<input>
<name>dev_servicesURL</name>
<default></default>
<value></value>
<options placeholder="http://x.x.x.x/cisco_menu/authentication.php"></options>
</input>
<help>Help.</help>
</item>
<item type="IE" id="2" seq="10"><label>Phone authentication URL</label>
<input>
<name>dev_authenticationURL</name>
<options placeholder="http://x.x.x.x/cisco_menu/authentication.php"></options>
<default></default>
<value></value>
</input>
<help>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/authentication.php"></options>
<default></default>
<value></value>
</input>
<help>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/authentication.php"></options>
<default></default>
</input>
<help>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/cisco_menu/authentication.php"></options>
<default></default>
</input>
<help>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/authentication.php"></options>
<default></default>
</input>
<help>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/authentication.php"></options>
<default></default>
<value></value>
</input>
<help>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.</help>
</item>
</page_group>
<page_group name="sccp_qos_config"> <label>SCCP QoS config</label>
<item type="IE" id="1"> <label>SCCP ToS / CoS</label>
<input>
<name>sccp_tos</name>
<default>0x68</default>
<class>sccp-custom</class>
</input>
<input>
<name>sccp_cos</name>
<default>0x4</default>
<class>sccp-custom</class>
</input>
<help>SCCP Type Of Service / Class Of Service: SCCP Type or Class of Service - this is modifiable, but don't.</help>
</item>
<item type="IE" id="2"> <label>SCCP Audio ToS / CoS</label>
<input>
<name>audio_tos</name>
<default>0xB8</default>
<class>sccp-custom</class>
</input>
<input>
<name>audio_cos</name>
<default>0x6</default>
<class>sccp-custom</class>
</input>
<help>Audio Type Of Service / Class Of Service: Audio Type or Class of Service - this is modifiable, but don't.</help>
</item>
<item type="IE" id="3"> <label>SCCP Video ToS / CoS</label>
<input>
<name>video_tos</name>
<default>0x88</default>
<class>sccp-custom</class>
</input>
<input>
<name>video_cos</name>
<default>0x5</default>
<class>sccp-custom</class>
</input>
<help>Video Type Of Service / Class Of Service: Video Type or Class of Service - this is modifiable, but don't.</help>
</item>
</page_group>
<page_group name="sccp_hotline_config"><label>SCCP Line config</label>
<item type="IS" id="1"><name>hotline_enabled</name> <label>Hotline</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<help>Hotline Enabled: This allows unregistered extensions to connect to the system and dial the number listed below.</help>
</item>
<item type="IE" id="2"><label>Hotline extension</label>
<input>
<name>hotline_extension</name>
<default>*111</default>
<class>sccp-custom</class>
</input>
<help>Hotline Extension: The number that gets called when a hotline is picked up. hint</help>
</item>
<item type="IE" id="3"><label>Hotline Context</label>
<input>
<name>hotline_context</name>
<default>defauly</default>
<class>sccp-custom</class>
</input>
<help>Hotline Context: This is the context through which the phone will connect. It should probably match your other contest. The default is "from-internal" but "from-internal-xfer" would also make sense by limiting the options for the person using the phone.</help>
</item>
<item type="IE" id="4"><label>System Context</label>
<input>
<name>context</name>
<default>from-internal</default>
<class>sccp-custom</class>
</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="SLM" id="6"><label>Music On Hold Class</label>
<name>musicclass</name>
<default>none</default>
<select></select>
<class>form-control</class>
<help>Music Class: Available MOH Classes. These are the MOH classes listed in your current server.</help>
</item>
<item type="IS" id="7" seq="98"><name>autoselectline_enabled</name> <label>Autoselect Line</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<help>Help.</help>
</item>
<item type="IS-disabled" id="8" seq="0"><name>meetme</name> <label>Meetme Conference</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<help>enable/disable conferencing via meetme (on/off), make sure you have one of the meetme apps mentioned below activated in module.conf</help>
</item>
<item type="IS-disabled" id="9" seq="0"><label>Meetme Options</label>
<input>
<name>meetmeopts</name>
<default>qxd</default>
<class>sccp-custom</class>
</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>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<help>Help.</help>
</item>
<item type="IS" id="11" seq="98"><name>backgroundImageAccess</name> <label>Background Image</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">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 take.</help>
</item>
</page_group>
<page_group name="sccp_extpath_config"><label>SCCP Server Path config</label>
<item type="IE" id="1" seq="2"><label>SCCP TFTP SERVER Path</label>
<input>
<name>tftp_path</name>
<default>/tftpboot</default>
<class>sccp-custom</class>
</input>
<help>Help.</help>
</item>
<item type="SL" id="2"><label>SCCP SERVER MySQL Device Table Name</label>
<name>devicetable</name>
<default>sccpdevice</default>
<select>sccpdevice</select>
<select>sccpdeviceconfig</select>
<class>sccp-custom</class>
<help>Device Table: This is the devicetable 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. There are two reasonable settings for this - the sccpdevice table or the sccpdeviceconfig view. If you do not want to use the realtime database anymore, you can set this to blank. NOT RECOMMENDED.</help>
</item>
<item type="IE" id="3"><label>SCCP SERVER MySQL Line Table Name</label>
<input>
<name>linetable</name>
<default>sccpline</default>
<class>sccp-custom</class>
</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>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Help.</help>
</item>
</page_group>
<!-- Form add/ edit device -->
<page_group name="sccp_hw_dev"><label>General Device configuration</label>
<item type="IE" id="1" seq="99"><label>Device ID SEP.[XXXXXXXXXXXX]=MAC</label>
<input>
<name>mac</name>
<default>000000000</default>
<class>sccp-custom</class>
</input>
<help>The MAC address of the phone</help>
</item>
<item type="SDM" id="2" seq="99">
<label>Type</label>
<name>type</name>
<default>7911</default>
<select name="model" dataid="dns" dataval="buttons">model</select>
<class>hw_select sccp-custom</class>
<help>The type of phone: 7911, 7940, 7960, etc. Important note: the 'G' models are handled as the base model (e.g., 7962G is handled as 7962). In the Display mode, this field is read-only because the MAC address and the model number are a pair.</help>
</item>
<item type="SDE" id="3" seq="99">
<label>Addon</label>
<name>addon</name>
<default>none</default>
<select name="model" dataval="buttons">model</select>
<class>hw_select sccp-custom</class>
<help>Addon:Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_edit">
<label>General Device configuration</label>
<item type="IE" id="1" seq="99"><label>Device ID SEP.</label>
<input>
<name>mac</name>
<default>000000000</default>
<class>sccp-custom</class>
<options readonly="readonly"></options>
</input>
<help>The MAC address of the phone</help>
</item>
<item type="IE" id="2" seq="99">
<label>Type</label>
<input>
<name>type</name>
<default>79XX</default>
<class>sccp-custom</class>
<options readonly="readonly"></options>
</input>
<help>The type of phone: 7911, 7940, 7960, etc. Important note: the 'G' models are handled as the base model (e.g., 7962G is handled as 7962). In the Display mode, this field is read-only because the MAC address and the model number are a pair.</help>
</item>
<item type="IE" id="3" seq="99">
<label>Addon</label>
<input>
<name>addon</name>
<default>none</default>
<class>sccp-custom</class>
<options readonly="readonly"></options>
</input>
<help>Addon:Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev2">
<label>Device configuration</label>
<item type="IE" id="1" seq="99"><label>Device Label</label>
<input>
<name>description</name>
<default>000000000</default>
<class>sccp-custom</class>
</input>
<help>The information in the upper right corner of the device screen</help>
</item>
<item type="SLK" id="2" seq="99"><label>Soft key set</label>
<name>softkeyset</name>
<default>default</default>
<select></select>
<help>Help.</help>
</item>
<item type="SLZ" id="3" seq="98"><label>Time Zone offset</label>
<name>tzoffset</name>
<default>00</default>
<select></select>
<help>Time zone offset</help>
</item>
<item type="SLT" id="4" seq="98"><label>SCCP Network Device Language</label>
<name>netlang</name>
<default>English_United_States</default>
<select></select>
<help>The Network locales allows the phone to play tones (ringing, busy etc.) native to the phone's country.</help>
</item>
<item type="SLT" id="5" seq="98"><label>SCCP Phone Device Language</label>
<name>devlang</name>
<default>Russian_Russia</default>
<select> </select>
<help>The user locale allows the phone to display text (menu items, soft keys etc.) native to the phone's language. </help>
</item>
<item type="IE" id="6" seq="99"><label>Background Image</label>
<input>
<name>backgroundImage</name>
<default></default>
<class>sccp-custom</class>
</input>
<help>For phones that can display background images - display this one. Default is [empty]</help>
</item>
<item type="IE" id="7" seq="99"><label>Ringtone</label>
<input>
<name>ringtone</name>
<default></default>
<class>sccp-custom</class>
</input>
<help>The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provice the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ directory with the rest of the config files.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_button"><label>Buttons Configuration</label>
<item type="IE" id="1" seq="99"><label>Device MAC SEP.</label>
<input>
<name>mac</name>
<default>000000000</default>
<class>sccp-custom</class>
</input>
<help>Help.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_advance"><label>Device Properies</label>
<item type="IS" id="1" seq="99"><name>transfer</name> <label>Call Transfer</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Transfer allowed</help>
</item>
<item type="IS" id="2" seq="99"><name>cfwdall</name> <label>Callforward softkeys</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Activate the callforward softkeys. Default is On</help>
</item>
<item type="IS" id="3" seq="99"><name>cfwdbusy</name> <label>Callforward busy softkeys</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Activate the callforward busy softkeys. Default is On</help>
</item>
<item type="IS" id="4" seq="99"><name>useRedialMenu</name>
<label>Redial from Menu </label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>You can specifying 'useRedialMenu = yes' in the sccp.conf device section and the redial softkey will cause the "placed calls" list instead of immediately calling the last dialed number.</help>
</item>
<item type="IS" id="5" seq="99"><name>dndFeature</name>
<label>DND Button on Device</label>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Do Not Disturb. Default is Off</help>
</item>
<item type="IS" id="6" seq="99">
<name>dtmfmode</name>
<label>Dual-Tone Multi-Frequency</label>
<default>outofband</default>
<button value="outofband">outofband</button>
<button value="inband">inband</button>
<help>Dual-Tone Multi-Frequency: outofband is the native cisco dtmf tone play</help>
</item>
<item type="IS" id="7" seq="99"> <name>mwilamp</name>
<label>Message Lamp</label>
<default>on</default>
<button value="on">ON</button>
<button value="off">OFF</button>
<button value="wink">Wink</button>
<button value="flash">Flash</button>
<button value="blink">Blink</button>
<help> Set the MWI lamp style when MWI active to on, off, wink, flash or blink</help>
</item>
<item type="IS" id="8" seq="99"><name>directed_pickup</name> <label>Pickup Exten</label>
<default>yes</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>Enable Pickup function to direct pickup an extension. Default is On</help>
</item>
<item type="IS" id="9" seq="99"><name>directed_pickup_modeanswer </name> <label>Pickup Mode Answer</label>
<default>yes</default>
<button value="yes">On</button>
<button value="no">Off</button>
<help>On (Default)= the call has been answered when picked up. Off = call manager way, the phone who picked up the call rings the call</help>
</item>
<item type="IE" id="10" seq="99"><label>Pickup Context</label>
<input>
<name>directed_pickup_context</name>
<default></default>
<class>sccp-custom</class>
</input>
<help>Context where direct pickup search for extensions. if not set current contect will be use.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_conference">
<label>Device Conference Function</label>
<item type="IS" id="1" seq="99">
<name>conf_allow</name>
<label>Enabled Conference function</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Allow the use of conference</help>
</item>
<item type="IS" id="2" seq="99">
<name>conf_play_general_announce</name>
<label>Playback General Announcements </label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Playback General Announcements (like: 'You are Entering/Leaving the conference')</help>
</item>
<item type="IS" id="3" seq="99">
<name>conf_play_part_announce</name>
<label>Playback Personal Announcements</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Playback Personal/Participant Announcements, (like: 'You have been muted / You have been kicked')</help>
</item>
<item type="IS" id="4" seq="99">
<name>conf_mute_on_entry</name>
<label>Mute on start</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Mute new participants from the start</help>
</item>
<item type="IS" id="5" seq="99">
<name>conf_show_conflist</name>
<label>Show conference list</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Automatically show conference list to the moderator</help>
</item>
<item type="SLM" id="6" seq="99"><label>Music On Hold Class</label>
<name>conf_music_on_hold_class</name>
<default>default</default>
<select></select>
<class>form-control</class>
<help>Play music on hold of this class when no moderator is listening on the conference. If set to an empty string, no music on hold will be played.</help>
</item>
</page_group>
<page_group name="sccp_hw_dev_network">
<label>Device Network Function</label>
<item type="IE" id="1" seq="99"> <label>Alow Networks / Mask </label>
<input>
<name>permit_net</name>
<default>0.0.0.0</default>
<class>sccp-custom</class>
</input>
<input>
<name>permit_mask</name>
<default>0.0.0.0</default>
<class>sccp-custom</class>
</input>
<help>Local network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
<nameseparator> / </nameseparator>
</item>
<item type="IE" id="2" seq="99"> <label>Deny Networks / Mask </label>
<input>
<name>deny_net</name>
<default>0.0.0.0</default>
<class>sccp-custom</class>
</input>
<input>
<name>deny_mask</name>
<default>0.0.0.0</default>
<class>sccp-custom</class>
</input>
<help>IP deny: IP Address deny netmask. Should always be at least '0.0.0.0/0.0.0.0'.</help>
<nameseparator> / </nameseparator>
</item>
<item type="IS" id="3" seq="99">
<name>nat</name>
<label>NAT Device</label>
<default>off</default>
<button value="off">off</button>
<button value="on">on</button>
<help>Device NAT support (default Off)</help>
</item>
<item type="IS" id="4" seq="99">
<name>directrtp</name>
<label>Directrtp Device</label>
<default>off</default>
<button value="off">off</button>
<button value="on">on</button>
<help>This option allow devices to do direct RTP sessions (default Off)</help>
</item>
<item type="IS" id="5" seq="99">
<name>earlyrtp</name>
<label>Early Rtp Device</label>
<default>progress</default>
<button value="progress">Progress</button>
<button value="offhook">Offhook</button>
<button value="dial">Dial</button>
<button value="none">none</button>
<help>The audio strem will be open in the progress and connected state. Valid options: none, progress, offhook, dial, ringout. Default may be Progress.</help>
</item>
</page_group>
</root>

116
views/server.codec.php Normal file
View file

@ -0,0 +1,116 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$def_val = null;
$dev_id = null;
$sccp_codec = $this->getCodecs('audio', true);
if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id'];
$db_res = $this->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
if (!empty($db_res['allow'])) {
$i = 1;
foreach(explode(',', $db_res['allow']) as $c){
$codec_list[$c] = $i;
$i ++;
}
foreach ($sccp_codec as $c => $v) {
if (!isset($codec_list[$c])) {
$codec_list[$c] = false;
}
}
}
} else {
$codec_list = $sccp_codec;
}
?>
<form autocomplete="off" name="frm_codec" id="frm_codec" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="codecform">
<input type="hidden" name="Submit" value="Submit">
<!--SCCP Audio Codecs-->
<div class="section-title" data-for="sccp_acodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Codecs") ?></h3>
</div>
<div class="section" data-id="sccp_acodecs">
<!--Codecs-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("SCCP Audio Codecs (allow)") ?></label>
</div>
<div class="col-md-9">
<?php echo \show_help(_("This is the default Codec setting for SCCP Device.")) ?>
<?php
$seq = 1;
echo '<ul class="sortable">';
foreach ($codec_list as $codec => $codec_state) {
$codec_trans = _($codec);
$codec_checked = $codec_state ? 'checked' : '';
echo '<li><a href="#">'
. '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> '
. '<input type="checkbox" '
. ($codec_checked ? 'value="' . $seq++ . '" ' : '')
. 'name="voicecodecs[' . $codec . ']" '
. 'id="' . $codec . '" '
. 'class="audio-codecs" '
. $codec_checked
. ' />'
. '&nbsp;&nbsp;<label for="' . $codec . '"> '
. '<small>' . $codec_trans . '</small>'
. " </label></a></li>\n";
}
echo '</ul>';
?>
</div>
</div>
</div>
</div>
</div>
</div>
<!--END Codecs-->
<!--Codec disallow-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="sccp_disallow"><?php echo _("Codec Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div>
<div class="col-md-9 radioset">
<input id="sccp_disallow" type="text" name="sccp_disallow" value="<?php echo $this->sccpDefaults[disallow] ?>">
<label for="sccp_disallow"><?php echo _("default : " . $this->sccpDefaults[disallow]) ?></label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Defaut : all. Plz eneter format: alaw,ulaw") ?></span>
</div>
</div>
</div>
<!--END Codec disallow-->
<!--END SCCP Audio Codecs-->
</div>
</form>

19
views/server.datetime.php Normal file
View file

@ -0,0 +1,19 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<form autocomplete="off" name="frm_ntp" id="frm_ntp" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="ntpform">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->ShowGroup('sccp_dev_ntp',1);
echo $this->ShowGroup('sccp_dev_time',1);
?>
</form>

19
views/server.device.php Normal file
View file

@ -0,0 +1,19 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<form autocomplete="off" name="frm_device" id="frm_device" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="deviceform">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->ShowGroup('sccp_dev_config',1);
echo $this->ShowGroup('sccp_dev_url',1);
echo $this->ShowGroup('sccp_hotline_config',1);
?>
</form>

174
views/server.keyset.php Normal file
View file

@ -0,0 +1,174 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<');
// ------------------------------------- Key Set Value ---------------------------------------------------------
$keysetarray = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'),
'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'),
'onhold' => array('resume','newcall','endcall','transfer','conflist','select','dirtrfr','idivert','meetme'),
'ringin' => array('answer','endcall','transvm','idivert'),
'offhook' => array('redial','endcall','private','cfwdall','cfwdbusy','pickup','gpickup','meetme','barge'),
'conntrans' => array('hold','endcall','transfer','conf','park','select','dirtrfr','vidmode','meetme','cfwdall','cfwdbusy'),
'digitsfoll' => array('back','endcall','dial'),
'connconf' => array('conflist','newcall','endcall','hold','vidmode'),
'ringout' => array('empty','endcall','transfer','cfwdall','idivert'),
'offhookfeat'=> array('redial','endcall'),
'onhint' => array('redial','newcall','pickup','gpickup','barge'),
'onstealable'=> array('redial','newcall','cfwdall','pickup','gpickup','dnd','intrcpt'),
'holdconf' => array('resume','newcall','endcall','join'),
'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.')
);
// print_r($this->sccp_list_keysets());
// echo "<br><br>";
// print_r($this->sccp_conf_init);
?>
<form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="keysetform">
<input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&amp;command=getSoftKey&amp;type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 9 ){
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
$i ++;
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
<!-- Begin Form Input New / Edit -->
<div class="modal fade edit_new_keyset" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel2">
<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>
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div>
<div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div><div class="col-md-9">
<input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
</div></div></div>
<ul class="nav nav-tabs" role="tablist">
<?php
$i = 0;
foreach ($keysetarray as $key => $value) {
if ($i == 0) {
echo '<li role="presentation" data-name="'.$key.'" class="active">';
} else {
echo '<li role="presentation" data-name="'.$key.'" class="change-tab">';
}
echo '<a href="#'.$key.'" aria-controls="'.$key.'" role="tab" data-toggle="tab">'._($key);
echo '</a></li>';
$i ++;
}
?>
</ul>
<div class="tab-content display">
<?php
$i = 0;
foreach ($keysetarray as $key => $value) {
if ($i == 0) {
echo '<div role="tabpanel" id="'.$key.'" class="tab-pane active">';
} else {
echo '<div role="tabpanel" id="'.$key.'" class="tab-pane">';
}
echo '<div class="element-container"><div class="row"><div class="form-group"><div class="col-md-3"><label class="control-label" for="'.$key.'">'._($keynamearray[$key]['name']).'</label>';
echo '<i class="fa fa-question-circle fpbx-help-icon" data-for="'.$key.'"></i></div>';
echo '<div class="col-md-4"><select multiple class="form-control sccpmultiselect" name="av_'.$key.'" id="source_'.$key.'">';
foreach ($value as $data) {
echo '<option value="'.$data.'">'.$data.'</option>';
}
echo '</select></div><div class="col-md-1">';
foreach ($keymultiselect as $btkey =>$btval) {
echo '<input type="button" class="btnMultiselect" data-id="'.$key.'" data-key="'.$btkey.'" value="'.$btval.'">';
}
echo '</div><div class="col-md-4"><select multiple class="form-control" name="sel_'.$key.'" id="destination_'.$key.'">';
echo '</select></div></div></div><div class="row"><div class="col-md-12">';
echo '<span id="'.$key.'-help" class="help-block fpbx-help-block">'._($keynamearray[$key]['help']).'</span>';
echo '</div></div></div></div>';
$i ++;
}
?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="keyset_add" data-mode="new" id="keyset_add" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
var exp_model = '';
if (row['softkeys'] !== 'default') {
// exp_model += '<a href="#edit_softkeys" class="btn btn-info" onclick="load_oncliсk(this, &quot;'+row['softkeys']+'&quot;)" data-toggle="modal" data-target=".edit_new_keyset"><i class="fa fa-pencil"></i></a>';
// exp_model += '<a href="#delete_softkeys" class="btn btn-danger" onclick="delete_oncliсk(this,&quot;'+row['softkeys']+'&quot;)"><i class="fa fa-trash"></i></a>';
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;';
exp_model += '<a href="#delete_softkeys" onclick="delete_oncliсk(this,&quot;'+row['softkeys']+'&quot;)"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
</script>

249
views/server.model.php Normal file
View file

@ -0,0 +1,249 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<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>
<button data-id="model_disabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" disabled data-section="all">
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disabled') ?></span>
</button>
<button data-id="model_enabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" disabled data-section="all">
<i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enabled') ?></span>
</button>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<BtnCaption class="dropdown_capture"><?php echo _('Show Enabled') ?></BtnCaption>
<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>
</ul>
</div>
</div>
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&amp;command=getDeviceModel&amp;type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="false" data-formatter="StatusIconFormatter" data-field="enabled"><?php echo _('Eabled') ?></th>
<th data-sortable="true" data-field="model"><?php echo _('Device Model') ?></th>
<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-field="loadimage"><?php echo _('Loadimage') ?></th>
<th data-sortable="false" data-field="loadinformationid"><?php echo _('Loadinformation ID') ?></th>
<th data-sortable="false" data-field="nametemplet"><?php echo _('Model templet') ?></th>
<th data-field="actions" data-formatter="DispayActionsModelFormatter"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<!-- Begin Form Input New -->
<div class="modal fade add_new_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<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>
<h4 class="modal-title" id="gridSystemModalLabel">Modal title</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">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">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">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_dns">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">Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0" selected='selected'>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">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">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">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_nametemplet">Model templet XML</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_nametemplet"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="new_nametemplet" name="new_nametemplet" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_nametemplet-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">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="model_add" id="add_new_model" data-dismiss="modal">Add New model whithout Enabled</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="edit_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<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>
<h4 class="modal-title" id="gridSystemModalLabel">Modal title</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="editd_model">Device Model</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_model"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_model" name="editd_model" value="79XX" disabled>
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_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="editd_loadimage">Load Image</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="edit_devimage"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_loadimage" name="editd_loadimage" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_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="editd_nametemplet">Model templet XML</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_nametemplet"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_nametemplet" name="editd_nametemplet" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_nametemplet-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">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="model_applay" data-dismiss="modal">Applay</button>
</div>
</div>
</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', 'No awalable', 'One ExpModule', 'Tow ExpModule'];
return exp_model[value];
}
// function DispayInputFormatter(value, row, index) {
// return (value == null) ? '<input class="tabl-edit form-control" name="' + row['model'] + '_templet" type="text" value="">' : '<input class="tabl-edit form-control" name="' + row['model'] + '_templet" 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="#delete_model" class="btn btn-danger" onclick="delete_oncliсk(this, &quot;'+row['model']+'&quot;)"><i class="fa fa-trash"></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 href="#delete_model" onclick="delete_oncliсk(this, &quot;'+row['model']+'&quot;)"><i class="fa fa-trash"></i></a>';
return exp_model;
}
function SetRowColor(row, index) {
var tclass = "active";
if (row['enabled'] === 1) {
tclass = (index % 2 === 0) ? "info" : "info";
}
if (row['validate'] === 'no') {
tclass = (row['enabled'] === '1') ? "danger" : "warning";
}
return {classes: tclass};
}
function load_model(elmnt,clr) {
// $("#edit_devmodel").text(clr);
var drow = $("#table-models").bootstrapTable('getRowByUniqueId',clr);
if (drow == null) {
alert(drow);
} else {
document.getElementById("editd_model").value = clr;
document.getElementById("editd_loadimage").value = drow['loadimage'];
document.getElementById("editd_nametemplet").value = drow['nametemplet'];
}
}
</script>

51
views/server.setting.php Normal file
View file

@ -0,0 +1,51 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
// vim: set ai ts=4 sw=4 ft=phtml:
// $var_hw_config = $this->get_db_SccpTableData("get_sccpdevice_byid", array('id' => 'SEPB8BEBF224790'));
?>
<form autocomplete="off" name="frm_general" id="frm_general" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="generalform">
<input type="hidden" name="Submit" value="Submit">
<?php
// print_r($this-> sccp_conf_init);
// print_r(@parse_ini_file($this->sccppath["sccp_conf"], true));
// print_r(\FreePBX::LoadConfig()->getConfig('sccp.conf'));
// print_r($this->FreePBX->LoadConfig('sccp.conf'));
// $this->sccp_create_tftp_XML();
// print_r($this->get_db_SccpTableData('SccpDevice'));
// print_r('<br>');
// print_r($this->sccp_get_active_devise());
// print_r(music_list());
// print_r($this->sccppath["sccp_conf"]);
// print_r($this-> getMyConfig('softkeyset'));
/*
$dev_tech ="sccp";
$drivers = FreePBX::Core()->getAllDrivers();
if(isset($drivers[$dev_tech])) {
$devopts = $drivers[$dev_tech]->getDevice('1234');
} else {
$devopts = array();
}
print_r($devopts);
*/
echo $this->ShowGroup('sccp_general',1);
echo $this->ShowGroup('sccp_net',1);
echo $this->ShowGroup('sccp_lang',1);
echo $this->ShowGroup('sccp_qos_config',1);
echo $this->ShowGroup('sccp_extpath_config',1);
// $this->sccp_db_save_setting();
// $this->sccp_create_sccp_init();
?>
</form>