> It's not a solution, but this could be a start. ...
Does that script still work for you? On my account, the 'call' links
include the a_t token in the URL, e.g.
http://www.grandcentral.com/mobile/calls/click_to_call?destno=4154210...
. If a valid a_t is not present, my request is rejected.
A while ago, I wrote a perl script that would call a number given on
the command line or, if run on Windows, on the Clipboard. It works
independently of your browser. Unfortunately, it is much more complex
than I had anticipated, because GC sends some cookies with default
values, then overwrites them (in the same HTTP response) with correct
values. Unfortunately, the LWP library does not handle this
correctly.
First, a few disclaimers:
1. This script sends your GC password unencrypted. If desired, change
http to https for login (requires SSLeay to be properly installed).
2. A bug or improper programmatic use could cause your phone line to
be tied up when needed in an emergency. Be sure that you have a
reliable alternate means of making an emergency call.
3. When GC starts charging for outbound calls, a bug or improper use
could result in unexpected charges to your account.
Let me know of any problems; if you add features, please post the
updated script.
#!/usr/bin/perl
$user = [email address]'; # change this to the email address of
your GC account
$pass = 'mysecret'; # change this to your GC password
$gpnum = '7478675309'; # change this to the number from which
you will be calling
use LWP::UserAgent;
use HTTP::Cookies;
eval { require Win32::Clipboard; $CLIP = Win32::Clipboard(); };
$ua = LWP::UserAgent->new;
$ua->cookie_jar({file=>"lwpcookies.txt", autosave=>1,
ignore_discard=>1});
$ua->requests_redirectable([ 'HEAD' ]);
$cookies = $ua->cookie_jar->as_string;
($a_t) = $cookies =~ /a_t=(\w+)/; # get a_t cookie if present
sub trigger_call {
($destno) = @_; # number to call
for ($try = 0; $try < 3; ++$try) {
unless ($a_t) { # if no a_t value, need to log in
$ua->cookie_jar->clear(); # start with no cookies
$resp = $ua->post('http://www.grandcentral.com/account/
login',
[ 'account[username]' => $user,
'account[password]' => $pass ]);
$cookies = $ua->cookie_jar->as_string;
unless ($cookies =~ /a_t=(\w+)/) { # no a_t cookie, login
must have failed
print "login failed ";
next;
}
$a_t = $1; # save a_t value
($sid) = $cookies =~ /_session_id=(\w+)/; # save session
ID value
($v_s) = $cookies =~ /v_s=(\w+)/; # save v_s value
$ua->cookie_jar->clear(); # clear bogus cookies; reinsert
needed ones
$ua->cookie_jar->set_cookie(0, '_session_id', $sid, '/',
'www.grandcentral.com', '80',
1, 0, 999999, 1);
$ua->cookie_jar->set_cookie(0, 'a_t', $a_t, '/',
'www.grandcentral.com', '80',
1, 0, 999999, 1);
$ua->cookie_jar->set_cookie(0, 'v_s', $v_s, '/',
'www.grandcentral.com', '80',
1, 0, 999999, 1);
print "login ok ";
}
$cparms = "a_t=$a_t&calltype=call&destno=$destno&ani=$gpnum";
$resp = $ua->get("http://www.grandcentral.com/calls/
send_call_request?$cparms");
if ($resp->is_success
&& $resp->content =~ /result=0/) { # call triggered ok
print "trigger ok ";
return 1;
}
print "trigger failed ";
$a_t = ''; # clear a_t so we will login on next
attempt
}
return 0; # all attempts failed
}
# main code starts here
$number = $CLIP->GetText() if !($number = $ARGV[0]) && $CLIP;
$number =~ tr/ \-()//d;
unless ($number =~ /(\d{10})/)
{ print "No valid number to call.\n"; exit(0); }
$number = $1;
print "Attempting to call $number ... ";
trigger_call($number);
print "\n";