<?php
$fname=uniqid();
$attachment_location ="/var/spool/asterisk/monitor/OUT102-20170829-085404-1504022044.824.wav";
if (file_exists($attachment_location)) {
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
header("Cache-Control: public"); // needed for internet explorer
header("Content-Type: application/wav");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($attachment_location));
header("Content-Disposition: attachment; filename=$fname.wav");
readfile($attachment_location);
die();
} else {
die("Error: File not found.");
}
?>