[asterisk-bugs] [Asterisk 0014960]: Attaching msg0001.WAV instead of msg0000.WAV

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Apr 23 09:25:51 CDT 2009


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.digium.com/view.php?id=14960 
====================================================================== 
Reported By:                makafre
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14960
Category:                   Applications/app_voicemail
Reproducibility:            always
Severity:                   block
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.24 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-04-23 09:25 CDT
Last Modified:              2009-04-23 09:25 CDT
====================================================================== 
Summary:                    Attaching msg0001.WAV instead of msg0000.WAV
Description: 

1) Clean the INBOX directory so no messages remain (using rm)
2) Make a call and leave a voicemail
3) Check the INBOX directory, msg0000.WAV is created
4) Produced e-mail tries to attach msg0001.WAV

I tried with 4 or 5 messages and it always look for an attachment
offset by 1, so it's never to be found. Here is my setup:


voicemail.conf
--------------

emailsubject=Message telephonique ${VM_MSGNUM} (boite ${VM_MAILBOX})

emailbody=\n\nBonjour ${VM_NAME},\n\nVous avez recu un message
telephonique:\n\nDate:\t\t\t${VM_DATE}\nDuree:\t\t\t${VM_DUR}\nNumero:\t\t\t${VM_MSGNUM}\nBoite
vocale:\t\t${VM_MAILBOX}\nDe:\t\t\t${VM_CALLERID}\n\n\t\t\t\t--Merci de
votre attention!!\n

mailcmd=nice -n 19 /etc/asterisk/bin/sendvoicemail.sh


sendvoicemail.sh
----------------

#!/bin/sh
cat > /tmp/astmail.txt


astmail.txt
-----------

Date: Wed, 22 Apr 2009 08:55:50 -0400
From: "asterisk" <Messagerie at cl-t069-240cl.privatedns.com>
To: "MaKaFre" <makafre at gmail.com>
Subject: =?ISO-8859-1?Q?Message_telephonique_1_=28boite_5143947865=29?=
Message-ID:
<Asterisk-1-1422536047-5143947865-28731 at cl-t069-240cl.privatedns.com>
X-Asterisk-CallerID: 5142335853
X-Asterisk-CallerIDName: Unknown Name
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----voicemail_1514394786528731872539470"


This is a multi-part message in MIME format.

------voicemail_1514394786528731872539470
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit



Bonjour MaKaFre,

Vous avez recu un message telephonique:

Date:                   Wednesday, April 22, 2009 at 08:55:50 AM
Duree:                  0:11
Numero:                 1
Boite vocale:           5143947865
De:                     "Unknown Name" <5142335853>

                                --Merci de votre attention!!

------voicemail_1514394786528731872539470
Content-Type: audio/x-WAV; name="msg0001.WAV"
Content-Transfer-Encoding: base64
Content-Description: Voicemail sound attachment.
Content-Disposition: attachment; filename="msg0001.WAV"

UklGRtJIAABXQVZFZm10IBQAAAAxAAEAQB8AAFkGAABBAAAAAgBAAWZhY3QEAAAAgGUBAGRh^M
dGGeSAAA6mkXGoMiYCQ3ciSJAmCjxnHjaAxg5DhuJPkmgBu5cRyXnjWiDfUARHXc1m2rBjSO^M
UzlqwAA4jqWmceoCqrGjRk6lOWMaFyvA28iV05hNgFs5auTILqAjyVHr1gqA5TiOkpqe1S1S^M
xAC4SRu3bT4COLIjRXHuBEhOrFqNtARKcZxYkulJISLFCkBkRY5kmQtAG8tV40QvoKVGrWQH^M
....[cut for clarity].....


[root at cl-t069-240cl INBOX]# ls -la
total 32
drwxr-xr-x 2 root root  4096 Apr 22 08:55 .
drwxr-xr-x 7 root root  4096 Apr 21 11:09 ..
-rw-r--r-- 1 root root   280 Apr 22 08:55 msg0000.txt
-rwxr-xr-x 1 root root 18650 Apr 22 08:55 msg0000.WAV


*** Changing make_email_file function from app_voicemail.c solved
the problem; it's just a matter of replacing "msgnum + 1" with "msgnum".


Original:
=========
fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"" ENDL, ctype, format,
msgnum + 1, format);
                fprintf(p, "Content-Transfer-Encoding: base64" ENDL);
                fprintf(p, "Content-Description: Voicemail sound
attachment." ENDL);
                fprintf(p, "Content-Disposition: attachment;
filename=\"msg%04d.%s\"" ENDL ENDL, msgnum + 1, format);


NEW:
====
fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"" ENDL, ctype, format,
msgnum, format);
                fprintf(p, "Content-Transfer-Encoding: base64" ENDL);
                fprintf(p, "Content-Description: Voicemail sound
attachment." ENDL);
                fprintf(p, "Content-Disposition: attachment;
filename=\"msg%04d.%s\"" ENDL ENDL, msgnum, format);


I dont really know the overall impact of this modification but for my
particular case, the problem was solved.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-04-23 09:25 makafre        New Issue                                    
2009-04-23 09:25 makafre        Asterisk Version          => 1.4.24          
2009-04-23 09:25 makafre        Regression                => No              
2009-04-23 09:25 makafre        SVN Branch (only for SVN checkouts, not tarball
releases) => N/A             
======================================================================




More information about the asterisk-bugs mailing list