Modify updating sccpsettings in _construct

Remove duplicates from sccpdevmodel array
Improve feedback from module reload
Change update sccpdevmodel process in install
This commit is contained in:
stevenA 2022-01-27 16:47:56 +01:00
parent b212b85b71
commit 24b2dd128c
5 changed files with 168 additions and 150 deletions

View file

@ -148,7 +148,11 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$this->initializeSccpPath(); //Set required Paths $this->initializeSccpPath(); //Set required Paths
$this->updateTimeZone(); // Get timezone from FreePBX $this->updateTimeZone(); // Get timezone from FreePBX
//$this->findInstLangs(); //$this->findInstLangs();
$this->saveSccpSettings(); // Only data that has been updated (potentially) are the 2 timezone related parameters
// So save these 2 directly to db in updateTimeZone, rather than rewrite all settings
//$this->saveSccpSettings();
//} //}
} }
@ -197,14 +201,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
*/ */
public function updateTimeZone() { public function updateTimeZone() {
// Get latest FreePBX time $timeZoneOffsetList // Get latest FreePBX time $timeZoneOffsetList - need to reflect standard/summer time etc
$freepbxTZ = \date_default_timezone_get(); $freepbxTZ = \date_default_timezone_get();
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => $freepbxTZ); $this->sccpvalues['ntp_timezone']['data'] = $freepbxTZ;
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $freepbxTZ); $TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $freepbxTZ);
if (!empty($TZdata)) { if (!empty($TZdata)) {
$value = $TZdata['offset']/60; // TODO: Is this correct (storing in hours not minutes) // TODO: Is this correct (storing in hours not minutes)
$this->sccpvalues['tzoffset'] = array('keyword' => 'tzoffset', 'seq'=>98, 'type' => 2, 'data' => $value); $this->sccpvalues['tzoffset']['data'] = $TZdata['offset']/60;
} }
$this->dbinterface->write('sccpsettings', [$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']], 'update');
//$this->saveSccpSettings([$this->sccpvalues['tzoffset'], $this->sccpvalues['ntp_timezone']]);
} }
/* /*
* Show form information - General * Show form information - General
@ -821,7 +828,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
/* /*
* Save Config Value to mysql DB * Save Config Value to mysql DB
*/ */
/*
private function saveSccpSettings($save_value = array()) { private function saveSccpSettings($save_value = array()) {
if (empty($save_value)) { if (empty($save_value)) {
@ -831,7 +838,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
return true; return true;
} }
*/
/* /*
* Create XMLDefault.cnf.xml * Create XMLDefault.cnf.xml
*/ */

View file

@ -569,137 +569,148 @@ function InstallDB_updateSchema($db_config)
} }
outn("<li>" . _("Total modify count :") . $count_modify . "</li>"); outn("<li>" . _("Total modify count :") . $count_modify . "</li>");
// Force update of sccp devmodel to ensure changes are taken into account // Now see if sccpdevmodel is populated.
$devModelArr = array( "('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL)",
"('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL)",
"('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL)",
"('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL)",
"('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL)",
"('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, '')",
"('6901', 'CISCO', 1, 1, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL)",
"('6911', 'CISCO', 1, 1, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL)",
"('6921', 'CISCO', 1, 1, 'SCCP69xx.9-4-1-3SR3', 'loadInformation496', 0, NULL)",
"('6941', 'CISCO', 1, 1, 'SCCP69xx.9-3-1-3', 'loadInformation495', 0, NULL)",
"('6945', 'CISCO', 1, 1, 'SCCP6945.9-3-1-3', 'loadInformation564', 0, NULL)",
"('6961', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL)",
"('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL)",
"('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL)",
"('7906', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7910', 'CISCO', 1, 1, 'P00405000700', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7911', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template')",
"('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL)",
"('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL)",
"('7914;7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL)",
"('7915', 'CISCO', 0, 24, 'B015-1-0-4-2', 'loadInformation227', 1, NULL)",
"('7915;7915', 'CISCO', 0, 48, 'B015-1-0-4-2', 'loadInformation228', 1, NULL)",
"('7916', 'CISCO', 0, 24, 'B016-1-0-4-2', 'loadInformation229', 1, NULL)",
"('7916;7916', 'CISCO', 0, 48, 'B016-1-0-4-2', 'loadInformation230', 1, NULL)",
"('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL)",
"('7921', 'CISCO', 1, 1, 'CP7921G-1.4.6.3', 'loadInformation365', 0, NULL)",
"('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, 'SEP0000000000.cnf.xml_7925_template')",
"('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, '')",
"('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL)",
"('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL)",
"('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL)",
"('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-5-7', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template')",
"('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_7940_template')",
"('7941', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7942', 'CISCO', 1, 2, 'SCCP42.9-4-2SR3-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7945', 'CISCO', 1, 2, 'SCCP45.9-3-1SR1-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_7940_template')",
"('7961', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7962', 'CISCO', 3, 6, 'SCCP42.9-4-2SR3-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7965', 'CISCO', 3, 6, 'SCCP45.9-3-1SR1-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template')",
"('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, '')",
"('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, '')",
"('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, '')",
"('7970', 'CISCO', 3, 8, 'SCCP70.9-4-2SR3-1S', 'loadInformation30006', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('7971', 'CISCO', 1, 2, 'SCCP70.9-4-2SR3-1S', 'loadInformation119', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('7975', 'CISCO', 3, 8, 'SCCP75.9-4-2SR3-1S', 'loadInformation437', 0, 'SEP0000000000.cnf.xml_7975_template')",
"('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL)",
"('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, '')",
"('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, '')",
"('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, '')",
"('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, '')",
"('8941', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation586', 0, 'SEP0000000000.cnf.xml_797x_template')",
"('8945', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation585', 0, 'SEP0000000000.cnf.xml_7975_template')",
"('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, 'SEP0000000000.cnf.xml_ATA_template')",
"('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, 'SEP0000000000.cnf.xml_ATA_template')",
"('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL)",
"('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL)",
"('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL)",
"('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL)",
"('ICC', 'NOKIA', 1, 1, '', '', 0, NULL)",
"('Analog Access', 'CISCO', 1, 1, 'A001C030', 'loadInformation30', 0, '')",
"('WS-X6624', 'CISCO', 1, 1, 'A00204000013', 'loadInformation43', 0, '')",
"('WS-X6608', 'CISCO', 1, 1, 'C00104000003', 'loadInformation51', 0, '')",
"('H.323 Phone', 'CISCO', 1, 1, '', 'loadInformation61', 0, '')",
"('Simulator', 'CISCO', 1, 1, '', 'loadInformation100', 0, '')",
"('MTP', 'CISCO', 1, 1, '', 'loadInformation111', 0, '')",
"('MGCP Station', 'CISCO', 1, 1, '', 'loadInformation120', 0, '')",
"('MGCP Trunk', 'CISCO', 1, 1, '', 'loadInformation121', 0, '')",
"('UPC', 'CISCO', 1, 1, '', 'loadInformation358', 0, '')",
"('TelePresence', 'TELEPRESENCE', 1, 1, '', 'loadInformation375', 0, '')",
"('1000', 'TELEPRESENCE', 1, 1, '', 'loadInformation478', 0, '')",
"('3000', 'TELEPRESENCE', 1, 1, '', 'loadInformation479', 0, '')",
"('3200', 'TELEPRESENCE', 1, 1, '', 'loadInformation480', 0, '')",
"('500-37', 'TELEPRESENCE', 1, 1, '', 'loadInformation481', 0, '')",
"('1300-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation505', 0, '')",
"('1100', 'TELEPRESENCE', 1, 1, '', 'loadInformation520', 0, '')",
"('200', 'TELEPRESENCE', 1, 1, '', 'loadInformation557', 0, '')",
"('400', 'TELEPRESENCE', 1, 1, '', 'loadInformation558', 0, '')",
"('EX90', 'TELEPRESENCE', 1, 1, '', 'loadInformation584', 0, '')",
"('500-32', 'TELEPRESENCE', 1, 1, '', 'loadInformation590', 0, '')",
"('1300-47', 'TELEPRESENCE', 1, 1, '', 'loadInformation591', 0, '')",
"('TX1310-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation596', 0, '')",
"('EX60', 'TELEPRESENCE', 1, 1, '', 'loadInformation604', 0, '')",
"('C90', 'TELEPRESENCE', 1, 1, '', 'loadInformation606', 0, '')",
"('C60', 'TELEPRESENCE', 1, 1, '', 'loadInformation607', 0, '')",
"('C40', 'TELEPRESENCE', 1, 1, '', 'loadInformation608', 0, '')",
"('C20', 'TELEPRESENCE', 1, 1, '', 'loadInformation609', 0, '')",
"('C20-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation610', 0, '')",
"('C60-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation611', 0, '')",
"('C40-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation612', 0, '')",
"('C60-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation613', 0, '')",
"('C60-52D', 'TELEPRESENCE', 1, 1, '', 'loadInformation614', 0, '')",
"('C60-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation615', 0, '')",
"('C90-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation616', 0, '')",
"('MX200', 'TELEPRESENCE', 1, 1, '', 'loadInformation617', 0, '')",
"('TX9000', 'TELEPRESENCE', 1, 1, '', 'loadInformation619', 0, '')",
"('TX9200', 'TELEPRESENCE', 1, 1, '', 'loadInformation620', 0, '')",
"('SX20', 'TELEPRESENCE', 1, 1, '', 'loadInformation626', 0, '')",
"('MX300', 'TELEPRESENCE', 1, 1, '', 'loadInformation627', 0, '')",
"('C40-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation633', 0, '')",
"('Jabber', 'CISCO', 1, 1, '', 'loadInformation652', 0, '')",
"('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, '')",
"('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, '')",
"('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, '')",
"('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, '')",
"('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, '')",
"('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, '')",
"('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, '')",
"('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, '')",
"('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, '')",
"('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, '')",
"('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, '')",
"('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, '')",
"('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, '')",
"('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, '')",
"('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, '')",
"('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, '')",
"('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, '')",
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL)",
"('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL)",
"('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL)",
"('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template')",
"('9951-sip', 'CISCO-SIP', 1, 5, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template')",
"('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL)");
dbug(count($devModelArr));
$test = $db->prepare("SELECT count(*) AS modelCount from sccpdevmodel");
$test->execute();
if ($test->fetchAll()[0]['modelCount'] == count($devModelArr)) {
// Appear to have a correctly populated sccpdevmodel table. Do not overwrite
// as may contain user modifications;
outn("<li>" . _("sccpdevmodel appears to be populated; not overwriting") . "</li>");
return;
};
// Update sccpdevmodel as counts do not match
outn("Updating sccpdevmodel..."); outn("Updating sccpdevmodel...");
outn("<li>" . _("Fill sccpdevmodel") . "</li>"); outn("<li>" . _("Fill sccpdevmodel") . "</li>");
$sql = "REPLACE INTO sccpdevmodel (model, vendor, dns, buttons, loadimage, loadinformationid, enabled, nametemplate) VALUES $sql = "REPLACE INTO sccpdevmodel (model, vendor, dns, buttons, loadimage, loadinformationid, enabled, nametemplate) VALUES" . implode(',',$devModelArr);
('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL),
('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL),
('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL),
('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL),
('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL),
('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, ''),
('6901', 'CISCO', 1, 1, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL),
('6911', 'CISCO', 1, 1, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL),
('6921', 'CISCO', 1, 1, 'SCCP69xx.9-4-1-3SR3', 'loadInformation496', 0, NULL),
('6941', 'CISCO', 1, 1, 'SCCP69xx.9-3-1-3', 'loadInformation495', 0, NULL),
('6945', 'CISCO', 1, 1, 'SCCP6945.9-3-1-3', 'loadInformation564', 0, NULL),
('6961', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL),
('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL),
('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL),
('7906', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7910', 'CISCO', 1, 1, 'P00405000700', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7911', 'CISCO', 1, 1, 'SCCP11.9-4-2SR3-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template'),
('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL),
('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL),
('7914;7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL),
('7915', 'CISCO', 0, 24, 'B015-1-0-4-2', 'loadInformation227', 1, NULL),
('7915;7915', 'CISCO', 0, 48, 'B015-1-0-4-2', 'loadInformation228', 1, NULL),
('7916', 'CISCO', 0, 24, 'B016-1-0-4-2', 'loadInformation229', 1, NULL),
('7916;7916', 'CISCO', 0, 48, 'B016-1-0-4-2', 'loadInformation230', 1, NULL),
('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL),
('7921', 'CISCO', 1, 1, 'CP7921G-1.4.6.3', 'loadInformation365', 0, NULL),
('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, 'SEP0000000000.cnf.xml_7925_template'),
('7926', 'CISCO', 1, 1, 'CP7926G-1.4.1SR1', 'loadInformation557', 0, NULL),
('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL),
('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL),
('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL),
('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-5-7', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'),
('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_7940_template'),
('7941', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-4-2SR3-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7942', 'CISCO', 1, 2, 'SCCP42.9-4-2SR3-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7945', 'CISCO', 1, 2, 'SCCP45.9-3-1SR1-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_7940_template'),
('7961', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-4-2SR3-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7962', 'CISCO', 3, 6, 'SCCP42.9-4-2SR3-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7965', 'CISCO', 3, 6, 'SCCP45.9-3-1SR1-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'),
('7970', 'CISCO', 3, 8, 'SCCP70.9-4-2SR3-1S', 'loadInformation30006', 0, 'SEP0000000000.cnf.xml_797x_template'),
('7971', 'CISCO', 1, 2, 'SCCP70.9-4-2SR3-1S', 'loadInformation119', 0, 'SEP0000000000.cnf.xml_797x_template'),
('7975', 'CISCO', 3, 8, 'SCCP75.9-4-2SR3-1S', 'loadInformation437', 0, 'SEP0000000000.cnf.xml_7975_template'),
('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL),
('8941', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation586', 0, 'SEP0000000000.cnf.xml_797x_template'),
('8945', 'CISCO', 1, 4, 'SCCP894x.9-4-2SR1-2', 'loadInformation585', 0, 'SEP0000000000.cnf.xml_7975_template'),
('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, 'SEP0000000000.cnf.xml_ATA_template'),
('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, 'SEP0000000000.cnf.xml_ATA_template'),
('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL),
('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL),
('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL),
('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL),
('ICC', 'NOKIA', 1, 1, '', '', 0, NULL),
('Analog Access', 'CISCO', 1, 1, 'A001C030', 'loadInformation30', 0, ''),('WS-X6608', 'CISCO', 1, 1, 'D00404000032', 'loadInformation43', 0, ''),
('WS-X6624', 'CISCO', 1, 1, 'A00204000013', 'loadInformation43', 0, ''),
('WS-X6608', 'CISCO', 1, 1, 'C00104000003', 'loadInformation51', 0, ''),
('H.323 Phone', 'CISCO', 1, 1, '', 'loadInformation61', 0, ''),
('Simulator', 'CISCO', 1, 1, '', 'loadInformation100', 0, ''),
('MTP', 'CISCO', 1, 1, '', 'loadInformation111', 0, ''),
('MGCP Station', 'CISCO', 1, 1, '', 'loadInformation120', 0, ''),
('MGCP Trunk', 'CISCO', 1, 1, '', 'loadInformation121', 0, ''),
('UPC', 'CISCO', 1, 1, '', 'loadInformation358', 0, ''),
('TelePresence', 'TELEPRESENCE', 1, 1, '', 'loadInformation375', 0, ''),
('1000', 'TELEPRESENCE', 1, 1, '', 'loadInformation478', 0, ''),
('3000', 'TELEPRESENCE', 1, 1, '', 'loadInformation479', 0, ''),
('3200', 'TELEPRESENCE', 1, 1, '', 'loadInformation480', 0, ''),
('500-37', 'TELEPRESENCE', 1, 1, '', 'loadInformation481', 0, ''),
('1300-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation505', 0, ''),
('1100', 'TELEPRESENCE', 1, 1, '', 'loadInformation520', 0, ''),
('200', 'TELEPRESENCE', 1, 1, '', 'loadInformation557', 0, ''),
('400', 'TELEPRESENCE', 1, 1, '', 'loadInformation558', 0, ''),
('EX90', 'TELEPRESENCE', 1, 1, '', 'loadInformation584', 0, ''),
('500-32', 'TELEPRESENCE', 1, 1, '', 'loadInformation590', 0, ''),
('1300-47', 'TELEPRESENCE', 1, 1, '', 'loadInformation591', 0, ''),
('TX1310-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation596', 0, ''),
('EX60', 'TELEPRESENCE', 1, 1, '', 'loadInformation604', 0, ''),
('C90', 'TELEPRESENCE', 1, 1, '', 'loadInformation606', 0, ''),
('C60', 'TELEPRESENCE', 1, 1, '', 'loadInformation607', 0, ''),
('C40', 'TELEPRESENCE', 1, 1, '', 'loadInformation608', 0, ''),
('C20', 'TELEPRESENCE', 1, 1, '', 'loadInformation609', 0, ''),
('C20-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation610', 0, ''),
('C60-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation611', 0, ''),
('C40-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation612', 0, ''),
('C60-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation613', 0, ''),
('C60-52D', 'TELEPRESENCE', 1, 1, '', 'loadInformation614', 0, ''),
('C60-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation615', 0, ''),
('C90-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation616', 0, ''),
('MX200', 'TELEPRESENCE', 1, 1, '', 'loadInformation617', 0, ''),
('TX9000', 'TELEPRESENCE', 1, 1, '', 'loadInformation619', 0, ''),
('TX9200', 'TELEPRESENCE', 1, 1, '', 'loadInformation620', 0, ''),
('SX20', 'TELEPRESENCE', 1, 1, '', 'loadInformation626', 0, ''),
('MX300', 'TELEPRESENCE', 1, 1, '', 'loadInformation627', 0, ''),
('C40-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation633', 0, ''),
('Jabber', 'CISCO', 1, 1, '', 'loadInformation652', 0, ''),
('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, ''),
('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, ''),
('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, ''),
('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, ''),
('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, ''),
('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, ''),
('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, ''),
('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, ''),
('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, ''),
('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, ''),
('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, ''),
('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, ''),
('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, ''),
('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, ''),
('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, ''),
('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, ''),
('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, ''),
('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, ''),
('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, ''),
('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, ''),
('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, ''),
('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, ''),
('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, ''),
('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, ''),
('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, ''),
('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL),
('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL),
('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),
('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),
('9951-sip', 'CISCO-SIP', 1, 5, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),
('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
$check = $db->query($sql); $check = $db->query($sql);
if (DB::IsError($check)) { if (DB::IsError($check)) {
die_freepbx("Can not create sccpdevmodel table, error:$check\n"); die_freepbx("Can not create sccpdevmodel table, error:$check\n");

View file

@ -1,7 +1,7 @@
<module> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>16.0.0.2</version> <version>16.0.0.1</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>
@ -41,6 +41,7 @@
* Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB) * Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB)
* Version 14.4.0.3 * - Change method of selecting phonecodepage depending on if is java phone. * Version 14.4.0.3 * - Change method of selecting phonecodepage depending on if is java phone.
* Version 14.4.0.5 * - Fix issue #59. * Version 14.4.0.5 * - Fix issue #59.
* Version 14.5.0.1 * - Fix issue #32.
* Version 16.0.0.1 * - Improve compliance and use of BMO to optimise performance * Version 16.0.0.1 * - Improve compliance and use of BMO to optimise performance
</changelog> </changelog>
<location>https://github.com/chan-sccp/sccp_manager</location> <location>https://github.com/chan-sccp/sccp_manager</location>

View file

@ -9,7 +9,6 @@ class formcreate
public function __construct($parent_class = null) { public function __construct($parent_class = null) {
$this->buttonDefLabel = 'chan-sccp'; $this->buttonDefLabel = 'chan-sccp';
$this->buttonHelpLabel = 'site'; $this->buttonHelpLabel = 'site';
$this->Sccp_manager = \FreePBX::create()->Sccp_manager;
} }
function addElementIE ($child, $fvalues, $sccp_defaults, $npref) { function addElementIE ($child, $fvalues, $sccp_defaults, $npref) {
@ -552,12 +551,12 @@ class formcreate
break; break;
case 'SLK': case 'SLK':
$softKeyList = array(); $softKeyList = array();
$softKeyList = $this->Sccp_manager->aminterface->sccp_list_keysets(); $softKeyList = \FreePBX::Sccp_manager()->aminterface->sccp_list_keysets();
$select_opt= $softKeyList; $select_opt= $softKeyList;
break; break;
case 'SLP': case 'SLP':
$dialplan_list = array(); $dialplan_list = array();
foreach ($this->Sccp_manager->getDialPlanList() as $tmpkey) { foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) {
$tmp_id = $tmpkey['id']; $tmp_id = $tmpkey['id'];
$dialplan_list[$tmp_id] = $tmp_id; $dialplan_list[$tmp_id] = $tmp_id;
} }
@ -744,17 +743,17 @@ class formcreate
} }
switch ($child['type']) { switch ($child['type']) {
case 'SDM': case 'SDM':
$model_list = $this->Sccp_manager->dbinterface->getModelInfoFromDb('ciscophones', 'model'); $model_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('ciscophones', 'model');
$select_opt= $model_list; $select_opt= $model_list;
break; break;
case 'SDMS': case 'SDMS':
$model_list = $this->Sccp_manager->dbinterface->getModelInfoFromDb('sipphones', 'model'); $model_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('sipphones', 'model');
$select_opt= $model_list; $select_opt= $model_list;
break; break;
case 'SDML': case 'SDML':
// Sccp extensions // Sccp extensions
$assignedExts = $this->Sccp_manager->dbinterface->getSccpDeviceTableData('getAssignedExtensions'); $assignedExts = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('getAssignedExtensions');
$select_opt = $this->Sccp_manager->dbinterface->getSccpDeviceTableData('SccpExtension'); $select_opt = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData('SccpExtension');
foreach ($assignedExts as $name => $nameArr ) { foreach ($assignedExts as $name => $nameArr ) {
$select_opt[$name]['label'] .= " - in use"; $select_opt[$name]['label'] .= " - in use";
} }
@ -762,11 +761,11 @@ class formcreate
break; break;
case 'SDMF': case 'SDMF':
// Sip extensions // Sip extensions
$select_opt = $this->Sccp_manager->dbinterface->getSipTableData('extensionList'); $select_opt = \FreePBX::Sccp_manager()->dbinterface->getSipTableData('extensionList');
$child->default = $fvalues['defaultLine']; $child->default = $fvalues['defaultLine'];
break; break;
case 'SDE': case 'SDE':
$extension_list = $this->Sccp_manager->dbinterface->getModelInfoFromDb('extension', 'model'); $extension_list = \FreePBX::Sccp_manager()->dbinterface->getModelInfoFromDb('extension', 'model');
$extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0'); $extension_list[] = array( 'model' => 'NONE', 'vendor' => 'CISCO', 'dns' => '0');
foreach ($extension_list as &$data) { foreach ($extension_list as &$data) {
$d_name = explode(';', $data['model']); $d_name = explode(';', $data['model']);
@ -780,7 +779,7 @@ class formcreate
$select_opt= $extension_list; $select_opt= $extension_list;
break; break;
case 'SDD': case 'SDD':
$device_list = $this->Sccp_manager->dbinterface->getSccpDeviceTableData("SccpDevice"); $device_list = \FreePBX::Sccp_manager()->dbinterface->getSccpDeviceTableData("SccpDevice");
$device_list[]=array('name' => 'NONE', 'description' => 'No Device'); $device_list[]=array('name' => 'NONE', 'description' => 'No Device');
$select_opt = $device_list; $select_opt = $device_list;
break; break;

View file

@ -279,7 +279,6 @@ trait ajaxHelper {
} }
function saveServerSettings($request, $validateonly = false) { function saveServerSettings($request, $validateonly = false) {
dbug($request);
$hdr_prefix = 'sccp_'; $hdr_prefix = 'sccp_';
$hdr_arprefix = 'sccp-ar_'; $hdr_arprefix = 'sccp-ar_';
$save_settings = array(); $save_settings = array();
@ -384,7 +383,8 @@ trait ajaxHelper {
$save_settings = array_merge($save_settings, $extSettings); $save_settings = array_merge($save_settings, $extSettings);
//dbug($save_settings); //dbug($save_settings);
if (!empty($save_settings)) { if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings); //$this->saveSccpSettings($save_settings);
$this->dbinterface->write('sccpsettings', $save_settings, 'update');
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); $this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
} }
@ -409,7 +409,7 @@ trait ajaxHelper {
$this->createDefaultSccpXml(); $this->createDefaultSccpXml();
// TODO: Need to be more specific on reload and only reload if critical settings changed. // TODO: Need to be more specific on reload and only reload if critical settings changed.
$res = $this->aminterface->core_sccp_reload(); $res = $this->aminterface->core_sccp_reload();
return array('status' => true, 'message' => 'Data saved', 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => ''); return array('status' => true, 'message' => "Data saved - {$res['Response']}", 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => '');
} }
public function getFilesFromProvisioner($request) { public function getFilesFromProvisioner($request) {