A few times recently I’ve wanted to be able to turn an e-mail into a voice call. This would be especially handy for emergency server monitoring and notification.
Here is my first attempt. It’s also my first attempt at writing something in Python so you definitely use at your own risk!
There is room for improvement as there is no validation on any of the fields extracted from the e-mail.
It also assumes that these components are already in place –
First we need to pipe the incoming e-mail to our Python script. For this I added a line to /etc/aliases –
and ran newaliases –
Now for the script which is called ‘/usr/local/bin/emailspeak.py’
You will need to change at least the USER, SECRET and TRUNK settings at the top of the script to match you Asterisk setup.
And that should be it. To test just send an e-mail to [email protected] with the telephone number you want to call as the subject line, and the text you want to be read in the body.
Don’t forget to write the telephone number in the format that your SIP provider is expecting it.