UPDATE [2013-01-20]: The scripts weren’t reading the username and password from the config file properly. In fact, I had accidentally hard-coded my own Vonage username and password in this script. D’oh! Needless to say, I’ve changed my password, and the updated scripts below are fixed. Also, I updated the cron script to allow the usage of Xvfb to be conditional, so you can test the cron script on your desktop and watch it running by editing the script and setting the XVFB variable to “false”.
Until today, I’ve been paying Vonage a ridiculous amount of money (almost $400) for an annual plan with unlimited minutes. It turns out they’ve got a much cheaper monthly plan, something like $14 per month even after all the bogus surcharges, taxes and fees they tack on, with 300 outbound domestic minutes and 300 outbound international minutes, and unlimited inbound minutes. We rarely exceed either of those limits in a month, so the cheaper plan is a much better deal for us, so I switched to it earlier today.
However, we do exceed the domestic minutes limit in busy months, sometimes by quite a lot, and in those months I’d really like to know when we’re on track to exceed the limit, so we can take steps to avoid paying the 5¢ per minute overage charge, like using our cell phones (which have unlimited minutes) for more of our outbound calls.
Unfortunately, Vonage doesn’t provide any sort of account alerts feature which would notify us if we’re on track to exceed our limits, or at the very least if we get close to exceeding them at any point during the month. And I certainly don’t want to have to waste my time logging into the Vonage web site to check our usage!
I therefore decided to automate this check using Selenium. Below are two scripts: a Perl script which does the actual fetching of data from the Vonage site, and a shell script which you can run out of cron to set up the necessary environment, run the Perl script, and then clean up after itself.