From ab6b45350e169fcb6c5da4fa6c0e708ef27e9a3b Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Wed, 11 Nov 2020 15:16:41 +0300 Subject: [PATCH] --- Add support for setting "setvar=xxx=xxx" entries --- Writing sccp.conf also check/create sccp_custom.conf #87 --- Fix the getCodec function. #85 --- Switching around the general deny/permit order. #82 --- Thank Josh2893 for the templet #77 Special thanks for help Diederik de Groot --- Sccp_manager.class.php | 47 ++- conf/SEP0000000000.cnf.xml_99xx_sip_template | 300 +++++++++++++++++++ conf/sccpgeneral.xml.v433 | 15 + install.php | 1 + views/advserver.model.php | 6 +- views/form.devadvanced.php | 16 + views/server.codec.php | 6 +- 7 files changed, 379 insertions(+), 12 deletions(-) create mode 100644 conf/SEP0000000000.cnf.xml_99xx_sip_template create mode 100644 views/form.devadvanced.php diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index a62076f..38efcbc 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -75,6 +75,11 @@ * - Add Warning Information on Server Info Page * - ADD Reload Line * - Add Call Map (show Current call Information) + * ---TODO --- + * + * 0 + * 0 + * */ namespace FreePBX\modules; @@ -530,7 +535,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { "page" => 'views/server.codec.php' ); } - + if ($this->sccpvalues['sccp_compatible']['data'] >= '433') { + $this->pagedata["advanced"] = array( + "name" => _("Device SCCP Advanced"), + "page" => 'views/form.devadvanced.php' + ); + } break; case "cisco-sip": $this->pagedata = array( @@ -974,6 +984,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $dev_addon = null; } $dev_schema = $this->getSccpModelInformation('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id'])); + if (empty($dev_schema)) { + $dev_schema[0]['model'] = "ERROR in Model Schema"; + } $result[] = array('name' => $id_name, 'mac' => $id_name, 'button' => '---', 'type' => $dev_schema[0]['model'], 'new_hw' => 'Y', 'description' => '*NEW* ' . $dev_ids['descr'], 'status' => '*NEW* ' . $dev_ids['status'], 'address' => $dev_ids['address'], 'addon' => $dev_addon); @@ -1530,11 +1543,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { break; } foreach ($allCodecs as $c => $v) { - if (array_search($c, $Sccp_Codec) != null) { + if (in_array($c, $Sccp_Codec)) { $allSupported[$c] = $v; } } - if (empty($lcodecs) || (!is_array($lcodecs))) { if (empty($allSupported)) { $lcodecs = $allCodecs; @@ -1548,7 +1560,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } } - if ($showDefaults) { foreach ($allSupported as $c => $v) { if (!isset($codecs[$c])) { @@ -2041,9 +2052,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { case "allow": case "disallow": case "deny": + $this->sccp_conf_init['general'][$key] = explode(';', $value['data']); + break; case "localnet": case "permit": - $this->sccp_conf_init['general'][$key] = explode(';', $value['data']); + $content =$value['data']; + if (strpos($content, 'internal') !== false) { + $content = str_replace(';0.0.0.0/0.0.0.0','',$value['data']); + } + $this->sccp_conf_init['general'][$key] = explode(';', $content); break; case "devlang": $lang_data = $this->extconfigs->getextConfig('sccp_lang', $value['data']); @@ -2056,12 +2073,30 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { case "sccp_compatible": break; default: - $this->sccp_conf_init['general'][$key] = $value['data']; + if (!empty($value['data'])) { + $this->sccp_conf_init['general'][$key] = $value['data']; + } } } } // [Namesoftkeyset] // type=softkeyset + // + // ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!! + // This will add problems when solving problems caused by unexpected solutions from users. + // + if (file_exists($this->sccppath["asterisk"] . "/sccp_custom.conf")) { + $this->sccp_conf_init['HEADER'] = array( + "; ;", + "; It is a very bad idea to add an external configuration file !!!! ;", + "; This will add problems when solving problems caused by unexpected solutions ;", + "; from users. ;", + ";--------------------------------------------------------------------------------;", + "#include sccp_custom.conf" + ); + } + // ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!! + $this->cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init); } diff --git a/conf/SEP0000000000.cnf.xml_99xx_sip_template b/conf/SEP0000000000.cnf.xml_99xx_sip_template new file mode 100644 index 0000000..a752399 --- /dev/null +++ b/conf/SEP0000000000.cnf.xml_99xx_sip_template @@ -0,0 +1,300 @@ + + true + SIP + + + D/M/Y + + + + + unicast + + + + + + + + + 5060 + 5061 + + + + + + + + + + true + + + true + x-cisco-serviceuri-cfwdall + x-cisco-serviceuri-pickup + x-cisco-serviceuri-opickup + x-cisco-serviceuri-gpickup + x-cisco-serviceuri-meetme + x-cisco-serviceuri-abbrdial + false + 1 + true + true + 3 + 3 + 0 + true + false + 1 + + + 6 + 10 + 180 + 3600 + 5 + 120 + 120 + 5 + 500 + 4000 + 70 + true + Phone + + 1 + false + true + true + false + none + 101 + 3 + avt + false + false + 0 + + 0 + true + 15000 + 10 + false + 16384 + 32766 + false + false + + + + 9 + + USECALLMANAGER + 5060 + + + + 0 + + 3 + + + + false + 3 + 0 + + 4 + 5 + + true + true + false + true + + 5 + 4 + + + + 5060 + 184 + 0 + + + + 1 + + + + true + 2 + + + + false + false + false + true + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 1 + 1 + 1 + 0,1,2 + 1 + 1 + 1 + 0,1 + 0 + 0 + 0 + 1 + 1 + 10 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + + 0 + 0 + 1 + 2 + 2 + 1 + 1 + 1,7 + 08:00 + 10:00 + 00:10 + 1 + 0 + 1,7 + 08:00 + 10:00 + 00:10 + 1 + 0 + 100 + 50 + + 5 + 0 + + + 1 + 0 + 1 + 0 + true + 0 + 2 + + 0 + 0 + + 0 + 0 + 0 + 1 + 1 + 1 + 1 + + d902ed5a-c1e5-4233-b1d6-a960d53d1c3a + + + 2 + + Missed Calls + Application:Cisco/MissedCalls + + + + + Received Calls + Application:Cisco/ReceivedCalls + + + + + Placed Calls + Application:Cisco/PlacedCalls + + + + + Voicemail + Application:Cisco/Voicemail + + + + + + + 1 + + + utf-8 + + + + + + + 1 + 0 + + + + + + + + + + + + + + 1 + 3600 + 1 + true + 0 + 0 + 1 + 5 + 1 + 0 + 0 + 0 + + + false + + + \ No newline at end of file diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433 index 6bc426c..f734102 100644 --- a/conf/sccpgeneral.xml.v433 +++ b/conf/sccpgeneral.xml.v433 @@ -1961,5 +1961,20 @@ and open the template in the editor. Base Version before all crash :-) + + + + + + setvar + + + col-md-9 + + + + + + + diff --git a/install.php b/install.php index 72b4c09..325a5fc 100644 --- a/install.php +++ b/install.php @@ -683,6 +683,7 @@ function InstallDB_fillsccpdevmodel() "('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, 1, '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/views/advserver.model.php b/views/advserver.model.php index 0f4806c..d19ea78 100644 --- a/views/advserver.model.php +++ b/views/advserver.model.php @@ -80,7 +80,7 @@
- Help. + Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol
@@ -88,10 +88,10 @@
diff --git a/views/form.devadvanced.php b/views/form.devadvanced.php new file mode 100644 index 0000000..699f13f --- /dev/null +++ b/views/form.devadvanced.php @@ -0,0 +1,16 @@ + +
+ + + + showGroup('sccp_hw_addv_device', 1, 'sccp_hw', $def_val); + + ?> +
diff --git a/views/server.codec.php b/views/server.codec.php index fe4eb17..d45583b 100644 --- a/views/server.codec.php +++ b/views/server.codec.php @@ -54,7 +54,7 @@ if (!empty($_REQUEST['id'])) {
- +
@@ -104,7 +104,7 @@ if (!empty($_REQUEST['id'])) {
- +
@@ -154,7 +154,7 @@ if (!empty($_REQUEST['id'])) {
- +