" /> BP's Weblog: June 2007 Archives

« January 2007 | Main | July 2007 »

June 25, 2007

Why I'm going to miss California...

When I first met Joy she’d clipped a weekly weather forecast from the newspaper, and posted it to her door in her graduate student housing. The clip had been up for several years when I met her, but the irony still stood true: the forecast bent over backward to use varied euphemisms for “it’ll be sunny most of the day”, and, the forecast was correct about 80-90% of the time.

As I started contemplating the big change that was coming, I started peaking at the weather a little more often than I had. Sure enough, even the online electronic forecasts have this problem. Here are two clippings from weather.com across the last two months:

sigh I’m going to miss the Bay Area.

Technorati Tags: ,

June 12, 2007

The big announcement: CMU HCII, Pittsburgh, grad school!

To complete the blog-reawakening, I promised to explain the big change coming up in my life: After 6 years as an individual contributor at a fine private-sector research lab, I've decided it's time to complete my ultimate plan, and go back to school for a PhD.

After much work, applications, exams, discussions and soul-searching, the final decision was to join the Human Computer Interaction Institute at Carnegie Mellon University. My plan is to pursue a PhD project which focuses around the issues of Usable Security, that is, building systems that are more secure than their alternatives, but also have a better user experience. See, for instance, PARC's Network-In-A-Box project for an idea of what I mean. CMU's HCI program appears to be ideal for this, with a world class HCI program, as well as ongoing research which targets the same field.

Pittsburgh will be an adjustment after 6 years living in Silicon Valley, but I'm definitely looking forward to the program.

Technorati Tags: , ,

June 08, 2007

More stupid VoIP tricks: Sidekick2 no-minutes outgoing voice message delivery.

Regular readers might remember my previous T-mobile Sidekick + Asterisk hacks. Not content with the performance of the Toll Averter, Wife Alerter, which uses a clunky synthesized voice to pronounce the text you ask it to send (but has no preview, so it’s not always clear whether the recipient will make sense of what was said), I set out recently to re-invent the project, this time as a direct-audio-delivery hack. Why would you want to record audio and deliver it rather than make a call directly? Easy, Sidekick’s have free e-mail sending, but voice minutes cost. Yes, I’m cheap. :)

I’ve been thinking about building a voice message with reply feature for a while. Sadly, this is about the clunkiest interface around, unlike the one Ping suggests.

Several things needed to come together to make this work. The Sidekick has no native voice recorder, but they recently added a tool called AudioLab to their catalog of tools (it costs $5). This tool lets you record audio, though it is limited to something like 10s at a time, and, unfortunately, suffers from a large-ish delay from hitting record to actually recording. But, it serves the important purpose, which is letting you record audio on the Sidekick, and ship it off somewhere via e-mail.

Now, to put it all together, I needed a way to receive mail, extract the wav file, ship the wav file to someplace that it could be reached by my Asterisk install, then initiate an outgoing call. I’ll go through each step in the extended.

Technorati Tags: ,

Composing the message

To send a message, you merely go into AudioLab and record whatever audio you want to send. It has a limit of about 10s of audio, and a ~3s recording delay. Nonetheless, its possible to send reasonable messages in this space, if you think ahead about what you’re going to say. Since this is offline composing, you can get the message right, rather than rattle off whatever’s on the top of your head when you hear the voicemail tone.

Once happy with the message, I send it to my super-secret e-mail address associated with the rest. AudioLab has a “Email Clip…” option, which basically just attaches the .wav file you’ve recorded to an e-mail, and opens the Sidekick’s e-mail compose window. From there, I change the subject line to the phone number I want the message delivered to, address the message to the magic address (I keep it in my address book, so it doesn’t have to be guessable-easy, although it currently is pretty simple), and hit “Send”.

E-mail processing

For all of this to work, of course, I have to have a server running somewhere that receives my e-mail, and another (possibly the same) which has Asterisk is on it. I’m too cheap to get a big colocated host, so these are different machines, so some of the extra junk that follows is the process of automatically bridging the gap between two machines.

To receive the message, I use most of the same tricks as in the last sidekick voicemail hack. Namely, I have the magic e-mail address tagged in a procmail script, which activates a shell script. The shell script looks like this:


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

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

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

#absorbs stdin
munpack -C $TEMPDIR/source

#convert to GSM
sox $TEMPDIR/source/*.[Ww][Aa][Vv] $TEMPDIR/out.gsm

#echo $SUBJECT > $TEMPDIR/target
#strip any spaces, ('s, or -'s out of the subject line
DESTCHANNEL=`echo "$SUBJECT" | tr -d " ()-"`

SCRIPT=`mktemp $TEMPDIR/script.XXXX`
cat <<EOF1 > $SCRIPT
cp $TEMPDIR/tmp.call /var/spool/asterisk/
chmod a+r /var/spool/asterisk/tmp.call
chown asterisk /var/spool/asterisk/tmp.call
chmod a+r $TEMPDIR/out.gsm
mv /var/spool/asterisk/tmp.call /var/spool/asterisk/outgoing
echo rm -fr $TEMPDIR | at now + 10min
cat <<EOF2 > $TEMPDIR/tmp.call
Channel: Local/${DESTCHANNEL}@outbound-650
Application: Macro
CallerID: 650XXXXXXX
Data: outboundwav|$TEMPDIR/out
shar $SCRIPT $TEMPDIR/tmp.call $TEMPDIR/out.gsm > $TEMPDIR/toxfer.shar
cat $TEMPDIR/toxfer.shar | ssh -C -i remote-ssh-identity user@remoteasteriskhost "cat - | sh - ; sh $SCRIPT"

rm -fr $TEMPDIR

This script is kind of tricky. First, the general flow: 1. Unpack the attachments of the received message. 2. Use the handy audio swiss-army-knife “sox” to convert any .wav attachment into a GSM file in a known location. 3. Extract the target phone number from the subject line of the message 4. Create a script file which will be run on the remote side. This script file will set up the outgoing .call file which asterisk will respond to. More on this below 5. Package up the script, pre-made .call file, and the .gsm file into a shar (shell archive, a funky old Unix trick). 6. Transmit the shell archive over a single ssh connection to the remote machine. During the same ssh session, unpack the share, and execute the included script. Head spinning yet? This overloaded trick lets you transmit a set of files and execute over a single SSH attempt… much tidier than normal, and it reduces the likelihood of tripping abuse-detecting code on the remote host.


The meat is above. The Asterisk part is what goes into the .call file. See here for a tidy description of the settings in this file. Basically, it specifies the target address (Channel:), and application to connect it to (a macro I’ll get to in a sec), and the sending caller ID, and the necessary arguments to that Macro to let it find the audio file converted from the original e-mail.

The macro is just responsible for the user interaction. I currently use the following, though I’d like to improve it somewhat to detect errors and possibly add a message back to the original sender to notify of successful delivery.

(put this in your extensions.conf or wherever you keep your macros)

exten => s,1,DigitTimeout,5             ; Set Digit Timeout to 5 seconds
exten => s,n,ResponseTimeout,10         ; Set Response Timeout to 10 seconds
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Festival(eh recorded message from Bryan)
exten => s,n(play),Background()         ; "play outbound msg"
exten => s,n,Festival(To repeat the message press 1 to leave a reply press 2.)
exten => s,n,Read(CHOICE,,1)
exten => s,n,Goto(,1)
exten => 1,1,Goto(s,play)
exten => 2,1,VoiceMail(101|s)
exten => t,n,Playback(vm-goodbye)
exten => t,n,Hangup

Note that VoiceMail 101 is the mailbox I’ve got hooked up to my voicemail delivery hack, so, I will immediately receive any replies that a recipient of one of these messages leaves.

If anyone else ends up adopting this code, please let me know, or feel free to ask questions. I’ve assumed a lot of unix experience in getting this going, but I’d be happy to help fill in the blanks for anyone who wants to give this a try but can’t quite follow at the level I’ve described it here.


June 05, 2007

Piaggio update

Just a quick status on the ongoing scooter saga:

Last August my scooter stopped operating. The method and previous circumstances of the failure had me mistakenly believing that the scooter had run dry on oil, and would probably have required an expensive repair. The decision was made to delay the repair until a later date.

Well, in August, we finally had it in for repairs. Since we suspected the dealer was at fault for our incorrectly pre-diagnosed failure, we arranged for some help (thanks pqbon!) trucking the scooter up to an independent scooter dealer that looked like it would be more responsible. In the end, the repair ended up being fairly inexpensive, if odd (the vacuum hose into the carburetor had mysteriously hardened and cracked).

Another day I'll have to describe the fun of figuring out a route from San Francisco to Mountain View on a vehicle only really appropriate for roads with speed limits 35mph or below. Suffice to say, that was interesting, and took far too long to figure out. Fortunately, Google had recently launched the “Add a destination...” feature for Google Maps.

Meanwhile, I've been keeping my more recent mileage stats in a Google Spreadsheet. Since they've finally released a graphing feature, it's time to take another stab at graphing my mileage:

(click for larger view)

Unfortunately, the Google spreadsheet graphing doesn't yet support a time axis. Thus the seemingly unneeded “Miles/day” display. Alas, my InfoVis-fu is still underdeveloped. Pay special notice to the point where miles/day appears to drop to 0... it's actually only .15, representing the pathetic number of scooter miles I rode between August and April.

Technorati Tags: ,

June 04, 2007

CHI Wikipedia research

Just filling in this earlier post, part 1. We're pretty excited about our first set of Wikipedia research coming out in CHI 2007. See the related blog post on the Augmented Social Cognition blog.

In essence, we presented a paper with a model and findings about conflict and coordination costs in Wikipedia at the global, article and user level. My contribution to this work was mostly in getting the analysis to work: we spared no expense analyzing a complete dump of the English Wikipedia (though the paper is based on a dump from July of 2006). Thanks to the excellent Hadoop MapReduce system for making that possible. Hadoop was considerably more immature when we started the project, it is rapidly turning into a very powerful tool for large-scale data processing. Nothing quite like computing the revision-to-revision difference of every edit publicly available for Wikipedia in 4 hours or so, eh?

Keep your browsers tuned to the ASC blog for future results in this space.

Technorati Tags: , , ,

The long Blog drought....

So, it's been far too long since I've posted anything to this blog. This is related to a lot of compounding time-sucking problems, alas. To force myself to catch up, here's a list of topics that I'll blog on Real Soon Now. I'll update this entry to point to each post, just in case you run across this post before you see the others.

Stuff that's been going on since January:

Update: All caught up.