A typical voicemail in wav format can be 1mb or larger. Even a short voicemail can be 192K. If you are sending this to your cell phone, it can start to use up your data plan, and take longer to download.
This hack will translate your outbound wav file into an mp3. Maybe, works here, never had a problem, ymmv*
You will see savings on the order of 70%. That 192K wav file is now a 40K mp3. And, mp3's are directly supported on most cell phones, inline without needing to load players.
Quick Start for the impatient: download postfix, lame, mutt, ripmime and system-switch-mail. Hack main.cf to do a redirect, and add my script. Seems to work. Note: this does NOT translate the web based voicemail to mp3.. just the emailed copy. Make backups, backup everything, just in case. No warranties, instructions void where taxed or prohibited by law.
We start by loading a different email server: postfix. I like it better than sendmail, we use it in our commercial email security devices, and, I don't know how to do this with sendmail. (If you are a sendmail expert, add your hacks, please)
yum repositories must be set up right, if they aren't, you can't do the downloads.
as root, do:
yum install postfix system-switch-mail lame mutt ripmime procmail
execute: system-switch-mail. select postfix (you can go back by running it again and selecting sendmail)
make sure sendmail is not running anymore: /etc/init.d/sendmail stop.
make sure sendmail doesn't start when booted
chkconfig --del sendmail (note: system-switch-mail might have done this for you already, I don't remember)
make sure postfix is running:
/etc/init.d/postfix start.
and runs when rebooted.
chkconfig --add postfix
chkconfig --level 2345 postfix on
now, the fun stuff:
Add account to do this:
adduser wav2mp3. home directory /home/wav2mp3. don't need/want a password.
mkdir /home/wav2mp3/bin /home/wav2mp3/Mail
get this file and put it into bin: (use curl or wget.. one of these should be installed, if not, use yum to install)
cd /tmp
curl -O http://www.secnap.com/downloads/convertwav.tgz
or
wget http://www.secnap.com/downloads/convertwav.tgz
cd /home/wav2mp2/bin
tar -zxvf /tmp/convertwav.tgz ./
chmod a+x convertwav
need more magic: take email to wav2mp3 and make it run that script:
cd /home/wav2mp3
edit .forward and put this one line there EXACTLY (sends email to procmail, will execute .procmailrc)
"|IFS=' '&&p=/usr/bin/procmail&&test f $p&&exec $p -f||exit 75"
now, .procmailrc:
this exactly: (between the — lines.. don't include ---lines)
—
DROPPRIVS=YES
LOGFILE=/home/wav2mp3/Mail/from
COMSAT=off
VERBOSE=off
PID=$$
:0
- ^X-SIPX-MSGID:\/.*
{
MSGID=$MATCH
}
:0
- ^To:\/.*
{
TO=$MATCH
}
:0
- ^Subject:\/.*
{
SUBJECT=$MATCH
}
:0
- ^Subject:.*Voice Message
/home/wav3mp3/bin/convertwav $MSGID $TO $PID "$
Unknown macro: {SUBJECT}"
:0
! $TO
—
chown -R wav2mp3:wav2mp3 /home/wav2mp3
Add config lines to postfix to redirect outbound email, internally:
echo '/^Content-Type: audio\/x-wav/ REDIRECT wav2mp3@localhost' > /etc/postfix/header_checks
postconf -e header_checks=pcre:/etc/postfix/header_checks
restart postfix.
postfix reload.
should work.. leave yourself a voicemail, see what happens.
- ymmv: your mileage may vary. this worked on a sipx cent os iso for 4.04, upgraded to 4.2.0 with yum.
- mp3 might be patented in and you might need to license it, depending on your use.
- if anything ever breaks, restore.
- if this doesn't work, figure out why, and edit the instructions.