User files for conversion to provide the file size
authorJoey Schulze <joey@infodrom.org>
Sun, 20 Dec 2009 22:08:07 +0000 (23:08 +0100)
committerJoey Schulze <joey@infodrom.org>
Fri, 25 Feb 2011 17:40:23 +0000 (18:40 +0100)
phone.php

index e6bc753..6873ae7 100644 (file)
--- a/phone.php
+++ b/phone.php
@@ -105,13 +105,16 @@ function send_call($dir, $call)
     $ext = '.vmsg';
 
   $fname = SPOOL_DIR . '/' . $dir . '/' . $call . $ext;
+  $aufile = SPOOL_DIR . '/' . $dir . '/' . $call . '.au';
 
   if (!is_file($fname)) {
     printf("<html><body><h3>Anruf %s in %s nicht gefunden!</h3></body></html>", $call, $dir);
     return;
   }
 
-  if (($p = popen('vboxtoau < ' . $fname, 'r')) === false) {
+  system('vboxtoau < ' . $fname . ' > ' . $aufile);
+
+  if (($f = fopen($aufile, 'r')) === false) {
     printf("<html><body><h3>Anruf %s in %s konnte geoeffnet werden!</h3></body></html>", $call, $dir);
     return;
   }
@@ -124,12 +127,13 @@ function send_call($dir, $call)
 
   header(sprintf('Content-disposition: inline; filename="%s.au"', $call));
   header('Content-Type: audio/basic');
-  header("Cache-Control: ");
-  header("Pragma: ");
+  header("Content-Length: " . filesize($aufile));
+  header("Cache-Control: no-cache" );
+  header("Pragma: no-cache" );
   sleep(1);
-  fpassthru($p);
-
-  pclose($p);
+  fpassthru($f);
+  fclose($f);
+  unlink($aufile);
 }
 
 function archive_call($call)