From c1fb9370bd1666dd856e88540a145022a3dff5e3 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Sun, 7 Feb 2021 14:48:49 +0100 Subject: [PATCH] Test for chan_sccp_b version compatibility SoftKeySets fails with chan_sccp-b prior to revision number 11048. Check the version with the installer, and subsequently to ensure do not get exception. --- .../aminterface/oldinterface.class.php | 2 +- Sccp_manager.inc/srvinterface.class.php | 28 +++++++++++++------ install.php | 19 ++++++++++--- views/server.info.php | 3 ++ 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/Sccp_manager.inc/aminterface/oldinterface.class.php b/Sccp_manager.inc/aminterface/oldinterface.class.php index 1719f63..a8d8c86 100644 --- a/Sccp_manager.inc/aminterface/oldinterface.class.php +++ b/Sccp_manager.inc/aminterface/oldinterface.class.php @@ -306,7 +306,7 @@ class oldinterface $result["vCode"] = 433; } else { $result["vCode"] = 430; - } + } } } diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index cf8eea5..f6b3542 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -15,6 +15,7 @@ class srvinterface { var $error; var $_info; var $ami_mode; + var $useAmiForSoftKeys = true; public function __construct($parent_class = null) { $this->paren_class = $parent_class; @@ -206,24 +207,35 @@ class srvinterface { */ } } - public function get_compatible_sccp() { - + public function get_compatible_sccp($revNumComp=false) { + // only called with args from installer to get revision and compatibility $res = $this->getSCCPVersion(); if (empty($res)) { return 0; } switch ($res["vCode"]) { case 0: - return 0; + $retval = 0; + break; case 433: - return 433; - + $retval = 433; + break; case 432: + $retval = 430; + break; case 431: - return 431; + $retval = 431; + break; default: - return 430; + $retval = 430; } + if ($res['RevisionNum'] < 11048) { + $this->useAmiForSoftKeys = false; + } + if ($revNumComp) { + return array($retval, $this->useAmiForSoftKeys); + } + return $retval; } public function getSCCPVersion() { @@ -236,7 +248,7 @@ class srvinterface { public function sccp_list_keysets() { - if ($this->ami_mode) { + if (($this->ami_mode) && ($this->useAmiForSoftKeys)){ return $this->aminterface->sccp_list_keysets(); } else { return $this->oldinterface->sccp_list_keysets(); diff --git a/install.php b/install.php index 6c4f298..6e5c510 100644 --- a/install.php +++ b/install.php @@ -17,6 +17,7 @@ global $astman; global $version; global $srvinterface; global $mobile_hw; +global $useAmiForSoftKeys; $mobile_hw = '0'; $class = "\\FreePBX\\Modules\\Sccp_manager\\srvinterface"; @@ -375,6 +376,7 @@ $table_req = array('sccpdevice', 'sccpline'); $ss = FreePBX::create()->Sccp_manager; $astman = FreePBX::create()->astman; $sccp_compatible = 0; +$chanSCCPWarning = true; //$db_config = $db_config_v0; $db_config = ''; @@ -445,13 +447,13 @@ function CheckAsteriskVersion() function CheckChanSCCPCompatible() { + global $chanSCCPWarning; global $srvinterface, $astman; if (!$astman) { ie_freepbx('No asterisk manager connection provided!. Installation Failed'); } - $sccp_compatible = $srvinterface->get_compatible_sccp(); - outn("