Jan 6 2009
Check Vonage Latest Calls from the command line (or CGI)
Sometimes I forget to forward my Vonage line to my cell phone when leaving the house. I could certainly do it from the iPhone’s browser, but that’s too much of a hassle. Instead I created a small perl script, which will login to Vonage on my behalf and retrieve the latest calls from Vonage’s dashboard. Same can be done from the command line.
Here’s the short script in case you’re interested. This one spits out a simple text/plain page:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/usr/bin/perl use strict; use WWW::Mechanize; use constant VONAGE_USER => 'username'; use constant VONAGE_PASS => 'password'; use constant VONAGE_LOGIN_PAGE => 'https://secure.vonage.com/vonage-web/public/login.htm'; use constant VONAGE_DASHBOARD_PAGE => 'https://secure.vonage.com/vonage-web/dashboard/index.htm'; print "Content-Type: text/plainnn"; my $m = WWW::Mechanize->new(); $m->get(VONAGE_LOGIN_PAGE); $m->submit_form(form_number => 1, fields => { username => VONAGE_USER, password => VONAGE_PASS } ); die "Could not login" unless $m->success; # we are in - let's get the dashboard $m->get(VONAGE_DASHBOARD_PAGE); # trim to what we want to see my $txt = $m->content(format => 'text'); $txt =~ s/^.*?(hh:mm:ss)//; $txt =~ s/Placed Calls.*$//; while($txt =~ m/(S{3}sd{2},sd{4}sd{2}:d{2}sS{2}sd+s)/g) { print "$1n"; } |
And the output looks something like this (the last column is obviously the phone number):
Jan 06, 2009 03:12 PM 1XXXYYYZZZ Jan 06, 2009 02:50 PM 1XXXYYYZZZ Jan 05, 2009 08:40 PM 1XXXYYYZZZ Jan 05, 2009 11:38 AM 1XXXYYYZZZ Jan 04, 2009 04:12 PM 1XXXYYYZZZ Jan 04, 2009 03:03 PM 1XXXYYYZZZ Jan 03, 2009 05:43 PM 1XXXYYYZZZ Jan 03, 2009 05:14 PM 1XXXYYYZZZ
June 19th, 2012 at 9:08 am
Running this resulted in the following:
c:\Downloads>perl vonage.pl
Error GETing https://secure.vonage.com/vonage-web/public/login.htm: Can’t connect to secure.vonage.com:443 (certificate verify failed) at vonage.pl line 14.
Content-Type: text/plainnn
June 22nd, 2012 at 4:34 am
Hi Al – I’m no longer a Vonage customer and can’t check why the script no longer works. Sorry!