Registration status on desktop - VoIP.ms Wiki

Check out our YouTube channel to watch our simple tutorials that will help you set up most of our features.

Registration status on desktop

From VoIP.ms Wiki

Revision as of 17:53, 3 August 2011 by Alex.voip.ms (Talk | contribs)
Jump to: navigation, search

This is a useful tool for Mac, that let you to see your Registration status on your desktop, using a few applications and interacting with VoIP.ms API, you can achieve this and monitor your lines.

First you need to download and install GeekTool, if you want alerts to pop up to notify you when an outage occurs, also download Growl and be sure to install Growlnotify from the Extras folder on its disk.

  • Log on to your voip.ms account. In the tab marked "Main Menu", select the "SOAP and JSON/REST API".
  • Scroll down to the bottom. Enable the API, assign a password (which can be different from your login password), and enter your IP address. Click the update buttons after each entry.
  • Scroll up a bit, and look for the link that says "Click here to download Example Codes and API Documentation" Download this, unzip, and look for the folder entitled "Examples SOAP for PHP5." In this folder, look for the document "class.voipms.php".
  • Open class.voipms.php using TextEdit. Put your account number and API password in it up top, then save it somewhere handy.

Your account is now set up for automated access and monitoring. Here's a simple script which we'll call from GeekTool:


<?php
require_once("class.voipms.php");
$voipms = new VoIPms();
/* Account #1 */
$account = "[account_subaccount goes here]";
/* Get Registration Status */
$response = $voipms->getRegistrationStatus($account);
/* Get Errors - Invalid_Account */
if($response[status]!='success')
{
echo $response[status];
exit;
}
/* Is Registered */
echo "{$account} Registered : {$response[registered]}
";
if($response[registered]!='yes')
{
exec ('/usr/local/bin/growlnotify -m "VoIP Down"');
}
/* Account #2 */
$account = "[account_subaccount #2 goes here]";
/* Get Registration Status */
$response = $voipms->getRegistrationStatus($account);
/* Get Errors - Invalid_Account */
if($response[status]!='success')
{
echo $response[status];
exit;
}
/* Is Registered */
echo "{$account} Registered : {$response[registered]}
";
if($response[registered]!='yes')
{
exec ('/usr/local/bin/growlnotify -m "VoIP Down"');
}
date_default_timezone_set ("America/Los_Angeles");
echo date("d M y   H:i:s",time())
?>

Copy that and paste into TextEdit. (Note example is made to check two subaccounts-- the code is easily modified to handle any number.) Put your subaccount number(s) in it, and save it with a .php extension in the same folder you just saved class.voipms.php in. In this case, the file is named voip.php.

Geek1.png

Now, open GeekTool. Drag a Shell object onto your desktop. In the Command field of the object, type a php command to execute the file you just saved, the command looks like:

php ~/Documents/geekvoip/voip.php

Good settings for the GeekTool object are a Refresh of perhaps 600 seconds and a timeout of maybe 10 seconds.

Geek2.png

You're done! Position and size the GeekTool object as desired, and it will always be on your desktop. If you've installed Growlnotify, you'll see a pop-up notification on the exceedingly rare occasion that your VoIP line can't be reached.

This Article was originally created by Scott Jordan. Source link: http://unvexed.blogspot.com/2011/07/how-to-be-alerted-when-your-voip-goes.html

Personal tools
Namespaces
Variants
Actions
VoIP.ms Wiki
Guides 🇨🇦
Guías 🇲🇽