toys & code: john wilkes phone booth
John Wilkes Phone Booth – johnwilkesphonebooth.com
As soon as I got my first Google Voice invite, I decided to create a proof-of-concept showing that the technology could be used for an anonymous “phone drop.” A phone drop isn’t a particularly useful in and of itself, but the code for pulling voicemails from Google’s servers has limitless applications. For the back-end I used Perl (emails from the Google account were piped to a Perl script via Google’s email forwarding feature.) PHP was used for the front-end.
#!/usr/bin/perl
while(my $line = <STDIN>) {
if ($line =~ /got new voicemail from/i) {
($area_code) = $line =~ /\((\d{3})\)/;
($phone_num) = $line =~ /(\(.*\d)/;
}
if ($line =~ /google\.com\/voice\/fm\//i) {
$google_link = $line;
last;
}
}
if($area_code =~ /^\d{3}$/) {
# do nothing
} else {
$area_code = '000';
$phone_num = '(000) 000-0000';
}
$google_mp3 = $google_link;
$google_mp3 =~ s/\/fm\//\/media\/svm\//;
($filename) = $google_mp3 =~ /.*\/(.*)/;
chdir("/home/johnwilk/mailpipe/");
$time = time;
open(LOG,">>phone.log");
print LOG "$time,$area_code,$phone_num,$filename\n";
close LOG;
$newfile = $filename . '_' . $time . '_' . $area_code . '.mp3';
system("wget $google_mp3");
system("mv $filename /home/johnwilk/public_html/messages/$newfile");
exit;
