Fixed call recording download and call center show all (#6745)

This commit is contained in:
Alex
2023-06-06 10:14:15 -06:00
committed by GitHub
parent 21fc42f12a
commit f86abd84c4
6 changed files with 23 additions and 27 deletions

View File

@@ -51,14 +51,14 @@
$show = $_GET["show"] ?? '';
//get the http post data
if (!empty($_POST['call_recordings'])) {
if (!empty($_POST['call_recordings']) && is_array($_POST['call_recordings'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_recordings = $_POST['call_recordings'];
}
//process the http post data by action
if (!empty($action) && !empty($call_recordings)) {
if (!empty($action) && is_array($call_recordings) && @sizeof($call_recordings) != 0) {
switch ($action) {
case 'delete':
if (permission_exists('call_recording_delete')) {
@@ -148,10 +148,10 @@
unset($sql, $parameters);
//count the results
$result_count = !empty($call_recordings) ? sizeof($call_recordings) : 0;
$result_count = is_array($call_recordings) ? sizeof($call_recordings) : 0;
//limit the number of results
if ($_SESSION['cdr']['limit']['numeric'] > 0) {
if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) {
$num_rows = $_SESSION['cdr']['limit']['numeric'];
}
@@ -160,8 +160,8 @@
if ($show == "all" && permission_exists('call_recording_all')) {
$param .= "&show=all";
}
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page, false, $result_count); //bottom
list($paging_controls_mini, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, false, $result_count); //bottom
//create token
$object = new token;
@@ -187,7 +187,7 @@
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.($search ? "&search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=\"$('#btn_reset').hide(); $('#btn_search').show();\">";
@@ -244,7 +244,7 @@
}
echo "</tr>\n";
if (!empty($call_recordings)) {
if (is_array($call_recordings) && @sizeof($call_recordings) != 0) {
$x = 0;
foreach ($call_recordings as $row) {
//playback progress bar
@@ -262,7 +262,7 @@
echo " <input type='hidden' name='call_recordings[$x][uuid]' value='".escape($row['call_recording_uuid'])."' />\n";
echo " </td>\n";
}
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('call_recording_all')) {
if ($show == "all" && permission_exists('call_recording_all')) {
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
}
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";

View File

@@ -160,15 +160,11 @@ if (!class_exists('call_recordings')) {
unset($sql, $parameters, $row);
}
//set the path for the directory
// $default_path = $_SESSION['switch']['call_recordings']['dir']."/".$_SESSION['domain_name'];
//build full path
$full_recording_path = $call_recording_path.'/'.$call_recording_name;
//download the file
if ($full_recording_path != '/' && file_exists($full_recording_path)) {
// ob_clean();
$fd = fopen($full_recording_path, "rb");
if ($this->binary) {
header("Content-Type: application/force-download");
@@ -190,8 +186,8 @@ if (!class_exists('call_recordings')) {
if ($this->binary) {
header("Content-Length: ".filesize($full_recording_path));
}
// ob_clean();
// fpassthru($fd);
ob_clean();
fpassthru($fd);
//content-range
if (isset($_SERVER['HTTP_RANGE']) && !$this->binary) {
@@ -303,4 +299,4 @@ if (!class_exists('call_recordings')) {
} //class
}
?>
?>