Tony Landis home

Asterisk PBX Voicemail - Configuring and Sending Emails the Easy Way

I have been very disappointed with the voicemail emailing capabilities of Asterisk PBX. If you need to use a SMTP host, it can be a time consuming task to configure sendmail, postfix, etc, to use an external SMTP provider. And once you get the emails to send, customizing and scripting is very limited.

I wanted to be able to use SMTP, add BCC and CC recipients, have full scripting control over the message body and subject, and attach the voicemail recording in the e-mail. It seemed like writing a script and using the ‘mailcmd’ setting in the general section of the asterisk voicemail.conf file was a suitable way to handle this, so I took this route.

First, my asterisk voicemail.conf entries (the mailcmd, emailsubject, and format settings must be adhered to):

REXML could not parse this XML/HTML: 

default 100 => 101010,Tony,</code></pre>

Then I dropped the PHP script below into my /var/www/ directory with a name of voicemail-send.php and ran chown asterisk:asterisk on it to be sure asterisk can execute.

You will need to download the phpmailer library and set the $mail_lib_path variable with the path to that library, as well as make sure the $ast_vm_path is correct. The email/smtp variables will also need to be set with your correct information.

blog comments powered by Disqus