« eGO cycle registration in California? | Main | Quick SocialText RSS from Bloglines tip »

Sidekick voicemail delivery tricks

Wow. So, the Sidekick I have can receive .wav files, attached to messages. However, it has a ridiculously short incoming .WAV limit. I'm not sure if this is because I have prepaid service, or if the Sidekick just has this tiny limit on its own.

Anyway, why would I even care? Well, with my previous GSM phone (a fairly pedestrian Moto V330), I'd figured out that pushing a voicemail into an email destined for the phone would get converted to an incoming MMS, with the properly formatted sound file attached. So, I set up my VoIP system to collect my voicemails, and I set it to forward voicemail to the e-mail address of my phone. Presto, I get voicemail push-delivered, with local archiving, and no per-minute fees. As a bonus, I could forward them along to anyone who could receive an MMS or an e-mail.

With the Sidekick, however, this didn't work. The limit on incoming sounds amounted to something like 15-20s of audio. More than that, and you'd get told you had an attachment, but have no way to retrieve it from the device itself. For whatever reason, you can't even play .WAV files from the Sidekick's built-in web browser, only from e-mail.

Not content to have a fancier gadget with less capabilities than a pre-existing one, I set out to figure a workaround. In the end, I strung together a bunch of Unix shell tricks to receive, convert, chop, re-convert, and transmit as a new e-mail the received voicemail. This looked roughly like this:

VoIP voicemail -> via e-mail to local account -> procmail match -> convert script -> Sidekick.

Gross, but, do-able, right? Making the conversion worked was more tricky. Fortunately, everything I needed was already a Debian package. Below the fold is the entire script needed to pull off the trick.

Technorati Tags: ,

--- start

#!/bin/bash

if ! TEMPDIR="`mktemp /tmp/splitvoicemail.XXXXXX`"; then
  echo "$0 is unable to create the temporary file."
  exit 1
fi

# not perfect, but, we'll live
rm $TEMPDIR
mkdir $TEMPDIR

mkdir -p $TEMPDIR/source
mkdir -p $TEMPDIR/tomail

#absorbs stdin
munpack -C $TEMPDIR/source

#convert to raw WAV
sox $TEMPDIR/source/*.WAV -u $TEMPDIR/out.wav

#wavsplit to make the splits
wavsplit -s $TEMPDIR/out.wav 12 24 36 48

for f in `ls $TEMPDIR/out`; do
        sox $TEMPDIR/out/$f -g $TEMPDIR/tomail/$f
done

FILES=`find $TEMPDIR/tomail/ -type f | tr '\n' ','`
# strip trailing ,
FILES="${FILES:0:$((${#FILES}-1))}"
echo $FILES > $TEMPDIR/files.lst

echo Your voicemail should be attached | biabam $FILES -s "You've received a voicemail." youremail@address.com

rm -fr $TEMPDIR

--- end

Then, make sure the script gets invoked appropriately. Here's how I invoke mine (goes into a .procmailrc):

--- start

:0
* ^TO(match something appropriate here)
| /path/to/script

--- end

Post a comment

Verification (needed to reduce spam):