Allow playing of internal messages
[infodrom/phone] / phone.php
index dc68c44..ff8e0bd 100644 (file)
--- a/phone.php
+++ b/phone.php
@@ -75,7 +75,7 @@ function read_directory($directory)
 
   if ($dir = opendir(SPOOL_DIR . '/' . $directory)) {
     while (($filename = readdir($dir)) !== false) {
-      if (($pos = strpos($filename, '.vmsg')) !== false) {
+      if (($pos = strpos($filename, '.vmsg')) !== false || ($pos = strpos($filename, '.msg')) !== false) {
        $fname = substr($filename,0,$pos);
        $info = message_info($directory, $fname);
        $info['fname'] = $fname;
@@ -98,7 +98,13 @@ function send_call($dir, $call)
 {
   $dir = str_replace('/','x',$dir);
   $call = str_replace('/','x',$call);
-  $fname = SPOOL_DIR . '/' . $dir . '/' . $call . '.vmsg';
+
+  if ($dir == 'messages')
+    $ext = '.msg';
+  else
+    $ext = '.vmsg';
+
+  $fname = SPOOL_DIR . '/' . $dir . '/' . $call . $ext;
 
   if (!is_file($fname)) {
     printf("<html><body><h3>Anruf %s in %s nicht gefunden!</h3></body></html>", $call, $dir);