Xmail filter to Voicemail script

My ISP (iinet) provides me with a VOIP phone-line - that has it's own answering machine system, however, I wanted to be dealing only with my local Asterisk voicemail - and not have to worry about my ISPs voicemail as well - however I decided it was gong to be unavoidable that
at some point there would be messages left on the ISP's voicemail.

Since there is an option with the ISP to send voicemail to a specified email address, i have switched that on and arranged things such that this email ends up at my router (running OpenWRT) and gets processed by XMail.

The email has a wav file of some sort as an attachment that has a name that contains the callerid and the date/time (local) of the call. This means that I need to extract the voicemail - convert it to the required formats, and create a message header.

To start things off I set up a filter in xmail has the following entry:
/var/MailRoot/filters/addtovoicemail @@FILE default 1001

The work is done by the 'addtovoicemail' script that can be found here: addtovoicemail

The script has some embedded python that I borrowed from a script (credit in the script) that extracts the mime attachment and
then uses sox to convert into gsm, wav and WAV formats. It creates a .txt head before then finding the next number in the list and moving all the files.

Interestingly asterisk has no problem with this as long as the numbers are strictly sequential, and WMI seems to be reasonably prompt in showing up (a matter of seconds) on the SIP phone.

Created by: FrogOnWheels, Last modification: Fri 16 of May, 2008 (13:18 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+