Reputation: 65
In my voicemail.conf file, I have a line that looks like this:
mailcmd=php /path/to/file.php 1234
In this case, "1234", which is passed to file.php just fine, is an extension, but frankly, I don't care exactly what gets passed as long as it's something I can use to identify the inbox where the voicemail will get stored. Because of that, I really need to be able to pass it a variable, like this:
mailcmd=php /path/to/file.php "${VM_NAME}"
When I do that, I get an empty argument in my PHP file. I've tried a few different channel variables, but I've never gotten anything to work unless the value is hard-coded.
Is it possible to do what I want to do here, and if so, what am I doing wrong?
Upvotes: 1
Views: 856
Reputation: 15259
From voicemail.sample.conf
externnotify
Want to run an external program whenever a caller leaves a voice mail message for a user? This is where the externnotify command comes in handy. Externnotify takes a string value which is the command line you want to execute when the caller finishes leaving a message.
Note: see an example of an external notification script here.
Note: This command will also run after a person who has logged into a mailbox exits the VoiceMailMain() application. (Remark: This seems not to be the case for Asterisk 1.2.x)
The way it works is basically any time that somebody leaves a voicemail on the system (regardless of mailbox number), the command specified for externnotify is run with the arguments (in this order): context, extension, new voicemails, old voicemails and urgent voicemails. These arguments are passed to the program that you set in the externnotify variable.
Sample is here
Upvotes: 0
Reputation: 65
The short answer is, it's not possible. Asterisk's variables aren't available to voicemail.conf at the point where it's using mailcmd.
As an alternative, I needed to use STDIN inside my PHP script to glean the email header info, which could be configured to get me the extension relatively easily.
Upvotes: 1