Update SIP device Handling & Fix Issue#53
Fix Issue #53 Consolidate forms to facilitate maintenance, reduce code, and apply changes to SIP handling introduce for sccp Delete form.addsdevice.php Delete form.sbuttons.php Delete sipconfigs class and move db functions to dbinterface class, and other function to helperfunctions create new field type for SIP line update 9951 buttons count in installer simplify segregation of sip and sccp requests
This commit is contained in:
parent
1f73ade196
commit
048077fce8
|
@ -320,11 +320,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$this->pagedata = array(
|
$this->pagedata = array(
|
||||||
"general" => array(
|
"general" => array(
|
||||||
"name" => _("Sip device configuration"),
|
"name" => _("Sip device configuration"),
|
||||||
"page" => 'views/form.addsdevice.php'
|
"page" => 'views/form.adddevice.php'
|
||||||
),
|
),
|
||||||
"buttons" => array(
|
"buttons" => array(
|
||||||
"name" => _("Sip device Buttons"),
|
"name" => _("Sip device Buttons"),
|
||||||
"page" => 'views/form.sbuttons.php'
|
"page" => 'views/form.buttons.php'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -854,11 +854,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
* Create (SEP) dev_ID.cnf.xml
|
* Create (SEP) dev_ID.cnf.xml
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function createSccpDeviceXML($dev_id = '') {
|
function createSccpDeviceXML(string $dev_id) {
|
||||||
|
|
||||||
if (empty($dev_id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$sccp_native = true;
|
$sccp_native = true;
|
||||||
$data_value = array();
|
$data_value = array();
|
||||||
$dev_line_data = null;
|
$dev_line_data = null;
|
||||||
|
@ -868,7 +865,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
if (!empty($dev_config['type'])) {
|
if (!empty($dev_config['type'])) {
|
||||||
if (strpos($dev_config['type'], 'sip') !== false) {
|
if (strpos($dev_config['type'], 'sip') !== false) {
|
||||||
$sccp_native = false;
|
$sccp_native = false;
|
||||||
$tmp_bind = $this->sipconfigs->getSipConfig();
|
$tmp_bind = $this->getSipConfig();
|
||||||
$dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext'));
|
$dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext'));
|
||||||
if (empty($dev_ext_config)){
|
if (empty($dev_ext_config)){
|
||||||
// TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP.
|
// TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP.
|
||||||
|
@ -882,15 +879,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$tmp_line = explode(',', $value);
|
$tmp_line = explode(',', $value);
|
||||||
switch ($tmp_line[0]) {
|
switch ($tmp_line[0]) {
|
||||||
case 'line':
|
case 'line':
|
||||||
$dev_line_data = $this->sipconfigs->get_db_sip_TableData('DeviceById', array('id' => $tmp_line[1]));
|
$dev_line_data = $this->dbinterface->getSipTableData('DeviceById', $tmp_line[1]);
|
||||||
$f_linetype = (explode("/",$dev_line_data['dial'])[0] == 'PJSIP') ? 'pjsip' : 'sip';
|
$f_linetype = ($dev_line_data['sipdriver'] == 'chan_sip') ? 'sip' : 'pjsip';
|
||||||
$dev_line_data['sbind'] = $tmp_bind[$f_linetype];
|
$dev_line_data['sbind'] = $tmp_bind[$f_linetype];
|
||||||
if ((!$this->array_key_exists_recursive('udp', $tmp_bind[$f_linetype])) && (!$this->array_key_exists_recursive('tcp', $tmp_bind[$f_linetype]))) {
|
if ((!$this->array_key_exists_recursive('udp', $tmp_bind[$f_linetype])) && (!$this->array_key_exists_recursive('tcp', $tmp_bind[$f_linetype]))) {
|
||||||
print_r("SIP server configuration error ! Neither UDP nor TCP protocol enabled");
|
die_freepbx(_("SIP server configuration error ! Neither UDP nor TCP protocol enabled"));
|
||||||
die();
|
return false;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($dev_line_data)) {
|
if (!empty($dev_line_data)) {
|
||||||
$data_value['siplines'][] = $dev_line_data;
|
$data_value['siplines'][] = $dev_line_data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1385,6 +1385,82 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
</item>
|
</item>
|
||||||
</page_group>
|
</page_group>
|
||||||
|
|
||||||
|
<page_group name="sccp_hw_sip_dev2">
|
||||||
|
<label>Device configuration</label>
|
||||||
|
<item type="IE" id="1" seq="99">
|
||||||
|
<label>Device Label</label>
|
||||||
|
<input>
|
||||||
|
<name>description</name>
|
||||||
|
<default>000000000</default>
|
||||||
|
<class>sccp-custom</class>
|
||||||
|
<options pattern="[0-9a-zA-Z]+"/>
|
||||||
|
</input>
|
||||||
|
<help>The information in the upper right corner of the device screen. Only English letters and digits !</help>
|
||||||
|
</item>
|
||||||
|
<item type="SDMF" id="1" seq="100">
|
||||||
|
<label>Default Line</label>
|
||||||
|
<name>defaultLine</name>
|
||||||
|
<default></default>
|
||||||
|
<select name="name" addlabel='label' dataid="name" dataval="label">model</select>
|
||||||
|
<class>lineSelect form-control</class>
|
||||||
|
<help>Select the default line for this device</help>
|
||||||
|
</item>
|
||||||
|
<item type="SLK" id="2" seq="99">
|
||||||
|
<label>Soft Keyset</label>
|
||||||
|
<name>softkeyset</name>
|
||||||
|
<default>default</default>
|
||||||
|
<select></select>
|
||||||
|
<help>System Default Softkey</help>
|
||||||
|
</item>
|
||||||
|
<item type="SLZ" id="3" seq="98">
|
||||||
|
<label>Time Zone offset</label>
|
||||||
|
<name>tzoffset</name>
|
||||||
|
<default>00</default>
|
||||||
|
<select></select>
|
||||||
|
<help>Time Zone offset</help>
|
||||||
|
</item>
|
||||||
|
<item type="SLTD" id="5" seq="98">
|
||||||
|
<label>SCCP Phone Device Language</label>
|
||||||
|
<name>devlang</name>
|
||||||
|
<default>English_United_States</default>
|
||||||
|
<select> </select>
|
||||||
|
<help>The user locale allows the phone to display text (menu items, soft keys etc.) native to the phone's language. If No language packs found is shown, you need to add locales in the tftp server</help>
|
||||||
|
</item>
|
||||||
|
<item type="SLTN" id="4" seq="98">
|
||||||
|
<label>SCCP Network Device Language</label>
|
||||||
|
<name>netlang</name>
|
||||||
|
<default>English_United_States</default>
|
||||||
|
<select></select>
|
||||||
|
<help>The Network locales allows the phone to play tones (ringing, busy etc.) native to the phone's country. If No language packs found is shown, you need to add locales in the tftp server</help>
|
||||||
|
</item>
|
||||||
|
<item type="IS" id="11" seq="98">
|
||||||
|
<name>phonepersonalization</name>
|
||||||
|
<label>Allow push background from server </label>
|
||||||
|
<default></default>
|
||||||
|
<button value="1">Enabled</button>
|
||||||
|
<button value="0">Disabled</button>
|
||||||
|
<help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help>
|
||||||
|
</item>
|
||||||
|
<item type="IE" id="6" seq="99">
|
||||||
|
<label>Background Image</label>
|
||||||
|
<input>
|
||||||
|
<name>backgroundImage</name>
|
||||||
|
<default></default>
|
||||||
|
<class>sccp-custom</class>
|
||||||
|
</input>
|
||||||
|
<help>For phones that can display background images - display this one. Default is [empty]</help>
|
||||||
|
</item>
|
||||||
|
<item type="IE" id="7" seq="99">
|
||||||
|
<label>Ringtone</label>
|
||||||
|
<input>
|
||||||
|
<name>ringtone</name>
|
||||||
|
<default></default>
|
||||||
|
<class>sccp-custom</class>
|
||||||
|
</input>
|
||||||
|
<help>The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provides the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ringtones directory with the rest of the config files.</help>
|
||||||
|
</item>
|
||||||
|
</page_group>
|
||||||
|
|
||||||
<page_group name="sccp_hw_dev_button">
|
<page_group name="sccp_hw_dev_button">
|
||||||
<label>Buttons Configuration</label>
|
<label>Buttons Configuration</label>
|
||||||
<item type="IE" id="1" seq="99">
|
<item type="IE" id="1" seq="99">
|
||||||
|
|
|
@ -641,7 +641,7 @@ function InstallDB_updateSchema($db_config)
|
||||||
('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL),
|
('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL),
|
||||||
('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),
|
('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),
|
||||||
('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),
|
('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),
|
||||||
('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),
|
('9951-sip', 'CISCO-SIP', 1, 5, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),
|
||||||
('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
|
('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
|
||||||
$check = $db->query($sql);
|
$check = $db->query($sql);
|
||||||
if (DB::IsError($check)) {
|
if (DB::IsError($check)) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<module>
|
<module>
|
||||||
<rawname>sccp_manager</rawname>
|
<rawname>sccp_manager</rawname>
|
||||||
<name>SCCP Manager</name>
|
<name>SCCP Manager</name>
|
||||||
<version>14.3.0.26</version>
|
<version>14.3.0.27</version>
|
||||||
<type>setup</type>
|
<type>setup</type>
|
||||||
<category>SCCP Connectivity</category>
|
<category>SCCP Connectivity</category>
|
||||||
<publisher>Steve Lad, Alex GP</publisher>
|
<publisher>Steve Lad, Alex GP</publisher>
|
||||||
|
@ -30,6 +30,9 @@
|
||||||
* Version 14.3.0.18 * - Fix Issue 42
|
* Version 14.3.0.18 * - Fix Issue 42
|
||||||
* Version 14.3.0.22 * - Fix Issue 50
|
* Version 14.3.0.22 * - Fix Issue 50
|
||||||
* Version 14.3.0.23 * - Fix Issue 49
|
* Version 14.3.0.23 * - Fix Issue 49
|
||||||
|
* Version 14.3.0.25 * - Fix Issue 55
|
||||||
|
* Version 14.3.0.26 * - Fix Issue 54
|
||||||
|
* Version 14.3.0.27 * - Standardise treatment of SIP and SCCP hardware.
|
||||||
</changelog>
|
</changelog>
|
||||||
<location>https://github.com/chan-sccp/sccp_manager</location>
|
<location>https://github.com/chan-sccp/sccp_manager</location>
|
||||||
<supported>
|
<supported>
|
||||||
|
|
|
@ -22,7 +22,7 @@ class dbinterface
|
||||||
|
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
$Ver = '13.0.10'; // This should be updated
|
$Ver = '14.0.0.1'; // This should be updated
|
||||||
return array('Version' => $Ver,
|
return array('Version' => $Ver,
|
||||||
'about' => 'Data access interface ver: ' . $Ver);
|
'about' => 'Data access interface ver: ' . $Ver);
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,13 @@ class dbinterface
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSccpDeviceTableData($dataid, $data = array())
|
public function getSccpDeviceTableData(string $dataid, $data = array())
|
||||||
{
|
{
|
||||||
// $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE
|
// $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE
|
||||||
$stmt = '';
|
$stmt = '';
|
||||||
$stmts = '';
|
$stmts = '';
|
||||||
$stmtU = '';
|
$stmtU = '';
|
||||||
if ($dataid == '') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch ($dataid) {
|
switch ($dataid) {
|
||||||
case 'extGrid':
|
case 'extGrid':
|
||||||
// only called by getExtensionGrid from hardware.extension.php view
|
// only called by getExtensionGrid from hardware.extension.php view
|
||||||
|
@ -377,6 +375,36 @@ class dbinterface
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
//******** Get SIP settings *******
|
||||||
|
public function getSipTableData(string $dataid, $line='') {
|
||||||
|
global $db;
|
||||||
|
$tech = array();
|
||||||
|
switch ($dataid) {
|
||||||
|
case "DeviceById":
|
||||||
|
// TODO: This needs to be rewritten
|
||||||
|
$stmt = $this->db->prepare("SELECT keyword,data FROM sip WHERE id = '${line}'");
|
||||||
|
$stmt->execute();
|
||||||
|
$tech = $stmt->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
|
||||||
|
foreach ($tech as &$value) {
|
||||||
|
$value = $value[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tech;
|
||||||
|
case "extensionList";
|
||||||
|
$stmt = $this->db->prepare("SELECT id as name, data as label FROM sip WHERE keyword = 'callerid' order by name");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
/*
|
||||||
|
foreach ($result as $value) {
|
||||||
|
if (empty($tech[$value['id']]['id'])) {
|
||||||
|
$tech[$value['id']]['id']= $value['id'];
|
||||||
|
}
|
||||||
|
$tech[$value['id']][$value['keyword']]=$value['data'];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Maybe Replace by SccpTables ??!
|
* Maybe Replace by SccpTables ??!
|
||||||
|
|
|
@ -727,6 +727,7 @@ class formcreate
|
||||||
$select_opt= $model_list;
|
$select_opt= $model_list;
|
||||||
break;
|
break;
|
||||||
case 'SDML':
|
case 'SDML':
|
||||||
|
// Sccp extensions
|
||||||
$assignedExts = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('getAssignedExtensions');
|
$assignedExts = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('getAssignedExtensions');
|
||||||
$select_opt = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('SccpExtension');
|
$select_opt = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('SccpExtension');
|
||||||
foreach ($assignedExts as $name => $nameArr ) {
|
foreach ($assignedExts as $name => $nameArr ) {
|
||||||
|
@ -734,6 +735,11 @@ class formcreate
|
||||||
}
|
}
|
||||||
$child->default = $fvalues['defaultLine'];
|
$child->default = $fvalues['defaultLine'];
|
||||||
break;
|
break;
|
||||||
|
case 'SDMF':
|
||||||
|
// Sip extensions
|
||||||
|
$select_opt = \FreePBX::Sccp_manager()->dbinterface->getSipTableData('extensionList');
|
||||||
|
$child->default = $fvalues['defaultLine'];
|
||||||
|
break;
|
||||||
case 'SDE':
|
case 'SDE':
|
||||||
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model');
|
$extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model');
|
||||||
$extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
|
$extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace FreePBX\modules\Sccp_manager;
|
|
||||||
|
|
||||||
class sipconfigs
|
|
||||||
{
|
|
||||||
// protected $database;
|
|
||||||
// protected $freepbx;
|
|
||||||
|
|
||||||
public function __construct($parent_class = null)
|
|
||||||
{
|
|
||||||
$this->paren_class = $parent_class;
|
|
||||||
// $freepbx
|
|
||||||
// $this->database = $freepbx->Database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function info()
|
|
||||||
{
|
|
||||||
$Ver = '13.0.4';
|
|
||||||
return array('Version' => $Ver,
|
|
||||||
'about' => 'Sip Setings ver: ' . $Ver);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get_db_sip_TableData($dataid, $data = array())
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
if ($dataid == '') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch ($dataid) {
|
|
||||||
case "Device":
|
|
||||||
$sql = "SELECT * FROM sip ORDER BY `id`";
|
|
||||||
$tech = array();
|
|
||||||
try {
|
|
||||||
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
|
|
||||||
foreach ($raw_settings as $value) {
|
|
||||||
if (empty($tech[$value['id']]['id'])) {
|
|
||||||
$tech[$value['id']]['id']= $value['id'];
|
|
||||||
}
|
|
||||||
$tech[$value['id']][$value['keyword']]=$value['data'];
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
return $tech;
|
|
||||||
case "DeviceById":
|
|
||||||
$sql = "SELECT keyword,data FROM sip WHERE id = ?";
|
|
||||||
$sth = $db->prepare($sql);
|
|
||||||
$tech = array();
|
|
||||||
try {
|
|
||||||
$id = $data['id'];
|
|
||||||
$sth->execute(array($id));
|
|
||||||
$tech = $sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
|
|
||||||
foreach ($tech as &$value) {
|
|
||||||
$value = $value[0];
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
return $tech;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSipConfig()
|
|
||||||
{
|
|
||||||
// Only called from sccp_manager class when saving SIP device
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
|
|
||||||
$if_list = $this->paren_class ->getIpInformation('ip4');
|
|
||||||
if (!is_array($tmp_binds)) {
|
|
||||||
// FreePBX has no sip bindings.
|
|
||||||
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
|
|
||||||
}
|
|
||||||
foreach ($tmp_binds as $fpbx_protocol => $fpbx_bind) {
|
|
||||||
foreach ($fpbx_bind as $protocol_ip => $protocol_port_arr) {
|
|
||||||
if (empty($protocol_port_arr)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (($protocol_ip == '0.0.0.0') || ($protocol_ip == '[::]')) {
|
|
||||||
foreach ($if_list as $if_type => $if_data) {
|
|
||||||
if ($if_data['ip'] == "127.0.0.1") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (empty($result[$fpbx_protocol][$if_data['ip']])) {
|
|
||||||
$result[$fpbx_protocol][$if_data['ip']]= $protocol_port_arr;
|
|
||||||
} else {
|
|
||||||
$result[$fpbx_protocol][$if_data['ip']]= array_merge($result[$fpbx_protocol][$if_data['ip']],$protocol_port_arr);
|
|
||||||
}
|
|
||||||
$result[$fpbx_protocol][$if_data['ip']]['ip']=$if_data['ip'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result[$fpbx_protocol][$protocol_ip]=$protocol_port_arr;
|
|
||||||
$result[$fpbx_protocol][$protocol_ip]['ip']=$protocol_ip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (empty($result)) {
|
|
||||||
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -654,7 +654,6 @@ trait ajaxHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSccpDevice($get_settings, $validateonly = false) {
|
function saveSccpDevice($get_settings, $validateonly = false) {
|
||||||
dbug($get_settings);
|
|
||||||
$hdr_prefix = 'sccp_hw_';
|
$hdr_prefix = 'sccp_hw_';
|
||||||
$hdr_arprefix = 'sccp_hw-ar_';
|
$hdr_arprefix = 'sccp_hw-ar_';
|
||||||
$hdr_vendPrefix = 'vendorconfig_';
|
$hdr_vendPrefix = 'vendorconfig_';
|
||||||
|
@ -778,7 +777,7 @@ trait ajaxHelper {
|
||||||
$toastFlag = 'warning';
|
$toastFlag = 'warning';
|
||||||
};
|
};
|
||||||
$hash = '#sipdevice';
|
$hash = '#sipdevice';
|
||||||
if ($get_settings['command'] != 'save_sip_device') {
|
if ($get_settings['sccp_device_typeid'] != 'sipdevice') {
|
||||||
$hash = '#sccpdevice';
|
$hash = '#sccpdevice';
|
||||||
// cannot restart SIP device via chan-sccp.
|
// cannot restart SIP device via chan-sccp.
|
||||||
if ($hw_id == 'new') {
|
if ($hw_id == 'new') {
|
||||||
|
|
|
@ -405,5 +405,44 @@ trait helperfunctions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSipConfig() {
|
||||||
|
// Only called from sccp_manager class when saving SIP device
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
|
||||||
|
$if_list = $this->getIpInformation('ip4');
|
||||||
|
if (!is_array($tmp_binds)) {
|
||||||
|
// FreePBX has no sip bindings.
|
||||||
|
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
|
||||||
|
}
|
||||||
|
foreach ($tmp_binds as $fpbx_protocol => $fpbx_bind) {
|
||||||
|
foreach ($fpbx_bind as $protocol_ip => $protocol_port_arr) {
|
||||||
|
if (empty($protocol_port_arr)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (($protocol_ip == '0.0.0.0') || ($protocol_ip == '[::]')) {
|
||||||
|
foreach ($if_list as $if_type => $if_data) {
|
||||||
|
if ($if_data['ip'] == "127.0.0.1") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (empty($result[$fpbx_protocol][$if_data['ip']])) {
|
||||||
|
$result[$fpbx_protocol][$if_data['ip']]= $protocol_port_arr;
|
||||||
|
} else {
|
||||||
|
$result[$fpbx_protocol][$if_data['ip']]= array_merge($result[$fpbx_protocol][$if_data['ip']],$protocol_port_arr);
|
||||||
|
}
|
||||||
|
$result[$fpbx_protocol][$if_data['ip']]['ip']=$if_data['ip'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result[$fpbx_protocol][$protocol_ip]=$protocol_port_arr;
|
||||||
|
$result[$fpbx_protocol][$protocol_ip]['ip']=$protocol_ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($result)) {
|
||||||
|
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -27,6 +27,7 @@ if (!empty($_REQUEST['new_id'])) {
|
||||||
if (!empty($_REQUEST['id'])) {
|
if (!empty($_REQUEST['id'])) {
|
||||||
// Editing an existing Device. Overwrite any defaults that are already set for this device.
|
// Editing an existing Device. Overwrite any defaults that are already set for this device.
|
||||||
$dev_id = $_REQUEST['id'];
|
$dev_id = $_REQUEST['id'];
|
||||||
|
|
||||||
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||||
foreach ($db_res as $key => $val) {
|
foreach ($db_res as $key => $val) {
|
||||||
if (!empty($val)) {
|
if (!empty($val)) {
|
||||||
|
@ -101,17 +102,20 @@ if (!empty($def_val['type'])) {
|
||||||
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
|
<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="category" value="adddevice_form">
|
||||||
<input type="hidden" name="Submit" value="Submit">
|
<input type="hidden" name="Submit" value="Submit">
|
||||||
<input type="hidden" name="sccp_device_typeid" value="sccpdevice">
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (empty($dev_id)) {
|
if (empty($dev_id)) {
|
||||||
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
||||||
} else {
|
} else {
|
||||||
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
|
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
|
||||||
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
|
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
|
||||||
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
|
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
|
||||||
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
echo '<input type="hidden" name="sccp_device_id" value="'.$dev_id.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST['tech_hardware'] == 'cisco') {
|
||||||
|
echo '<input type="hidden" name="sccp_device_typeid" value="sccpdevice">';
|
||||||
if (empty($dev_id)) {
|
if (empty($dev_id)) {
|
||||||
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,5 +128,23 @@ if (!empty($def_val['type'])) {
|
||||||
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
|
||||||
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
|
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
|
||||||
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
|
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
|
||||||
|
|
||||||
|
} else if ($_REQUEST['tech_hardware'] == 'cisco-sip') {
|
||||||
|
echo '<input type="hidden" name="sccp_device_typeid" value="sipdevice">';
|
||||||
|
/*
|
||||||
|
if (empty($dev_new)) {
|
||||||
|
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
||||||
|
} else {
|
||||||
|
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (empty($dev_id)) {
|
||||||
|
echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
|
||||||
|
} else {
|
||||||
|
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
|
||||||
|
}
|
||||||
|
echo $this->showGroup('sccp_hw_sip_dev2', 1, 'sccp_hw', $def_val);
|
||||||
|
echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
$def_val = null;
|
|
||||||
$dev_id = null;
|
|
||||||
$dev_new = null;
|
|
||||||
$device_warning= null;
|
|
||||||
// Default value from Server setings
|
|
||||||
|
|
||||||
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $this->sccpvalues['netlang']['data'], "seq" => "99");
|
|
||||||
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $this->sccpvalues['devlang']['data'], "seq" => "99");
|
|
||||||
$def_val['directed_pickup_context'] = array("keyword" => 'directed_pickup_context', "data" => $this->sccpvalues['directed_pickup_context']['data'], "seq" => "99");
|
|
||||||
|
|
||||||
if (!empty($_REQUEST['new_id'])) {
|
|
||||||
$dev_id = $_REQUEST['new_id'];
|
|
||||||
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
|
|
||||||
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
|
|
||||||
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
|
|
||||||
$val = $_REQUEST['type'];
|
|
||||||
$def_val['type'] = array("keyword" => 'type', "data" => $val, "seq" => "99");
|
|
||||||
if (!empty($_REQUEST['addon'])) {
|
|
||||||
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_REQUEST['id'])) {
|
|
||||||
$dev_id = $_REQUEST['id'];
|
|
||||||
$dev_new = $dev_id;
|
|
||||||
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
|
||||||
foreach ($db_res as $key => $val) {
|
|
||||||
if (!empty($val)) {
|
|
||||||
switch ($key) {
|
|
||||||
case 'type':
|
|
||||||
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
|
|
||||||
if (!empty($tmp_raw[0])) {
|
|
||||||
$tmp_raw = $tmp_raw[0];
|
|
||||||
}
|
|
||||||
if (!empty($tmp_raw['validate'])) {
|
|
||||||
$tmpar = explode(";", $tmp_raw['validate']);
|
|
||||||
if ($tmpar[0] != 'yes') {
|
|
||||||
$device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
|
|
||||||
}
|
|
||||||
if ($tmpar[1] != 'yes') {
|
|
||||||
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'name':
|
|
||||||
$key = 'mac';
|
|
||||||
$val = str_replace(array('SEP','ATA','VG'), '', $val);
|
|
||||||
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
|
|
||||||
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
|
|
||||||
break;
|
|
||||||
case '_hwlang':
|
|
||||||
$tmpar = explode(":", $val);
|
|
||||||
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
|
|
||||||
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
|
|
||||||
break;
|
|
||||||
// case 'permit':
|
|
||||||
// case 'deny':
|
|
||||||
// $def_val[$key . '_net'] = array("keyword" => $key, "data" => before('/', $val), "seq" => "99");
|
|
||||||
// $key = $key . '_mask';
|
|
||||||
// $val = after('/', $val);
|
|
||||||
// break;
|
|
||||||
}
|
|
||||||
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//print_r($db_res);
|
|
||||||
|
|
||||||
if (!empty($device_warning)) {
|
|
||||||
?>
|
|
||||||
<div class="fpbx-container container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div class="container">
|
|
||||||
<h2 style="border:2px solid Tomato;color:Tomato;" >Warning in the SCCP Device</h2>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<?php
|
|
||||||
foreach ($device_warning as $key => $value) {
|
|
||||||
echo '<h3>'.$key.'</h3>';
|
|
||||||
if (is_array($value)) {
|
|
||||||
echo '<li>'._(implode('</li><li>', $value)).'</li>';
|
|
||||||
} else {
|
|
||||||
echo '<li>'. _($value).'</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_sedit">
|
|
||||||
<input type="hidden" name="category" value="adddevice_form">
|
|
||||||
<input type="hidden" name="Submit" value="Submit">
|
|
||||||
<input type="hidden" name="sccp_device_typeid" value="sipdevice">
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if (empty($dev_new)) {
|
|
||||||
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
|
||||||
} else {
|
|
||||||
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
|
||||||
}
|
|
||||||
if (empty($dev_id)) {
|
|
||||||
echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
|
|
||||||
} else {
|
|
||||||
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
|
|
||||||
}
|
|
||||||
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
|
|
||||||
echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val);
|
|
||||||
// echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
|
|
||||||
// echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
|
|
||||||
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
|
|
||||||
// echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
|
|
||||||
// echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
|
|
||||||
?>
|
|
||||||
</form>
|
|
|
@ -6,34 +6,26 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
$forminfo =array(
|
$forminfo =array(
|
||||||
array("name" => "dev_buttons", 'label' =>"Buttons Configuration"),
|
array('name'=>'dev_buttons', 'label'=>'Buttons Configuration'),
|
||||||
array("name" => "button", 'label'=>"Buttons ", 'help' => "help.")
|
array('name'=>'button', 'label'=>'Buttons', 'help'=>'help')
|
||||||
);
|
);
|
||||||
//$buttons_type= array("empty","line","service","feature","speeddial");
|
//$buttons_type= array("empty","line","service","feature","speeddial");
|
||||||
// "feature","service" -- Add leter !
|
// "feature","service" -- Add leter !
|
||||||
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
|
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
|
||||||
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
|
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
|
||||||
/*
|
|
||||||
button = feature,PDefault,ParkingLot,default,RetrieveSingle
|
|
||||||
feature,P.slot,parkinglot,P.slot,
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
if ($_REQUEST['tech_hardware'] === 'cisco') {
|
||||||
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
||||||
|
} else {
|
||||||
|
$lines_list = $this->dbinterface->getSipTableData('extensionList');
|
||||||
|
}
|
||||||
|
|
||||||
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
|
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
|
||||||
|
|
||||||
|
|
||||||
/* REQUEST for new device
|
|
||||||
[display] => sccp_phone
|
|
||||||
[tech_hardware] => cisco
|
|
||||||
[extdisplay] =>
|
|
||||||
*/
|
|
||||||
|
|
||||||
// print_r($hint_list);
|
|
||||||
$line_id =0;
|
$line_id =0;
|
||||||
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons
|
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons
|
||||||
$show_buttons =1;
|
$show_buttons =1;
|
||||||
//print_r($hint_list);
|
|
||||||
if (!empty($_REQUEST['id'])) {
|
if (!empty($_REQUEST['id'])) {
|
||||||
$dev_id = $_REQUEST['id'];
|
$dev_id = $_REQUEST['id'];
|
||||||
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
||||||
|
|
|
@ -1,262 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
$forminfo =array(
|
|
||||||
array('name'=>'dev_buttons','label'=>'Buttons Configuration'),
|
|
||||||
array('name'=>'button','label'=>'Buttons','help'=>'help')
|
|
||||||
);
|
|
||||||
//$buttons_type= array("empty","line","service","feature","speeddial");
|
|
||||||
// "feature","service" -- Add leter !
|
|
||||||
//$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
|
|
||||||
$buttons_type= array('empty','line','speeddial');
|
|
||||||
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> 'Record Calls','devstate'=> 'Change Status');
|
|
||||||
|
|
||||||
//$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
|
||||||
$lines_list = $this->sipconfigs->get_db_sip_TableData('Device');
|
|
||||||
//$hint_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
|
||||||
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
|
|
||||||
|
|
||||||
// print_r($lines_list);
|
|
||||||
$line_id =0;
|
|
||||||
$max_buttons =56;
|
|
||||||
$show_buttons =1;
|
|
||||||
//print_r($hint_list);
|
|
||||||
if (!empty($_REQUEST['id'])) {
|
|
||||||
$dev_id = $_REQUEST['id'];
|
|
||||||
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array('id' => $dev_id));
|
|
||||||
$db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array('id' => $dev_id));
|
|
||||||
$max_buttons = $db_device['buttons'];
|
|
||||||
if (!empty($db_device['addon_buttons'])) {
|
|
||||||
$max_buttons += $db_device['addon_buttons'];
|
|
||||||
}
|
|
||||||
$show_buttons = $max_buttons;
|
|
||||||
}
|
|
||||||
if (!empty($_REQUEST['new_id'])) {
|
|
||||||
$val = $_REQUEST['type'];
|
|
||||||
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
|
|
||||||
// $db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $val));
|
|
||||||
$max_buttons = $dev_schema[0]['buttons'];
|
|
||||||
if (!empty($_REQUEST['addon'])) {
|
|
||||||
$val = $_REQUEST['addon'];
|
|
||||||
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
|
|
||||||
$max_buttons += $dev_schema[0]['buttons'];
|
|
||||||
}
|
|
||||||
$show_buttons = $max_buttons;
|
|
||||||
}
|
|
||||||
if (!empty($_REQUEST['ru_id'])) {
|
|
||||||
$dev_id = $_REQUEST['ru_id'];
|
|
||||||
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array('id' => $dev_id));
|
|
||||||
$show_buttons = $max_buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_sedit">
|
|
||||||
<input type="hidden" name="category" value="frm_editbuttons">
|
|
||||||
<input type="hidden" name="Submit" value="Submit">
|
|
||||||
<input type="hidden" name="buttonscount" value="<?php echo $max_buttons?>">
|
|
||||||
<div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>">
|
|
||||||
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="section" data-id="<?php echo $forminfo[0]['name'];?>">
|
|
||||||
<div class="row"> <div class="form-group">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<label class="control-label">Help</label>
|
|
||||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="frmbuttons"></i>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<span id="frmbuttons-help" class="help-block fpbx-help-block"><?php echo _("buttons come in the following flavours: <br>
|
|
||||||
<ul>
|
|
||||||
<li>empty: Empty button (no options)</li>
|
|
||||||
<li>line: Registers the line with identifier specified as [name]</li>
|
|
||||||
<li>silent: buttons equal 'Line' with out ring</li>
|
|
||||||
<li>monitor: buttons mode speeddial + show status</li>
|
|
||||||
<li>speeddial: Adds a speeddial with label [name] and [option1] as number Optionally, [option2] can be used to specify a hint by extension@context as usual.</li>
|
|
||||||
<li>service (not implemented): Adds a service url Feature buttons have an on/off status represented on the device with a tick-box and can be used to set the device in a particular state. Currently Possible [option1],[option2] combinations:</li>
|
|
||||||
<ul>
|
|
||||||
<li>privacy,callpresent = Make a private call, number is suppressed</li><li>privacy,hint = Make a private call, hint is suppressed</li><li>cfwdall,number = Forward all calls </li><li>cfwbusy,number = Forward on busy</li><li>
|
|
||||||
cfwnoaswer,number = Forward on no-answer (not implemented yet)<br> DND,busy = Do-not-disturb, return Busy signal to Caller <br> DND,silent = Do-not-disturb, return nothing to caller <br>
|
|
||||||
monitor = Record Calls using AutoMon (asterisk 1.6.x only)</li><li>devstate,custom_devstate = Device State Feature Button (asterisk 1.6.1 and up). custom_devstate is the name of the custom devicestate to be toggled (How to use devicestate)
|
|
||||||
hold = To be implemented</li><li>transfer = To be implemented</li><li>multiblink = To be implemented</li><li>mobility = To be implemented</li><li>conference = To be implemented</li>
|
|
||||||
</ui></ui>");?></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div></div>
|
|
||||||
<?php
|
|
||||||
for ($line_id = 0; $line_id <=$max_buttons; $line_id ++) {
|
|
||||||
// print_r($db_buttons[$line_id]);
|
|
||||||
$show_form_mode = '';
|
|
||||||
$defaul_tv = (empty($db_buttons[$line_id])) ? 'empty': $db_buttons[$line_id]['buttontype'];
|
|
||||||
$defaul_btn = (empty($db_buttons[$line_id])) ? '': $db_buttons[$line_id]['name'];
|
|
||||||
$defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',', $db_buttons[$line_id]['options']);
|
|
||||||
|
|
||||||
$show_form_mode = $defaul_tv;
|
|
||||||
$def_hint = ''; // Hint check Box
|
|
||||||
$def_hint_btn = ''; // Hint Combo Box
|
|
||||||
$def_silent = '';
|
|
||||||
$defaul_advline = '';
|
|
||||||
if (strpos($defaul_btn, '@') >0) {
|
|
||||||
$defaul_tv = 'adv.line';
|
|
||||||
$show_form_mode = 'adv.line';
|
|
||||||
$defaul_btn = strtok($defaul_btn, '@');
|
|
||||||
$defaul_advline = strtok('@');
|
|
||||||
}
|
|
||||||
if ($line_id == 0) {
|
|
||||||
$show_form_mode = 'line';
|
|
||||||
}
|
|
||||||
if (stripos($defaul_btn, '!') >0) {
|
|
||||||
$defaul_btn = strtok($defaul_btn, '!');
|
|
||||||
$defaul_tv = 'silent';
|
|
||||||
$def_silent = 'checked';
|
|
||||||
}
|
|
||||||
if ($defaul_tv == "feature") {
|
|
||||||
$defaul_ftr = $defaul_opt[0];
|
|
||||||
$defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1];
|
|
||||||
// print_r($defaul_fcod);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($defaul_opt as $data_i) {
|
|
||||||
if (strpos($data_i, '@')>0) {
|
|
||||||
$test_btn = strtok($data_i, '@');
|
|
||||||
$def_hint = 'checked';
|
|
||||||
$defaul_btn = $data_i;
|
|
||||||
$def_hint_btn = $data_i;
|
|
||||||
if ($test_btn == $defaul_opt[0]) {
|
|
||||||
foreach ($lines_list as $data) {
|
|
||||||
if ($data['id']==$test_btn) {
|
|
||||||
$show_form_mode = 'line';
|
|
||||||
$defaul_tv = 'monitor';
|
|
||||||
$defaul_btn = $test_btn;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// print_r($def_hint_btn);
|
|
||||||
// print_r($defaul_opt);
|
|
||||||
|
|
||||||
echo '<!-- Begin button :'.$line_id.' -->';
|
|
||||||
echo '<div class="line_button element-container" '.(($line_id < $show_buttons)?"":"hidden ").'data-id="'.$line_id.'">';
|
|
||||||
// echo 'Mode : '.$show_form_mode. ' opt: ';
|
|
||||||
// print_r( $defaul_opt);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<div class="row"> <div class="form-group">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<label class="control-label" for="<?php echo $forminfo[1]['name'].$line_id; ?> "><?php echo _($forminfo[1]['label'].$line_id).(($line_id =="0")?' Default ':''); ?></label>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-5">
|
|
||||||
<div class="col-xs-3">
|
|
||||||
<!-- Line Type Select -->
|
|
||||||
<select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
|
|
||||||
<?php
|
|
||||||
if ($line_id == 0) {
|
|
||||||
echo '<option value="line" selected >DEF LINE</option>';
|
|
||||||
} else {
|
|
||||||
foreach ($buttons_type as $data) {
|
|
||||||
$select = (($data == $defaul_tv)?"selected":"");
|
|
||||||
echo '<option value="'.$data.'" '.$select.' >'.$data.'</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<!-- if Line Type = feature Show Futures -->
|
|
||||||
<div class="col-xs-7">
|
|
||||||
<select data-type="feature" class ="futuretype form-control lineid_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" >
|
|
||||||
<?php
|
|
||||||
foreach ($feature_list as $fkey => $fval) {
|
|
||||||
$select = (($fkey == $defaul_ftr)?"selected":"");
|
|
||||||
echo '<option value="'.$fkey.'" '.$select.' >'.$fval.'</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<!-- if Line Type = line Show SCCP Num -->
|
|
||||||
<select data-type='line' class ="form-control lineid_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" >
|
|
||||||
<?php
|
|
||||||
foreach ($lines_list as $data) {
|
|
||||||
$select = (($data['id']==$defaul_btn)?"selected":"");
|
|
||||||
echo '<option value="'.$data['id'].'" '.$select.' >'.$data['id'].' / '.$data['callerid'].'</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<!-- if Line Type = Othe Show Input -->
|
|
||||||
<div data-type='speeddial' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
|
|
||||||
<?php
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-md-5">
|
|
||||||
<!-- if Line Type = speeddial Show Hint line -->
|
|
||||||
<div data-type='hintline' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
|
|
||||||
<?php
|
|
||||||
echo '<div class="col-xs-5">';
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">';
|
|
||||||
echo '</div><div class="col-xs-2 radioset" data-toggle="buttons">';
|
|
||||||
echo '<input class="form-control" type="checkbox" name="'.$forminfo[1]['name'].$line_id.'_hint" id="'.$forminfo[1]['name'].$line_id.'_hint" '.$def_hint.' value= "hint">';
|
|
||||||
echo '<label for="'.$forminfo[1]['name'].$line_id.'_hint">hints</label>';
|
|
||||||
echo '</div><div class="col-xs-5">';
|
|
||||||
|
|
||||||
echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >';
|
|
||||||
|
|
||||||
foreach ($hint_list as $data) {
|
|
||||||
$select = (($data['key']==$def_hint_btn)?"selected":"");
|
|
||||||
echo '<option value="'.$data['key'].'" '.$select.' >'.$data['exten'].' / '.$data['label'].'</option>';
|
|
||||||
}
|
|
||||||
echo '</select>';
|
|
||||||
echo '</div>';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<!-- if Line Type = feature Show Futures Park -->
|
|
||||||
<div data-type='feature' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
|
|
||||||
<div class="col-xs-5">
|
|
||||||
<?php
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-5">
|
|
||||||
<?php
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- if Line Type = Advanced Show Hint line -->
|
|
||||||
|
|
||||||
<div data-type='adv_line' class="lineid_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
|
|
||||||
<div class="col-xs-5">
|
|
||||||
<?php
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-5">
|
|
||||||
<?php
|
|
||||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advopt" name="'.$forminfo[1]['name'].$line_id.'_advopt" placeholder="ButtonLabel,Options" value="'.$db_buttons[$line_id]['options'].'" >';
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div></div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
echo '<!-- End button :'.$line_id.' -->';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="section-butom" data-for="<?php echo $forminfo[0]['name'];?>">
|
|
||||||
<h3></h3>
|
|
||||||
</div>
|
|
|
@ -90,6 +90,7 @@ foreach ($items as $child) {
|
||||||
case 'SDM':
|
case 'SDM':
|
||||||
case 'SDMS':
|
case 'SDMS':
|
||||||
case 'SDML':
|
case 'SDML':
|
||||||
|
case 'SDMF':
|
||||||
case 'SDE':
|
case 'SDE':
|
||||||
case 'SDD':
|
case 'SDD':
|
||||||
\FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);
|
\FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
}
|
}
|
||||||
return exp_model;
|
return exp_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
function LineFormatter(value, row, index) {
|
function LineFormatter(value, row, index) {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return '-- EMPTY --';
|
return '-- EMPTY --';
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
// vim: set ai ts=4 sw=4 ft=phtml:
|
// vim: set ai ts=4 sw=4 ft=phtml:
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="fpbx-container container-fluid">
|
<div class="fpbx-container container-fluid">
|
||||||
|
@ -18,14 +17,14 @@
|
||||||
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
|
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
|
||||||
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
|
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<button name="cr_sccp_sphone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
|
<button name="cr_sip_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
|
||||||
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
|
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<button name="reset_sccp_sphone" class="btn sccp_update btn-default" data-id="reset_dev">
|
|
||||||
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=cisco-sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac">
|
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=cisco-sip"
|
||||||
|
data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true"
|
||||||
|
data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true"
|
||||||
|
data-search="true" class="table table-striped ext-list" id="table-sip" data-id="name">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-checkbox="true"></th>
|
<th data-checkbox="true"></th>
|
||||||
|
@ -45,6 +44,21 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function DispayTypeFormatter(value, row, index) {
|
||||||
|
var exp_model = value;
|
||||||
|
if (row['addon'] !== null ) {
|
||||||
|
var posd = row['addon'].indexOf(';');
|
||||||
|
if (posd >0) {
|
||||||
|
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
|
||||||
|
} else {
|
||||||
|
exp_model += ' + ' + row['addon'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exp_model;
|
||||||
|
}
|
||||||
function DispayDeviceActionsKeyFormatterS(value, row, index) {
|
function DispayDeviceActionsKeyFormatterS(value, row, index) {
|
||||||
var exp_model = '';
|
var exp_model = '';
|
||||||
if (row['new_hw'] == "Y") {
|
if (row['new_hw'] == "Y") {
|
||||||
|
@ -60,20 +74,7 @@
|
||||||
}
|
}
|
||||||
return exp_model;
|
return exp_model;
|
||||||
}
|
}
|
||||||
|
function LineFormatter(value, row, index) {
|
||||||
function DispayTypeFormatter(value, row, index) {
|
|
||||||
var exp_model = value;
|
|
||||||
if (row['addon'] !== null ) {
|
|
||||||
var posd = row['addon'].indexOf(';');
|
|
||||||
if (posd >0) {
|
|
||||||
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
|
|
||||||
} else {
|
|
||||||
exp_model += ' + ' + row['addon'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return exp_model;
|
|
||||||
}
|
|
||||||
function LineFormatterS(value, row, index) {
|
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return '-- EMPTY --';
|
return '-- EMPTY --';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue