From 92ca19ed410a44b1fe46bf67e88694f6e42d137d 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.
---
Sccp_manager.inc/aminterface/oldinterface.class.php | 2 +-
Sccp_manager.inc/srvinterface.class.php | 12 ++++++------
install.php | 6 ++++--
views/server.info.php | 3 +--
4 files changed, 12 insertions(+), 11 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 982ecb1..7192bbe 100644
--- a/Sccp_manager.inc/srvinterface.class.php
+++ b/Sccp_manager.inc/srvinterface.class.php
@@ -14,8 +14,8 @@ class srvinterface {
var $error;
var $_info;
- var $ami_mode = false;
- var $useAmiInterface = true;
+ var $ami_mode;
+ var $useAmiForSoftKeys = true;
public function __construct($parent_class = null) {
$this->paren_class = $parent_class;
@@ -231,11 +231,11 @@ class srvinterface {
default:
$retval = 430;
}
- if ($res['RevisionNum'] < 11063) {
- $this->useAmiInterface = false;
+ if ($res['RevisionNum'] < 11048) {
+ $this->useAmiForSoftKeys = false;
}
if ($revNumComp) {
- return array($retval, $this->useAmiInterface);
+ return array($retval, $this->useAmiForSoftKeys);
}
return $retval;
}
@@ -249,7 +249,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 88f3b74..b83d4fc 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";
@@ -1003,9 +1004,10 @@ if (!$sccp_db_ver) {
InstallDB_createButtonConfigTrigger();
InstallDB_CreateSccpDeviceConfigView($sccp_compatible);
InstallDB_updateDBVer($sccp_compatible);
+dbug('chanSCCPWarning',$chanSCCPWarning);
if ($chanSCCPWarning) {
- outn("
");
- outn("Warning: Upgrade chan_sccp_b to use full ami functionality");
+ outn("
");
+ outn("Warning: Upgrade chan_sccp_b to use full ami functionality");
}
if (!$sccp_db_ver) {
Setup_RealTime();
diff --git a/views/server.info.php b/views/server.info.php
index 3dfb207..4b9d28c 100644
--- a/views/server.info.php
+++ b/views/server.info.php
@@ -36,8 +36,7 @@ $info['aminterface'] = $this->aminterface->info();
$info['XML'] = $this->xmlinterface->info();
$info['sccp_class'] = $driver['sccp'];
$info['Core_sccp'] = array('Version' => $core['Version'], 'about' => 'Sccp ver.' . $core['Version'] . ' r' . $core['vCode'] . ' Revision :' . $core['RevisionNum'] . ' Hash :' . $core['RevisionHash']);
-if (!$this->srvinterface->useAmiInterface) {
- $info['aminterface']['about'] .= ' -- Disabled';
+if (!$this->srvinterface->useAmiForSoftKeys) {
$info['Core_sccp'] = array('Version' => $core['Version'], 'about' => 'Sccp ver.' . $core['Version'] . ' r' . $core['vCode'] . ' Revision :' . $core['RevisionNum'] . ' Hash :' . $core['RevisionHash'] . ' ----Warning: Upgrade chan_sccp to use full ami functionality');
}
$info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about' => 'Asterisk.');