(原文:http://bernaerts.dyndns.org/linux/17...-voicemail-mp3)
This guide will explain how to configure Asterisk PBX to send voicemail as email with messages as mp3 attachement.
If, like me, you are using an Asterisk server, you may be using the voicemail by email functionnality. It allows your Asterisk PABX to send your by email all the messages received in your voicemail.
Just imagine :
- someone is calling you on your landline
- he is leaving a message on your answering machine
- after few seconds, you are receiving a mail on your android or i-phone with the message as an attachment
You can call back immediatly or even forward the email for someone else to deal with that call !
One of the main drawback of that functionnality is that Asterisk can generate attachments using only the standard telephony codecs (wav49, gsm, wav). The wav format is widely recognised, but it is quite uncompressed. The wav49 or gsm formats are better in terms of compression, but sadly they are not recognised by all the devices able to deal with your emails.
So why not to use mp3 format for the voicemail attachments ?
This is what this guide is all about. It will explain how to catch the emails sent by Asterisk and convert the audio attachment from a wav file to a mp3 file.
This guide is based on an Asterisk 1.6 version, running under Debian Squeeze.
As it uses only some very basic & standard linux tools, it should be compatible with any Asterisk installation.
It is based on the standard email structure generated by Asterisk.
If you have modify the Asterisk email format, you will need to adjust the script.
PRINCIPLE
The main principles are :
- Asterisk voicemail is configured to generate some wav attachements (uncompressed, best quality available)
- Instead of sending the mail to sendmail, Asterisk is configured to send the mail to one specific script
- This script will do all the job, and finally give back the mail to sendmail
The script will do some ordered tasks :
- catch the stream,
- analyse the email content,
- seperate each mime part,
- pullout the audio attachment,
- compress it to mp3,
- regenerate the mail content,
- send it to sendmail as expected
With this approach, you just need some specific configuration on Asterisk side.
From Asterisk side, the emails are just sent thru another emailer, that's it !
Unlike other methods, you don't need any patch for Asterisk.
You are still using a regular Asterisk, available from your distribution.
So, you can apply any standard update.
Any update to a new Asterisk version should remain fully compatible.