изменен только один файл проекта:
Код: Выделить всё
[root@]# cat ./dl.php
<?php
require_once 'sendfile.class.php';
function checkSource($sfilename) {
$playbackdir = '/var/lib/asterisk/playback/';
if (!file_exists($sfilename)) {
return $sfilename;
}
$sfilepathinfo = pathinfo($sfilename);
if ($sfilepathinfo['extension'] !== 'gsm') {
return $sfilename;
}
$shortfilename = $sfilepathinfo['filename'];
$dfilename = $playbackdir.$shortfilename.".wav";
$dfilenamemp3 = $playbackdir.$shortfilename.".mp3";
if (file_exists($dfilenamemp3)) {
return $dfilenamemp3;
}
$commandString = "sox $sfilename -e signed-integer $dfilename && lame -V2 $dfilename $dfilenamemp3 && rm -f $dfilename";
$dfilename = $dfilenamemp3;
shell_exec($commandString);
if (file_exists($dfilename)) {
return $dfilename;
} else {
return $sfilename;
}
}
if (isset($_REQUEST['f'])) {
//$fname = base64_decode($_REQUEST['f']);
$fname = checkSource(base64_decode($_REQUEST['f']));
$file = $fname;
$send = new Sendfile;
$send->Path = $file;
$send->send();
exit;
}
header('HTTP/1.1 404 Not Found');