From f9bd89ef7844d7c8b9781ccaed058293feb830d9 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 29 Mar 2025 14:48:45 -0600 Subject: [PATCH] Fixed the response when the result is an array --- .../resources/classes/registrations.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/registrations/resources/classes/registrations.php b/app/registrations/resources/classes/registrations.php index 8a66543289..98fea054a7 100644 --- a/app/registrations/resources/classes/registrations.php +++ b/app/registrations/resources/classes/registrations.php @@ -402,23 +402,32 @@ //send the api command if (!empty($command) && $event_socket->is_connected()) { - $response_api[$registration['user']]['command'] = $event_socket->request('api ' . $command); - $response_api[$registration['user']]['log'] = $event_socket->request("log notice $command"); + $response = $event_socket->request('api ' . $command); + $response_api[$user]['command'] = $command; + $response_api[$user]['log'] = $response; } } } //set message if (is_array($response_api)) { - $message = $response_message; foreach ($response_api as $registration_user => $response) { - if (trim($response['command']) != '-ERR no reply') { - $message .= "
\n".$registration_user.": ".$response['command']; + if (is_array($response['command'])) { + foreach($response['command'] as $command) { + $command = trim($command ?? ''); + if ($command !== '-ERR no reply') { + $message .= "
\n".escape($registration_user).": ".escape($response_message); + } + } + } + else { + if (!empty($response['command']) && $response['command'] !== '-ERR no reply') { + $message .= "
\n".escape($registration_user).": ".escape($response_message); + } } } message::add($message, 'positive', '7000'); } - } else { message::add($text['error-event-socket'], 'negative', 5000);