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: 
<pre><code>[general]
maxsilence=6
maxmessage=360
minmessage=4
delete=no
mailcmd=/var/www/voicemail-send.php
emailsubject=${VM_MAILBOX}|${VM_MSGNUM}|${VM_CALLERID}|${VM_DUR}
format=wav

default 100 => 101010,Tony,[email protected]</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 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.

That is all… Asterisk will now call voicemail-send.php after each voicemail is saved and if everything is configured correctly as described above, the voicemail email alert and attachment will be sent to the email address for the mailbox configured in the asterisk voicemail.conf file.

You can run the voicemail-send.php script from the command line and enter these lines (then press return about 4 times) to test without actually placing calls, where [email protected] is a real email address and 195 is a real mailbox and 1 a real msg000NUM.wav file to be attached:

To: "Test User" <[email protected]>
Subject: 100|1|8881234567|12:22

Reduslim Kaufen

Cialis 5 mg effetti collaterali Effetti collaterali del Cialis 5 mg Cialis 20mg effetti collaterali Cialis originale in vendita in Svizzera Dove comprare Viagra senza prescrizione in Svizzera Farmacia per Cialis 10mg Prezzo di Viagra in farmacia online Cialis 5mg prezzo Ingredientes de Reduslim Comprare Spedra Avanafil senza ricetta online In Svizzera si compra il Viagra senza ricetta Cialis barato Ordina Viagra Contrareembolso Cialis Adquirir viagra en España Cialis 5 mg efectos secundarios menos frecuentes Reduslim opiniones Incapacidad para mantener una erección tadalafilo barato Авиатор в ПинАп Comprare Cialis 5 mg a buon prezzo Cialis 5 mg effetti collaterali Comprare online Cialis 20mg Farmacia per Cialis originale in Svizzera Ordina Viagra senza ricetta in Svizzera Compra Cialis 10mg Comprare Viagra in farmacia online a buon prezzo Dove trovare Cialis 5mg al miglior prezzo Comprar Reduslim en línea Acquista Spedra Avanafil senza prescrizione Dove comprare il Viagra in Svizzera buy Cialis 5 mg Comprar Viagra Contrareembolso Cuánto cuesta el Cialis 5 mg mejores farmacias para comprar Viagra Efectos secundarios Reduslim adelgazar Impotencia comprar Cialis genérico avanafil prezzo cialis 20 mg prezzo cialis effetti benefici cialis 10 mg Reduslim Kaufen pulse x crypto price prediction avanafil prezzo buy cialis or generic tadalafil