Freepbx 2.3.1 & Asterisk 1.4.13 voicemails have permissions set incorrectly

Hi all, first post here, so be gentle :slight_smile:

Heres the problem.

If a voicemail is left on an extension, it appears that the permissions are set wrong on the files, as when the message is tried to be retreived (from the phone) then the asterisk console shows the following

== Parsing ‘/var/spool/asterisk/voicemail/default/200/INBOX/msg0000.txt’: Not found (Permission denied)

here is a ls -l of the offending directory

-rwxr-xr-x 1 asterisk asterisk 13728 2007-10-29 16:55 msg0000.gsm
-------rw- 1 asterisk asterisk 277 2007-10-29 16:55 msg0000.txt
-rwxr-xr-x 1 asterisk asterisk 133164 2007-10-29 16:55 msg0000.wav
-rwxr-xr-x 1 asterisk asterisk 13580 2007-10-29 16:55 msg0000.WAV

It’s obvious where the problem is, but what is not obvious, is why is asterisk setting the permissions in this way?

If I chmod 755 msg0000.txt then I can retrieve my messages. The next time a message is left, the same probelm occurs.

I have been reading up for the past 2 days, and have seen several discussions where people have had a similar issue through the web interface, and that is caused by the webserver running as www-data or such, but I cannot find any information on this particular bug or misconfiguration on my part.

My apache2 server runs as user asterisk in the asterisk group. My asterisk server is started from root by amportal start which runs the process as asterisk asterisk.

I think i have everything set the way it should be.

Any help much appreciated, because apart from this, it is all working sweetly. It’s even trunked to a remote asterisk server running freepbx 1.2 and asterisk 1.2 and it works flawlessly.



It is because Asterisk sets the permission as such that Apache has to run as Asterisk to run FreePBX properly. This is an issue in Asterisk, and I don’t think it is configurable although have not bothered to track this issue for a long time.

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

I do appreciate that it isn’t a freepbx problem, and is an issue with asterisk, but after 3 days of trying to register to post a message on thier forums, and failing, I thought I’d try you guys who are in the know about these things.

For me anyway, the issue is nothing to do with apache. My problem is I cannot retrieve messages from the mailboxes because the msgXXXX.txt files permissions are set wrong once the message is left. Maybe I could force it 755 in the source files.

I surely cannot be the only person with this issue?


is asterisk running as user asterisk? Maybe I don’t understand the issue. The Asterisk voicemail system should not have a problem retrieving it’s own message? I have not seen that one.

Also - what issue were you having trying to register for our forum?

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

heres the output from ps -aux | grep asterisk

asterisk 25781 0.0 1.4 20764 7468 ? S Oct28 0:25 /usr/sbin/apache2 -k start
asterisk 25782 0.0 1.4 20780 7476 ? S Oct28 0:06 /usr/sbin/apache2 -k start
asterisk 25783 0.0 1.3 20684 7144 ? S Oct28 0:15 /usr/sbin/apache2 -k start
asterisk 25784 0.0 1.3 20684 7128 ? S Oct28 0:09 /usr/sbin/apache2 -k start
asterisk 25785 0.0 1.3 20684 7104 ? S Oct28 0:08 /usr/sbin/apache2 -k start
asterisk 25787 0.0 1.3 20684 7040 ? S Oct28 0:06 /usr/sbin/apache2 -k start
asterisk 25791 0.0 1.3 20684 7080 ? S Oct28 0:12 /usr/sbin/apache2 -k start
root 27733 0.0 0.1 3652 704 ? S Oct28 0:00 /bin/bash /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 27740 0.0 1.6 21736 8660 ? Sl Oct28 0:29 /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c
asterisk 27805 0.0 0.1 3828 680 ? S Oct28 0:00 -su -c cd /var/www/html/panel && /var/www/html/panel/safe_opserver &
asterisk 27806 0.0 0.2 4144 1476 ? S Oct28 0:00 sh /var/www/html/panel/safe_opserver
asterisk 31047 0.0 1.3 20684 7060 ? S 15:50 0:11 /usr/sbin/apache2 -k start
asterisk 31066 0.0 1.3 20684 6856 ? S 15:50 0:00 /usr/sbin/apache2 -k start
asterisk 31976 0.0 1.5 10876 8216 ? S 19:51 0:01 /usr/bin/perl -w /var/www/html/panel/

The issue with the asterisk forums, was I never received my authorisation email from thier forum with my password in. I went back several times and tried to get it sent again, but no joy. Will try it again now, and see if it’s still the same.

Update to that
Just tried to get my password sent to me again, and no reply to my email account.


from closer look, that is very odd and looks very wrong:

-------rw- 1 asterisk asterisk 277 2007-10-29 16:55 msg0000.txt

that would be rw to the world, but nothing to asterisk or group asterisk? I just left a test message on a 1.4.13 setup and did not get the same results. I have not kept up to see if there are configuration parameters that you could set to effect the permissions?

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

Not that I have found, but I am still looking.

I’m tearing my hair out with it at this stage :slight_smile:


install Asterisk 1.2 on your system in place of 1.4 and see if the problem is still there, it will help you isolate if it is related to Asterisk or something else on your system.

Philippe Lindheimer - FreePBX Project Lead
http// - IRC #freepbx

Have already had an asterisk 1.2 setup on this machine (different hard drive) but the exact same debian install, and custom kernel builds were used on both, so I doubt it’s the system itself. I’d prefer to try and fix this problem, than going to the trouble of downgrading, as I’ll only end up upgrading again, and probably end up back where I am now.



I fudged a fix by editing the apps/voicemail.c file, searching for references to chmod(template, VOICEMAIL_FILE_MODE & ~my_umask); and removing " & ~my_umask" from each.

I re-built the module and now my voicemail works.

I say this is a fudge, because it doens’t address the issue as to why it wasn’t working in the first place, which is obviously down to a umask problem somewhere. Will look into that now and see what I come up with, but at least for now, things are working properly.

Thanks for your time and input.


From what you describe it seems you might have found a bug in asterisk. I’d go to the asterisk site and post it as a bug with them.

I had the same problem with Asterisk 1.4. Had to do same thing as Dave.

Also s far as i can tell the voicemail to email is broken in Asterisk 1.4.

I had the same issue it was due to me using ‘service asterisk restart’ instead of ‘amportal start’.
To fix this i did:
chown -R asterisk:asterisk /var/spool/asterisk/voicemail/
followed by:
amportal restart