Add CDR Details, Call Recordings Play, and Call Recordings Download to emergency logs (#7301)

* Create download.php

download.php is required to play and download call recordings

* add CDR Details and Call Recording to emergency logs

* add CDR Details and Call Recording to emergency logs

* combine call details column and call status column

removed the call details column
make the call status column be the hyperlink to the cdr details page

* combine call details column and call status column

removed the call details column
make the call status column be the hyperlink to the cdr details page
This commit is contained in:
chansizzle 2025-03-12 09:40:44 -06:00 committed by GitHub
parent 3167a8ce49
commit 20f3c4eb71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 130 additions and 3 deletions

View File

@ -189,4 +189,31 @@ $text['label-emergency_call_status']['zh-cn'] = "";
$text['label-emergency_call_status']['ja-jp'] = "";
$text['label-emergency_call_status']['ko-kr'] = "";
$text['label-recording']['en-us'] = "Recording";
$text['label-recording']['en-gb'] = "Recording";
$text['label-recording']['ar-eg'] = "تسجيل";
$text['label-recording']['de-at'] = "Aufnahme";
$text['label-recording']['de-ch'] = "Aufnahme";
$text['label-recording']['de-de'] = "Aufnahme";
$text['label-recording']['el-gr'] = "Εγγραφή";
$text['label-recording']['es-cl'] = "Grabación";
$text['label-recording']['es-mx'] = "Grabación";
$text['label-recording']['fr-ca'] = "Enregistrement";
$text['label-recording']['fr-fr'] = "Enregistrement";
$text['label-recording']['he-il'] = "הקלטה";
$text['label-recording']['it-it'] = "Registrazione";
$text['label-recording']['ka-ge'] = "ჩანაწერი";
$text['label-recording']['nl-nl'] = "Opname";
$text['label-recording']['pl-pl'] = "Nagranie";
$text['label-recording']['pt-br'] = "Gravação";
$text['label-recording']['pt-pt'] = "Gravação";
$text['label-recording']['ro-ro'] = "Înregistrare";
$text['label-recording']['ru-ru'] = "Запись";
$text['label-recording']['sv-se'] = "Inspelning";
$text['label-recording']['uk-ua'] = "Запис";
$text['label-recording']['tr-tr'] = "Kayıt";
$text['label-recording']['zh-cn'] = "记录";
$text['label-recording']['ja-jp'] = "録音";
$text['label-recording']['ko-kr'] = "녹음";
?>

View File

@ -0,0 +1,48 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016-2020
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/check_auth.php";
//check permisions
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
//access granted
}
else {
echo "access denied";
exit;
}
//download
if (is_uuid($_GET['id'])) {
$obj = new call_recordings;
$obj->recording_uuid = $_GET['id'];
$obj->binary = isset($_GET['binary']) ? true : false;
$obj->download();
}
?>

View File

@ -30,6 +30,14 @@ $database = new database;
$database->app_name = 'emergency_logs';
$database->app_uuid = 'de63b1ae-7750-11ee-b3a5-005056a27559';
//set permissions for CDR details and call recordings
$permission = array();
$permission['xml_cdr_hangup_cause'] = permission_exists('xml_cdr_hangup_cause');
$permission['xml_cdr_status'] = permission_exists('xml_cdr_status');
$permission['xml_cdr_recording'] = permission_exists('xml_cdr_recording');
$permission['xml_cdr_recording_play'] = permission_exists('xml_cdr_recording_play');
$permission['xml_cdr_recording_download'] = permission_exists('xml_cdr_recording_download');
//process the http post data by action
if (!empty($action) && !empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_logs) != 0) {
@ -122,7 +130,10 @@ $sql .= "e.event, ";
$sql .= "to_char(timezone(:time_zone, e.insert_date), 'DD Mon YYYY') as date_formatted, ";
$sql .= "to_char(timezone(:time_zone, e.insert_date), 'HH12:MI:SS am') as time_formatted, ";
$sql .= "e.insert_date, ";
$sql .= "c.status as status ";
$sql .= "c.status as status, ";
$sql .= "concat(c.record_path, '/', c.record_name) as recording, "; //temp
$sql .= "c.record_path as call_recording_path, ";
$sql .= "c.record_name as call_recording_name ";
$sql .= "from v_emergency_logs e ";
$sql .= "left join v_xml_cdr c ";
$sql .= "on e.emergency_log_uuid = c.xml_cdr_uuid ";
@ -197,7 +208,12 @@ echo "<th class='left'>".$text['label-emergency_date']."</th>\n";
echo "<th class='left'>".$text['label-emergency_time']."</th>\n";
echo "<th class='left'>".$text['label-emergency_extension']."</th>\n";
echo "<th class='left'>".$text['label-emergency_event']."</th>\n";
echo "<th class='left'>".$text['label-emergency_call_status']."</th>\n";
if ($permission['xml_cdr_recording'] && ($permission['xml_cdr_recording_play'] || $permission['xml_cdr_recording_download'])) {
echo "<th class='center'>".$text['label-recording']."</th>\n";
}
if ($permission['xml_cdr_status'] || $permission['xml_cdr_hangup_cause']) {
echo "<th class='left'>".$text['label-emergency_call_status']."</th>\n";
}
echo "</tr>\n";
if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_logs) != 0) {
@ -211,7 +227,43 @@ if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_l
echo " <td>".escape($row['time_formatted'])."</td>\n";
echo " <td>".escape($row['extension'])."</td>\n";
echo " <td>".escape($row['event'])."</td>\n";
echo " <td>".escape($row['status'])."</td>\n";
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
echo " <td class='middle button center no-link no-wrap'>";
if ($row['recording'] !== '/') {
if (permission_exists('call_recording_play')) {
$recording_file_ext = pathinfo($row['call_recording_name'], PATHINFO_EXTENSION);
switch ($recording_file_ext) {
case "wav" : $recording_type = "audio/wav"; break;
case "mp3" : $recording_type = "audio/mpeg"; break;
case "ogg" : $recording_type = "audio/ogg"; break;
}
echo "<audio id='recording_audio_".escape($row['emergency_log_uuid'])."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".escape($row['emergency_log_uuid'])."')\" onended=\"recording_reset('".escape($row['emergency_log_uuid'])."');\" src='download.php?id=".urlencode($row['emergency_log_uuid'])."' type='".$recording_type."'></audio>";
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['emergency_log_uuid']),'onclick'=>"recording_play('".escape($row['emergency_log_uuid'])."')"]);
}
if (permission_exists('call_recording_download')) {
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['emergency_log_uuid']).'&binary']);
}
}
echo " </td>\n";
}
// debug: display file directory and filename of the call recording
/*
if ($permission['xml_cdr_recording'] && ($permission['xml_cdr_recording_play'] || $permission['xml_cdr_recording_download'])) {
if ($row['recording'] !== '/') {
echo "<td>" . escape($row['recording']) . "</td>\n";
}
}
*/
$domain_name = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
if ($permission['xml_cdr_status'] || $permission['xml_cdr_hangup_cause']) {
if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('emergency_logs_view_all')) {
echo " <td>" . (isset($row['status']) && $row['status'] !== '' ? "<a href='https://{$domain_name}/app/xml_cdr/xml_cdr_details.php?id=".urlencode($row['emergency_log_uuid'])."&show=all' target='_blank'>".escape($row['status'])."</a>" : '&nbsp;') . "</td>\n";
}
else {
//echo " <td>" . (isset($row['status']) && $row['status'] !== '' ? escape($row['status']) : '') . "</td>\n";
echo " <td>" . (isset($row['status']) && $row['status'] !== '' ? "<a href='https://{$domain_name}/app/xml_cdr/xml_cdr_details.php?id=".urlencode($row['emergency_log_uuid'])."' target='_blank'>".escape($row['status'])."</a>" : '&nbsp;') . "</td>\n";
}
}
echo "</tr>\n";
$x++;
}