From 048077fce83de665ffb22236fbee088c7b26c924 Mon Sep 17 00:00:00 2001 From: stevenA Date: Thu, 6 Jan 2022 15:00:24 +0100 Subject: [PATCH] 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 --- Sccp_manager.class.php | 21 +-- conf/sccpgeneral.xml.v433 | 76 ++++++++ install.php | 2 +- module.xml | 5 +- sccpManClasses/dbinterface.class.php | 38 +++- sccpManClasses/formcreate.class.php | 6 + sccpManClasses/sipconfigs.class.php | 105 ----------- sccpManTraits/ajaxHelper.php | 3 +- sccpManTraits/helperFunctions.php | 39 ++++ views/form.adddevice.php | 48 +++-- views/form.addsdevice.php | 126 ------------- views/form.buttons.php | 26 +-- views/form.sbuttons.php | 262 --------------------------- views/formShowSysDefs.php | 1 + views/hardware.phone.php | 11 +- views/hardware.sphone.php | 51 +++--- 16 files changed, 244 insertions(+), 576 deletions(-) delete mode 100644 sccpManClasses/sipconfigs.class.php delete mode 100644 views/form.addsdevice.php delete mode 100644 views/form.sbuttons.php diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index b732f17..4d4e7b0 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -320,11 +320,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $this->pagedata = array( "general" => array( "name" => _("Sip device configuration"), - "page" => 'views/form.addsdevice.php' + "page" => 'views/form.adddevice.php' ), "buttons" => array( "name" => _("Sip device Buttons"), - "page" => 'views/form.sbuttons.php' + "page" => 'views/form.buttons.php' ) ); break; @@ -854,11 +854,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { * Create (SEP) dev_ID.cnf.xml */ - function createSccpDeviceXML($dev_id = '') { + function createSccpDeviceXML(string $dev_id) { - if (empty($dev_id)) { - return false; - } $sccp_native = true; $data_value = array(); $dev_line_data = null; @@ -868,7 +865,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { if (!empty($dev_config['type'])) { if (strpos($dev_config['type'], 'sip') !== false) { $sccp_native = false; - $tmp_bind = $this->sipconfigs->getSipConfig(); + $tmp_bind = $this->getSipConfig(); $dev_ext_config = $this->dbinterface->getSccpDeviceTableData("SccpDevice", array('name' => $dev_id, 'fields' => 'sip_ext')); if (empty($dev_ext_config)){ // TODO: Placeholder. Have no associated sip line so cannot generate SEP Xml for SIP. @@ -882,15 +879,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $tmp_line = explode(',', $value); switch ($tmp_line[0]) { case 'line': - $dev_line_data = $this->sipconfigs->get_db_sip_TableData('DeviceById', array('id' => $tmp_line[1])); - $f_linetype = (explode("/",$dev_line_data['dial'])[0] == 'PJSIP') ? 'pjsip' : 'sip'; + $dev_line_data = $this->dbinterface->getSipTableData('DeviceById', $tmp_line[1]); + $f_linetype = ($dev_line_data['sipdriver'] == 'chan_sip') ? 'sip' : 'pjsip'; $dev_line_data['sbind'] = $tmp_bind[$f_linetype]; if ((!$this->array_key_exists_recursive('udp', $tmp_bind[$f_linetype])) && (!$this->array_key_exists_recursive('tcp', $tmp_bind[$f_linetype]))) { - print_r("SIP server configuration error ! Neither UDP nor TCP protocol enabled"); - die(); - return -1; + die_freepbx(_("SIP server configuration error ! Neither UDP nor TCP protocol enabled")); + return false; } - if (!empty($dev_line_data)) { $data_value['siplines'][] = $dev_line_data; } diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433 index f0571c6..835cda5 100644 --- a/conf/sccpgeneral.xml.v433 +++ b/conf/sccpgeneral.xml.v433 @@ -1385,6 +1385,82 @@ and open the template in the editor. Base Version before all crash :-) + + + + + + description + 000000000 + sccp-custom + + + The information in the upper right corner of the device screen. Only English letters and digits ! + + + + defaultLine + + + lineSelect form-control + Select the default line for this device + + + + softkeyset + default + + System Default Softkey + + + + tzoffset + 00 + + Time Zone offset + + + + devlang + English_United_States + + 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 + + + + netlang + English_United_States + + 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 + + + phonepersonalization + + + + + 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: + + + + + backgroundImage + + sccp-custom + + For phones that can display background images - display this one. Default is [empty] + + + + + ringtone + + sccp-custom + + 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. + + + diff --git a/install.php b/install.php index a42b5f0..2127d63 100644 --- a/install.php +++ b/install.php @@ -641,7 +641,7 @@ function InstallDB_updateSchema($db_config) ('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'), - ('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'), + ('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);"; $check = $db->query($sql); if (DB::IsError($check)) { diff --git a/module.xml b/module.xml index 27212c8..a223b5f 100644 --- a/module.xml +++ b/module.xml @@ -1,7 +1,7 @@ sccp_manager SCCP Manager - 14.3.0.26 + 14.3.0.27 setup SCCP Connectivity Steve Lad, Alex GP @@ -30,6 +30,9 @@ * Version 14.3.0.18 * - Fix Issue 42 * Version 14.3.0.22 * - Fix Issue 50 * Version 14.3.0.23 * - Fix Issue 49 + * Version 14.3.0.25 * - Fix Issue 55 + * Version 14.3.0.26 * - Fix Issue 54 + * Version 14.3.0.27 * - Standardise treatment of SIP and SCCP hardware. https://github.com/chan-sccp/sccp_manager diff --git a/sccpManClasses/dbinterface.class.php b/sccpManClasses/dbinterface.class.php index 4e3f45d..c0fa897 100644 --- a/sccpManClasses/dbinterface.class.php +++ b/sccpManClasses/dbinterface.class.php @@ -22,7 +22,7 @@ class dbinterface public function info() { - $Ver = '13.0.10'; // This should be updated + $Ver = '14.0.0.1'; // This should be updated return array('Version' => $Ver, 'about' => 'Data access interface ver: ' . $Ver); } @@ -44,15 +44,13 @@ class dbinterface return $result; } - public function getSccpDeviceTableData($dataid, $data = array()) + public function getSccpDeviceTableData(string $dataid, $data = array()) { // $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE $stmt = ''; $stmts = ''; $stmtU = ''; - if ($dataid == '') { - return false; - } + switch ($dataid) { case 'extGrid': // only called by getExtensionGrid from hardware.extension.php view @@ -377,6 +375,36 @@ class dbinterface } return $result; } + //******** Get SIP settings ******* + public function getSipTableData(string $dataid, $line='') { + global $db; + $tech = array(); + switch ($dataid) { + case "DeviceById": + // TODO: This needs to be rewritten + $stmt = $this->db->prepare("SELECT keyword,data FROM sip WHERE id = '${line}'"); + $stmt->execute(); + $tech = $stmt->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP); + foreach ($tech as &$value) { + $value = $value[0]; + } + + return $tech; + case "extensionList"; + $stmt = $this->db->prepare("SELECT id as name, data as label FROM sip WHERE keyword = 'callerid' order by name"); + $stmt->execute(); + $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); + /* + foreach ($result as $value) { + if (empty($tech[$value['id']]['id'])) { + $tech[$value['id']]['id']= $value['id']; + } + $tech[$value['id']][$value['keyword']]=$value['data']; + } + */ + return $result; + } + } /* * Maybe Replace by SccpTables ??! diff --git a/sccpManClasses/formcreate.class.php b/sccpManClasses/formcreate.class.php index b9d4c4e..e33e6c6 100644 --- a/sccpManClasses/formcreate.class.php +++ b/sccpManClasses/formcreate.class.php @@ -727,6 +727,7 @@ class formcreate $select_opt= $model_list; break; case 'SDML': + // Sccp extensions $assignedExts = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('getAssignedExtensions'); $select_opt = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('SccpExtension'); foreach ($assignedExts as $name => $nameArr ) { @@ -734,6 +735,11 @@ class formcreate } $child->default = $fvalues['defaultLine']; break; + case 'SDMF': + // Sip extensions + $select_opt = \FreePBX::Sccp_manager()->dbinterface->getSipTableData('extensionList'); + $child->default = $fvalues['defaultLine']; + break; case 'SDE': $extension_list = \FreePBX::Sccp_manager()->dbinterface->getDb_model_info('extension', 'model'); $extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0'); diff --git a/sccpManClasses/sipconfigs.class.php b/sccpManClasses/sipconfigs.class.php deleted file mode 100644 index ccb8dab..0000000 --- a/sccpManClasses/sipconfigs.class.php +++ /dev/null @@ -1,105 +0,0 @@ -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; - } -} diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index 22bdf06..6d33495 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -654,7 +654,6 @@ trait ajaxHelper { } function saveSccpDevice($get_settings, $validateonly = false) { - dbug($get_settings); $hdr_prefix = 'sccp_hw_'; $hdr_arprefix = 'sccp_hw-ar_'; $hdr_vendPrefix = 'vendorconfig_'; @@ -778,7 +777,7 @@ trait ajaxHelper { $toastFlag = 'warning'; }; $hash = '#sipdevice'; - if ($get_settings['command'] != 'save_sip_device') { + if ($get_settings['sccp_device_typeid'] != 'sipdevice') { $hash = '#sccpdevice'; // cannot restart SIP device via chan-sccp. if ($hw_id == 'new') { diff --git a/sccpManTraits/helperFunctions.php b/sccpManTraits/helperFunctions.php index 03d5b6a..6872f35 100644 --- a/sccpManTraits/helperFunctions.php +++ b/sccpManTraits/helperFunctions.php @@ -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; + } } ?> diff --git a/views/form.adddevice.php b/views/form.adddevice.php index faaf46c..d61f13d 100644 --- a/views/form.adddevice.php +++ b/views/form.adddevice.php @@ -27,6 +27,7 @@ if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['id'])) { // Editing an existing Device. Overwrite any defaults that are already set for this device. $dev_id = $_REQUEST['id']; + $db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id)); foreach ($db_res as $key => $val) { if (!empty($val)) { @@ -101,28 +102,49 @@ if (!empty($def_val['type'])) {
- '; } else { $val = str_replace(array('SEP','ATA','VG'), '', $dev_id); $val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format $def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99"); - echo ''; + echo ''; } - if (empty($dev_id)) { - echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val); - } else { - echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val); + + if ($_REQUEST['tech_hardware'] == 'cisco') { + echo ''; + if (empty($dev_id)) { + echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val); + } else { + echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val); + } + echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val); + echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val); + echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val); + // echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist! + echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val); + echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val); + echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); + + } else if ($_REQUEST['tech_hardware'] == 'cisco-sip') { + echo ''; + /* + if (empty($dev_new)) { + echo ''; + } else { + echo ''; + } + */ + if (empty($dev_id)) { + echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val); + } else { + echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val); + } + echo $this->showGroup('sccp_hw_sip_dev2', 1, 'sccp_hw', $def_val); + echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val); } - echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val); - echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val); - echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val); - // echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist! - echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val); - echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val); - echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); ?>
diff --git a/views/form.addsdevice.php b/views/form.addsdevice.php deleted file mode 100644 index e2cfb4c..0000000 --- a/views/form.addsdevice.php +++ /dev/null @@ -1,126 +0,0 @@ - '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)) { - ?> -
-
-
-

Warning in the SCCP Device

-
- $value) { - echo '

'.$key.'

'; - if (is_array($value)) { - echo '
  • '._(implode('
  • ', $value)).'
  • '; - } else { - echo '
  • '. _($value).'
  • '; - } - } - ?> - -
    -
    -
    -
    -
    - - - -
    - - - - - - '; - } else { - echo ''; - } - 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); - ?> -
    diff --git a/views/form.buttons.php b/views/form.buttons.php index 968cf6b..01de215 100644 --- a/views/form.buttons.php +++ b/views/form.buttons.php @@ -6,34 +6,26 @@ * and open the template in the editor. */ $forminfo =array( - array("name" => "dev_buttons", 'label' =>"Buttons Configuration"), - array("name" => "button", 'label'=>"Buttons ", 'help' => "help.") - ); + array('name'=>'dev_buttons', 'label'=>'Buttons Configuration'), + array('name'=>'button', 'label'=>'Buttons', 'help'=>'help') + ); //$buttons_type= array("empty","line","service","feature","speeddial"); // "feature","service" -- Add leter ! $buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status"); -/* - button = feature,PDefault,ParkingLot,default,RetrieveSingle - feature,P.slot,parkinglot,P.slot, - */ +if ($_REQUEST['tech_hardware'] === 'cisco') { + $lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension'); +} else { + $lines_list = $this->dbinterface->getSipTableData('extensionList'); +} -$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension'); $hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ; - -/* REQUEST for new device -[display] => sccp_phone -[tech_hardware] => cisco -[extdisplay] => -*/ - -// print_r($hint_list); $line_id =0; $max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons $show_buttons =1; -//print_r($hint_list); + if (!empty($_REQUEST['id'])) { $dev_id = $_REQUEST['id']; $db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id)); diff --git a/views/form.sbuttons.php b/views/form.sbuttons.php deleted file mode 100644 index 26cf03c..0000000 --- a/views/form.sbuttons.php +++ /dev/null @@ -1,262 +0,0 @@ -'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; -} - -?> - -
    - - - -
    -

    -
    -
    -
    -
    - - -
    -
    - -
      -
    • empty: Empty button (no options)
    • -
    • line: Registers the line with identifier specified as [name]
    • -
    • silent: buttons equal 'Line' with out ring
    • -
    • monitor: buttons mode speeddial + show status
    • -
    • 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.
    • -
    • 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:
    • -
        -
      • privacy,callpresent = Make a private call, number is suppressed
      • privacy,hint = Make a private call, hint is suppressed
      • cfwdall,number = Forward all calls
      • cfwbusy,number = Forward on busy
      • - cfwnoaswer,number = Forward on no-answer (not implemented yet)
        DND,busy = Do-not-disturb, return Busy signal to Caller
        DND,silent = Do-not-disturb, return nothing to caller
        - monitor = Record Calls using AutoMon (asterisk 1.6.x only)
      • 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
      • transfer = To be implemented
      • multiblink = To be implemented
      • mobility = To be implemented
      • conference = To be implemented
      • - ");?> -
    - -
    - 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 ''; - echo '
    '; -// echo 'Mode : '.$show_form_mode. ' opt: '; -// print_r( $defaul_opt); - - ?> -
    -
    - -
    -
    -
    - - -
    - -
    - - - - -
    - '; - ?> -
    -
    - -
    -
    - -
    - '; - echo ''; - echo '
    '; - echo ''; - echo ''; - echo '
    '; - - echo ''; - echo '
    '; - ?> -
    - -
    -
    - '; - ?> -
    -
    - '; - ?> -
    -
    - - -
    -
    - '; - ?> -
    -
    - '; - ?> -
    -
    - -
    - -
    -
    - '; - } - - ?> - - - - -
    -
    -

    -
    diff --git a/views/formShowSysDefs.php b/views/formShowSysDefs.php index c848c4d..92bc9d3 100644 --- a/views/formShowSysDefs.php +++ b/views/formShowSysDefs.php @@ -90,6 +90,7 @@ foreach ($items as $child) { case 'SDM': case 'SDMS': case 'SDML': + case 'SDMF': case 'SDE': case 'SDD': \FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref); diff --git a/views/hardware.phone.php b/views/hardware.phone.php index 6f24829..1a60ba8 100644 --- a/views/hardware.phone.php +++ b/views/hardware.phone.php @@ -81,8 +81,7 @@ exp_model += '  '; } return exp_model; -} - + } function LineFormatter(value, row, index) { if (value === null) { return '-- EMPTY --'; @@ -90,11 +89,11 @@ var data = value.split(";"); result = ''; for (var i = 0; i < data.length; i++) { - var val = data[i].split(','); - if (val[0] === 'line') { + var val = data[i].split(','); + if (val[0] === 'line') { result = result + val[1] + '
    '; - } - } + } + } return result; } diff --git a/views/hardware.sphone.php b/views/hardware.sphone.php index 697b394..9c3a467 100644 --- a/views/hardware.sphone.php +++ b/views/hardware.sphone.php @@ -5,7 +5,6 @@ * and open the template in the editor. */ // vim: set ai ts=4 sw=4 ft=phtml: - ?>
    @@ -18,14 +17,14 @@ - -
    - +
    @@ -45,6 +44,21 @@