Minor voicemail patch
[asterisk/asterisk.git] / vmail.cgi
index 7071b34..c2ec262 100755 (executable)
--- a/vmail.cgi
+++ b/vmail.cgi
@@ -182,13 +182,13 @@ sub messages()
 sub getcookie()
 {
        my ($var) = @_;
-       cookie($var);
+       return cookie($var);
 }
 
 sub makecookie()
 {
        my ($format) = @_;
-       cookie(-name => "format", -value =>["$format"]);
+       cookie(-name => "format", -value =>["$format"], -expires=>"+1y");
 }
 
 sub getfields()
@@ -341,11 +341,12 @@ sub message_audio()
 
        # Mailbox and folder are already verified
        if (open(AUDIO, "<$path")) {
+               $size = -s $path;
                $|=1;
                if ($forcedownload) {
-                       print header(-type=>$formats{$format}->{'mime'}, -attachment => "msg${msgid}.$format");
+                       print header(-type=>$formats{$format}->{'mime'}, -Content_length => $size, -attachment => "msg${msgid}.$format");
                } else {                
-                       print header(-type=>$formats{$format}->{'mime'});
+                       print header(-type=>$formats{$format}->{'mime'}, -Content_length => $size);
                }
                
                while(($amt = sysread(AUDIO, $data, 4096)) > 0) {