[asterisk-users] Voicemail files permission

Gordon Henderson gordon+asterisk at drogon.net
Tue Apr 17 11:12:23 MST 2007


On Tue, 17 Apr 2007, Gustavo Felisberto wrote:

> I'm using asterisk 1.2.14
>
> When asterisk stores voicemail messages in
> /var/spool/asterisk/voicemail/default/EXTENSION/INBOX files are created with:
>
> -rwx------ 1 asterisk web-aster   6690 Apr 17 16:08 msg0002.WAV
> -rwx------ 1 asterisk web-aster   6732 Apr 17 16:08 msg0002.gsm
> -rw------- 1 asterisk web-aster    274 Apr 17 16:08 msg0002.txt
> -rwx------ 1 asterisk web-aster  65324 Apr 17 16:08 msg0002.wav
>
> I needed the files to have modes 660. I tried setting up umask in the script
> that starts asterisk and that did not help. After some searches I found that the
> apps/app_voicemail.c sets a define about this:
>
> #define VOICEMAIL_FILE_MODE     0600
>
> that is used in:
>
> if ((ofd = open(outfile, O_WRONLY | O_TRUNC | O_CREAT, VOICEMAIL_FILE_MODE)) < 0)
>
>
> But no matter what I set in there I always get the files created the same way.
>
> Any ideas?

Yes.

in app_voicemail.c, you've already found the #define, but you might also 
want to add:

                 fchmod (txtdes, 0660) ;

after line 2615.

ie. before the comment line:

                   /* Now play the beep once we have the message number for our next message. */

You also need to edit app.c: round about line 600, change:

 	others[x] = ast_writefile(recordfile, sfmt[x], comment, O_TRUNC, 0, 0700);

into:

 	others[x] = ast_writefile(recordfile, sfmt[x], comment, O_TRUNC, 0, 0660);

Enjoy!

(I did this to enable a web based php voicemail system to work without 
requiring it to be suidperl - I'm guessing you're doing sometime similar!)

Gordon


More information about the asterisk-users mailing list