diff --git a/freepbx/var/www/html/freepbx/admin/modules/nethcti3/Nethcti3.class.php b/freepbx/var/www/html/freepbx/admin/modules/nethcti3/Nethcti3.class.php index 4faf5b679..fa35072fe 100644 --- a/freepbx/var/www/html/freepbx/admin/modules/nethcti3/Nethcti3.class.php +++ b/freepbx/var/www/html/freepbx/admin/modules/nethcti3/Nethcti3.class.php @@ -242,144 +242,144 @@ public function genConfig() { return $out; } - // Add custom headers for trunks to trunks module - public static function myGuiHooks() { - return array("core", "INTERCEPT" => array("modules/core/page.trunks.php")); - } + // Add custom headers for trunks to trunks module + public static function myGuiHooks() { + return array("core", "INTERCEPT" => array("modules/core/page.trunks.php")); + } - public function doGuiHook($filename, &$output){} + public function doGuiHook($filename, &$output){} - public function doGuiIntercept($filename, &$output) { - # Show the custom field in the trunks module - if ($filename == "modules/core/page.trunks.php" && $_REQUEST['display'] == "trunks" && strtolower($_REQUEST['tech']) == "pjsip") { - $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); - $disable_topos_header = $this->getConfig('disable_topos_header', $trunkid); - $disable_srtp_header = $this->getConfig('disable_srtp_header', $trunkid); - $topos_section = ' - -
-
-
-
-
-
- - -
-
- - - - -
-
-
-
-
-
-
- '. _("If yes, send topos=0 header to nethvoice-proxy to disable TOPOS for this trunk").' -
-
-
- '; - $disable_srtp_header_section = ' - -
-
-
-
-
-
- - -
-
- - - - -
-
-
-
-
-
-
- '. _("If yes, send isTrunk=1 header to nethvoice-proxy to disable SRTP for this trunk").' -
-
-
- '; - $output = str_replace('',''.$topos_section.$disable_srtp_header_section,$output); - } - } + public function doGuiIntercept($filename, &$output) { + # Show the custom field in the trunks module + if ($filename == "modules/core/page.trunks.php" && $_REQUEST['display'] == "trunks" && strtolower($_REQUEST['tech']) == "pjsip") { + $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); + $disable_topos_header = $this->getConfig('disable_topos_header', $trunkid); + $disable_srtp_header = $this->getConfig('disable_srtp_header', $trunkid); + $topos_section = ' + +
+
+
+
+
+
+ + +
+
+ + + + +
+
+
+
+
+
+
+ '. _("If yes, send topos=0 header to nethvoice-proxy to disable TOPOS for this trunk").' +
+
+
+ '; + $disable_srtp_header_section = ' + +
+
+
+
+
+
+ + +
+
+ + + + +
+
+
+
+
+
+
+ '. _("If yes, send isTrunk=1 header to nethvoice-proxy to disable SRTP for this trunk").' +
+
+
+ '; + $output = str_replace('',''.$topos_section.$disable_srtp_header_section,$output); + } + } - public static function myConfigPageInits() { - return array("extensions", "recallonbusy", "trunks"); - - } + public static function myConfigPageInits() { + return array("extensions", "recallonbusy", "trunks"); + + } - public function doConfigPageInit($display) { - global $astman; - if ($display == "extensions" && !empty($_REQUEST['recallonbusy'])) { - // Save Recall On Busy option for the extension - $astman->database_put("ROBconfig",$_REQUEST['extdisplay'],$_REQUEST['recallonbusy']); - } elseif ($display == "recallonbusy") { - if (!empty($_REQUEST['default'])) { - $this->setConfig('default',$_REQUEST['default']); - } - if (!empty($_REQUEST['digit'])) { - $this->setConfig('digit',$_REQUEST['digit']); - } - needreload(); - } elseif ($display == "trunks") { - global $db; - if ($_REQUEST['action'] == "edittrunk" && !empty($_REQUEST['extdisplay'])) { - if (!empty($_REQUEST['disable_topos_header'])) { - // save topos configuratino for the trunk on trunk edit - $disable_topos_header = $_REQUEST['disable_topos_header'] == "yes" ? 1 : 0; - $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); - $this->setConfig('disable_topos_header', $disable_topos_header, $trunkid); - } - if (!empty($_REQUEST['disable_srtp_header'])) { - // save srtp configuration for the trunk on trunk edit - $disable_srtp_header = $_REQUEST['disable_srtp_header'] == "yes" ? 1 : 0; - $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); - $this->setConfig('disable_srtp_header', $disable_srtp_header, $trunkid); - } - } elseif ($_REQUEST['action'] == "addtrunk") { - // Get the future trunk id - $sql = 'SELECT trunkid FROM trunks'; - $sth = $db->prepare($sql); - $sth->execute(); - $trunkid = 1; - while ($res = $sth->fetchColumn()) { - if ($res > $trunkid) { - break; - } - $trunkid++; - } - if ($res == $trunkid) { - $trunkid++; - } - if (!empty($_REQUEST['disable_topos_header'])){ - // save topos configuration for the trunk on trunk add - $disable_topos_header = $_REQUEST['disable_topos_header'] == "yes" ? 1 : 0; - $this->setConfig('disable_topos_header', $disable_topos_header, $trunkid); - } - if (!empty($_REQUEST['disable_srtp_header'])){ - // save srtp configuration for the trunk on trunk add - $disable_srtp_header = $_REQUEST['disable_srtp_header'] == "yes" ? 1 : 0; - $this->setConfig('disable_srtp_header', $disable_srtp_header, $trunkid); - } - } elseif ($_REQUEST['action'] == "deltrunk") { - $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); - // delete topos configuration for the trunk - $this->delConfig('disable_topos_header', $trunkid); - // delete srtp configuration for the trunk - $this->delConfig('disable_srtp_header', $trunkid); - } - } + public function doConfigPageInit($display) { + global $astman; + if ($display == "extensions" && !empty($_REQUEST['recallonbusy'])) { + // Save Recall On Busy option for the extension + $astman->database_put("ROBconfig",$_REQUEST['extdisplay'],$_REQUEST['recallonbusy']); + } elseif ($display == "recallonbusy") { + if (!empty($_REQUEST['default'])) { + $this->setConfig('default',$_REQUEST['default']); + } + if (!empty($_REQUEST['digit'])) { + $this->setConfig('digit',$_REQUEST['digit']); + } + needreload(); + } elseif ($display == "trunks") { + global $db; + if ($_REQUEST['action'] == "edittrunk" && !empty($_REQUEST['extdisplay'])) { + if (!empty($_REQUEST['disable_topos_header'])) { + // save topos configuratino for the trunk on trunk edit + $disable_topos_header = $_REQUEST['disable_topos_header'] == "yes" ? 1 : 0; + $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); + $this->setConfig('disable_topos_header', $disable_topos_header, $trunkid); + } + if (!empty($_REQUEST['disable_srtp_header'])) { + // save srtp configuration for the trunk on trunk edit + $disable_srtp_header = $_REQUEST['disable_srtp_header'] == "yes" ? 1 : 0; + $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); + $this->setConfig('disable_srtp_header', $disable_srtp_header, $trunkid); + } + } elseif ($_REQUEST['action'] == "addtrunk") { + // Get the future trunk id + $sql = 'SELECT trunkid FROM trunks'; + $sth = $db->prepare($sql); + $sth->execute(); + $trunkid = 1; + while ($res = $sth->fetchColumn()) { + if ($res > $trunkid) { + break; + } + $trunkid++; + } + if ($res == $trunkid) { + $trunkid++; + } + if (!empty($_REQUEST['disable_topos_header'])){ + // save topos configuration for the trunk on trunk add + $disable_topos_header = $_REQUEST['disable_topos_header'] == "yes" ? 1 : 0; + $this->setConfig('disable_topos_header', $disable_topos_header, $trunkid); + } + if (!empty($_REQUEST['disable_srtp_header'])){ + // save srtp configuration for the trunk on trunk add + $disable_srtp_header = $_REQUEST['disable_srtp_header'] == "yes" ? 1 : 0; + $this->setConfig('disable_srtp_header', $disable_srtp_header, $trunkid); + } + } elseif ($_REQUEST['action'] == "deltrunk") { + $trunkid = str_replace("OUT_", "", $_REQUEST['extdisplay']); + // delete topos configuration for the trunk + $this->delConfig('disable_topos_header', $trunkid); + // delete srtp configuration for the trunk + $this->delConfig('disable_srtp_header', $trunkid); + } + } } }