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
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.
Contributor(s):
@ -185,8 +185,8 @@
}
//output suggestions, if any
if (sizeof($suggestions) > 0) {
$resp .= "[\n";
if (!empty($suggestions) && is_array($suggestions) && @sizeof($suggestions) > 0) {
$resp = "[\n";
$resp .= implode(",\n", $suggestions)."\n";
$resp .= "]";
@ -195,4 +195,4 @@
if (isset($_GET['debug'])) { echo "</pre>"; }
}
?>
?>

View File

@ -2,7 +2,7 @@
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008-2019 Mark J Crane
Copyright (C) 2008-2023 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -55,10 +55,10 @@
//process the requests
if (count($_GET) > 0) {
//set the variables
$switch_cmd = trim($_GET["cmd"]);
$action = trim($_GET["action"]);
$data = trim($_GET["data"]);
$direction = trim($_GET["direction"]);
$switch_cmd = trim($_GET["cmd"] ?? '');
$action = trim($_GET["action"] ?? '');
$data = trim($_GET["data"] ?? '');
$direction = trim($_GET["direction"] ?? '');
//setup the event socket connection
$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']);
$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']);
} elseif ($switch_cmd == 'uuid_record') {
}
else if ($switch_cmd == 'uuid_record') {
$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';
} elseif ($switch_cmd == 'uuid_transfer') {
}
else if ($switch_cmd == 'uuid_transfer') {
$uuid = preg_replace($uuid_pattern,'',$_GET['uuid']);
$destination = preg_replace($num_pattern,'',$_GET['destination']);
$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']);
$ext = preg_replace($num_pattern,'',$_GET['ext']);
$destination = preg_replace($num_pattern,'',$_GET['destination']);
@ -89,10 +92,12 @@ if (count($_GET) > 0) {
$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 . ')';
} elseif ($switch_cmd == 'uuid_kill') {
}
else if ($switch_cmd == 'uuid_kill') {
$call_id = preg_replace($uuid_pattern,'',$_GET['call_id']);
$api_cmd = 'uuid_kill ' . $call_id;
} else {
}
else {
echo 'access denied';
return;
}
@ -124,4 +129,4 @@ if (count($_GET) > 0) {
}
}
?>
?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
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.
Contributor(s):
@ -115,7 +115,7 @@
//update do not disturb
if ($user_status == "Do Not Disturb") {
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
foreach ($_SESSION['user']['extension'] as $row) {
//build the array
$array['extensions'][$x]['extension_uuid'] = $row['extension_uuid'];
$array['extensions'][$x]['dial_string'] = '!USER_BUSY';
@ -123,8 +123,10 @@
//delete extension from the cache
$cache = new cache;
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
if(!empty($number_alias)){
if (!empty($row['extension'])) {
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
}
if (!empty($number_alias)) {
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
}
@ -142,8 +144,10 @@
//delete extension from the cache
$cache = new cache;
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
if(!empty($number_alias)){
if (!empty($row['extension'])) {
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
}
if (!empty($number_alias)) {
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
}
@ -168,8 +172,10 @@
//delete extension from the cache
$cache = new cache;
$cache->delete("directory:".$extension."@".$this->domain_name);
if(!empty($number_alias)){
if (!empty($extension)) {
$cache->delete("directory:".$extension."@".$this->domain_name);
}
if (!empty($number_alias)) {
$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 = explode("@", $presence_id);
$presence_id = $presence[0];
$presence_domain = $presence[1];
$presence_domain = $presence[1] ?? '';
if ($user == $presence_id) {
if ($presence_domain == $_SESSION['domain_name']) {
$found = true;

View File

@ -274,7 +274,7 @@ if (is_array($activity)) {
$call_number = $ext['dest'];
}
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']);
}
$dir_icon = 'outbound';
@ -391,7 +391,7 @@ if (is_array($activity)) {
}
else {
//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;
}
else if (!empty($ext_state) && $ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') {
@ -476,7 +476,7 @@ if (is_array($activity)) {
}
//hangup
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'];
}
else if ($dir_icon == 'outbound') {