Summary:ASTERISK-20939: Not working parameter mailcmd in voicemail.conf unless Asterisk is running as root
Reporter:Andrew Kolchoogin (gadm)Labels:
Date Opened:2013-01-15 05:37:32.000-0600Date Closed:2013-01-30 18:42:40.000-0600
Versions:Frequency of
is a clone ofASTERISK-19005 Not working parameter mailcmd in voicemail.conf
#include vm_general.conf
#include vm_additional.conf
emailsubject=New voicemail in mailbox ${VM_MAILBOX} from ${VM_CALLERID}
I'm calling to voice mail of number 107, writing message and after that in debagger i see:
[Dec 12 15:07:23] DEBUG[16912] app_voicemail.c: Sent mail to test@mail.ru with command '/space/scripts/vm_sender.pl'
But infact call of script was missing. On 32bit system of Asterisk all working fine)
Comments:By: Andrew Kolchoogin (gadm) 2013-01-15 05:41:12.891-0600

Perhaps where's some issues with launching external commands via system(2) syscall on 64-bit platforms: "mailcmd=/some/shell/script" doesn't work if you were either started Asterisk with "-U unprivilegeduser" or use "runuser=unprivilegeduser" in asterisk.conf.

Removing these parameters cures things and might be suggested as a work-around, but some additional investigation is needed.

By: Rusty Newton (rnewton) 2013-01-24 21:29:40.219-0600

I'm unable to reproduce this behavior as described. On a ubuntu 3.2.0-34-generic x86_64 system, Asterisk executes the script set in mailcmd fine when running as a non-root user that has access to the voicemail directories and the script.

Can you provide any further information on how this may relate to Asterisk and not your Linux environment?

By: Richard Mudgett (rmudgett) 2013-01-25 12:17:09.388-0600

This really seems like a permissions problem.  Permission for Asterisk to run the {{mailcmd=/space/scripts/vm_sender.pl}} script is not granted.

By: Andrew Kolchoogin (gadm) 2013-01-30 12:14:04.708-0600

First of all, I'm running FreeBSD, and platform information has been inadvertently copied from problem report was cloned by me.
It is not a permission problem: I did switched to unprivileged user by 'su -fm asterisk' and have invoked mail script manually: all was worked o.k.
Moreover, Asterisk writes to its logs that it has invoked the script – but script hasn't been run, and there's /tmp/astmail-XXXXXX temporary file being left.
So, how can I run any additional tests to isolate the problem?

By: Rusty Newton (rnewton) 2013-01-30 18:42:12.304-0600

We don't have any additional tests to run, and being that this is on FreeBSD it won't be supported by the core team.

Since this doesn't sound like a bug, I'm going to go ahead and close it out. I recommend that you talk to some other users on the asterisk-users list and #asterisk on IRC. If you find more evidence that it is a bug, or someone else who can reproduce it feel free to re-open or ping us on #asterisk-bugs.