Merge pull request #98 from steve-lad/Fix-SoftKeys

Fix soft keys
This commit is contained in:
Phantom 2021-02-05 12:14:07 +03:00 committed by GitHub
commit 2c28342286
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 23 deletions

View file

@ -177,40 +177,65 @@ class SCCPGeneric_Response extends Response
public function addEvent($event) public function addEvent($event)
{ {
// not eventlist (start/complete) // not eventlist (start/complete)
// print_r('<br>---- addEvent --<br>'); // print_r('<br>---- addEvent --<br>');
// print_r($event); // print_r($event);
// print_r('<br>---- Event List--<br>'); // print_r('<br>---- Event List--<br>');
// print_r($event->getEventList()); // print_r($event->getEventList());
if (stristr($event->getEventList(), 'start') === false && stristr($event->getEventList(), 'complete') === false && stristr($event->getName(), 'complete') === false
) { // Nothing to do with this - we need a table start
$unknownevent = "FreePBX\\modules\\Sccp_manager\\aminterface\\UnknownEvent"; if (stristr($event->getEventList(), 'start')) { return; }
if (!($event instanceof $unknownevent)) {
// Handle TableStart/TableEnd Differently
if (stristr($event->getName(), 'TableStart') != false) { // This is empty as soon as we have received a TableStart.
// The next message is the first of the data sets
// We use this variable in the switch to add set entries
if ( empty($thisSetEventEntryType)) {
if (strpos($event->getName(), 'Entry')) {
$thisSetEventEntryType = $event->getName();
} else {
$thisSetEventEntryType = 'undefinedAsThisIsNotASet';
}
}
$unknownevent = "FreePBX\\modules\\Sccp_manager\\aminterface\\UnknownEvent";
if (!($event instanceof $unknownevent)) {
switch ( $event->getName()) {
case $thisSetEventEntryType :
$this->_temptable['Entries'][] = $event;
break;
case 'TableStart':
//initialise
$this->_temptable = array(); $this->_temptable = array();
$this->_temptable['Name'] = $event->getTableName(); $this->_temptable['Name'] = $event->getTableName();
$this->_temptable['Entries'] = array(); $this->_temptable['Entries'] = array();
} elseif (stristr($event->getName(), 'TableEnd') != false) { $thisSetEventEntryType = '';
break;
case 'TableEnd':
//Close
if (!is_array($this->_tables)) { if (!is_array($this->_tables)) {
$this->_tables = array(); $this->_tables = array();
} }
$this->_tables[$event->getTableName()] = $this->_temptable; $this->_tables[$event->getTableName()] = $this->_temptable;
unset($this->_temptable); unset($this->_temptable);
} elseif (is_array($this->_temptable)) { $thisSetEventEntryType = '';
$this->_temptable['Entries'][] = $event;
} else { // Finished the table. Now check to see if everything was received
// If counts do not match return false and table will not be
//loaded
if ($event->getKey('TableEntries') != count($this->_tables[$event->getTableName()]['Entries'])) {
return $this->_completed = false;
}
break;
default:
// add regular event // add regular event
$this->_events[] = $event; $this->_events[] = $event;
} }
} else { } else {
// add regular event // add unknown event
$this->_events[] = $event; $this->_events[] = $event;
} }
} // Received a complete eventList outside of a table.
// finish eventlist if (stristr($event->getEventList(), 'complete') || stristr($event->getName(), 'complete')) {
if (stristr($event->getEventList(), 'complete') != false || stristr($event->getName(), 'complete') != false return $this->_completed = true;
) {
$this->_completed = true;
} }
} }

View file

@ -236,11 +236,11 @@ class srvinterface {
public function sccp_list_keysets() { public function sccp_list_keysets() {
/* if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_list_keysets(); return $this->aminterface->sccp_list_keysets();
} else { } else {
*/ return $this->oldinterface->sccp_list_keysets(); return $this->oldinterface->sccp_list_keysets();
// } }
} }