Operator Panel: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-06-08 19:32:39 +00:00
parent 1b3af9fb36
commit 4ac06a9194
No known key found for this signature in database
5 changed files with 38 additions and 27 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -185,8 +185,8 @@
} }
//output suggestions, if any //output suggestions, if any
if (sizeof($suggestions) > 0) { if (!empty($suggestions) && is_array($suggestions) && @sizeof($suggestions) > 0) {
$resp .= "[\n"; $resp = "[\n";
$resp .= implode(",\n", $suggestions)."\n"; $resp .= implode(",\n", $suggestions)."\n";
$resp .= "]"; $resp .= "]";

View File

@ -2,7 +2,7 @@
/* $Id$ */ /* $Id$ */
/* /*
v_exec.php v_exec.php
Copyright (C) 2008-2019 Mark J Crane Copyright (C) 2008-2023 Mark J Crane
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -55,10 +55,10 @@
//process the requests //process the requests
if (count($_GET) > 0) { if (count($_GET) > 0) {
//set the variables //set the variables
$switch_cmd = trim($_GET["cmd"]); $switch_cmd = trim($_GET["cmd"] ?? '');
$action = trim($_GET["action"]); $action = trim($_GET["action"] ?? '');
$data = trim($_GET["data"]); $data = trim($_GET["data"] ?? '');
$direction = trim($_GET["direction"]); $direction = trim($_GET["direction"] ?? '');
//setup the event socket connection //setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
@ -73,14 +73,17 @@ if (count($_GET) > 0) {
$source = preg_replace($num_pattern,'',$_GET['source']); $source = preg_replace($num_pattern,'',$_GET['source']);
$destination = preg_replace($num_pattern,'',$_GET['destination']); $destination = preg_replace($num_pattern,'',$_GET['destination']);
$api_cmd = 'bgapi originate {sip_auto_answer=true,origination_caller_id_number=' . $source . ',sip_h_Call-Info=_undef_}user/' . $source . '@' . $_SESSION['domain_name'] . ' ' . $destination . ' XML ' . trim($_SESSION['user_context']); $api_cmd = 'bgapi originate {sip_auto_answer=true,origination_caller_id_number=' . $source . ',sip_h_Call-Info=_undef_}user/' . $source . '@' . $_SESSION['domain_name'] . ' ' . $destination . ' XML ' . trim($_SESSION['user_context']);
} elseif ($switch_cmd == 'uuid_record') { }
else if ($switch_cmd == 'uuid_record') {
$uuid = preg_replace($uuid_pattern,'',$_GET['uuid']); $uuid = preg_replace($uuid_pattern,'',$_GET['uuid']);
$api_cmd = 'uuid_record ' . $uuid . ' start ' . $_SESSION['switch']['recordings']['dir'] . '/' . $_SESSION['domain_name'] . '/archive/' . date('Y/M/d') . '/' . $uuid . '.wav'; $api_cmd = 'uuid_record ' . $uuid . ' start ' . $_SESSION['switch']['recordings']['dir'] . '/' . $_SESSION['domain_name'] . '/archive/' . date('Y/M/d') . '/' . $uuid . '.wav';
} elseif ($switch_cmd == 'uuid_transfer') { }
else if ($switch_cmd == 'uuid_transfer') {
$uuid = preg_replace($uuid_pattern,'',$_GET['uuid']); $uuid = preg_replace($uuid_pattern,'',$_GET['uuid']);
$destination = preg_replace($num_pattern,'',$_GET['destination']); $destination = preg_replace($num_pattern,'',$_GET['destination']);
$api_cmd = 'uuid_transfer ' . $uuid . ' ' . $destination . ' XML ' . trim($_SESSION['user_context']); $api_cmd = 'uuid_transfer ' . $uuid . ' ' . $destination . ' XML ' . trim($_SESSION['user_context']);
} elseif ($switch_cmd == 'uuid_eavesdrop') { }
else if ($switch_cmd == 'uuid_eavesdrop') {
$chan_uuid = preg_replace($uuid_pattern,'',$_GET['chan_uuid']); $chan_uuid = preg_replace($uuid_pattern,'',$_GET['chan_uuid']);
$ext = preg_replace($num_pattern,'',$_GET['ext']); $ext = preg_replace($num_pattern,'',$_GET['ext']);
$destination = preg_replace($num_pattern,'',$_GET['destination']); $destination = preg_replace($num_pattern,'',$_GET['destination']);
@ -89,10 +92,12 @@ if (count($_GET) > 0) {
$text = $language->get(); $text = $language->get();
$api_cmd = 'bgapi originate {origination_caller_id_name=' . $text['label-eavesdrop'] . ',origination_caller_id_number=' . $ext . '}user/' . $destination . '@' . $_SESSION['domain_name'] . ' &eavesdrop(' . $chan_uuid . ')'; $api_cmd = 'bgapi originate {origination_caller_id_name=' . $text['label-eavesdrop'] . ',origination_caller_id_number=' . $ext . '}user/' . $destination . '@' . $_SESSION['domain_name'] . ' &eavesdrop(' . $chan_uuid . ')';
} elseif ($switch_cmd == 'uuid_kill') { }
else if ($switch_cmd == 'uuid_kill') {
$call_id = preg_replace($uuid_pattern,'',$_GET['call_id']); $call_id = preg_replace($uuid_pattern,'',$_GET['call_id']);
$api_cmd = 'uuid_kill ' . $call_id; $api_cmd = 'uuid_kill ' . $call_id;
} else { }
else {
echo 'access denied'; echo 'access denied';
return; return;
} }

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -123,7 +123,9 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
if (!empty($row['extension'])) {
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
}
if (!empty($number_alias)) { if (!empty($number_alias)) {
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
} }
@ -142,7 +144,9 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
if (!empty($row['extension'])) {
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
}
if (!empty($number_alias)) { if (!empty($number_alias)) {
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
} }
@ -168,7 +172,9 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
if (!empty($extension)) {
$cache->delete("directory:".$extension."@".$this->domain_name); $cache->delete("directory:".$extension."@".$this->domain_name);
}
if (!empty($number_alias)) { if (!empty($number_alias)) {
$cache->delete("directory:".$number_alias."@".$this->domain_name); $cache->delete("directory:".$number_alias."@".$this->domain_name);
} }

View File

@ -145,7 +145,7 @@ if (!class_exists('basic_operator_panel')) {
$presence_id = $field['presence_id']; $presence_id = $field['presence_id'];
$presence = explode("@", $presence_id); $presence = explode("@", $presence_id);
$presence_id = $presence[0]; $presence_id = $presence[0];
$presence_domain = $presence[1]; $presence_domain = $presence[1] ?? '';
if ($user == $presence_id) { if ($user == $presence_id) {
if ($presence_domain == $_SESSION['domain_name']) { if ($presence_domain == $_SESSION['domain_name']) {
$found = true; $found = true;

View File

@ -274,7 +274,7 @@ if (is_array($activity)) {
$call_number = $ext['dest']; $call_number = $ext['dest'];
} }
else { else {
$call_name = $activity[$ext['dest']]['effective_caller_id_name']; $call_name = $activity[$ext['dest']]['effective_caller_id_name'] ?? null;
$call_number = format_phone($ext['dest']); $call_number = format_phone($ext['dest']);
} }
$dir_icon = 'outbound'; $dir_icon = 'outbound';
@ -391,7 +391,7 @@ if (is_array($activity)) {
} }
else { else {
//user extension //user extension
if ($ext['uuid'] != '' && $ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') { if ($ext['uuid'] != '' && $ext['uuid'] == $ext['call_uuid'] && empty($ext['variable_bridge_uuid'])) {
$draggable = false; $draggable = false;
} }
else if (!empty($ext_state) && $ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') { else if (!empty($ext_state) && $ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') {
@ -476,7 +476,7 @@ if (is_array($activity)) {
} }
//hangup //hangup
if (permission_exists('operator_panel_hangup') || in_array($extension, $_SESSION['user']['extensions'])) { if (permission_exists('operator_panel_hangup') || in_array($extension, $_SESSION['user']['extensions'])) {
if ($ext['variable_bridge_uuid'] == '' && $ext_state == 'ringing') { if (empty($ext['variable_bridge_uuid']) && $ext_state == 'ringing') {
$call_identifier_hangup_uuid = $ext['uuid']; $call_identifier_hangup_uuid = $ext['uuid'];
} }
else if ($dir_icon == 'outbound') { else if ($dir_icon == 'outbound') {