Last active
July 28, 2016 09:49
-
-
Save andrewyager/9944b6bb92bccbe9396675b5cf52d903 to your computer and use it in GitHub Desktop.
A simple script to check the UA of Polycom handsets. In particular, it tells us if the UA hasn't upgraded to 5.5.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$phones = `asterisk -rx 'sip show peers'`; | |
$tenant=array(); | |
$lines = explode("\n", $phones); | |
foreach ($lines as $line) { | |
$segments = preg_split("/\s+/", $line); | |
if (count($segments)>1) { | |
if ($segments[1]!="(Unspecified)") { | |
$parts = explode("/", $segments[0]); | |
$peer = `asterisk -rx 'sip show peer $parts[0]'`; | |
if (preg_match("/Useragent\s+:\s+(.+)/", $peer, $matches)) { | |
if (stristr($matches[1], 'vvx')) { | |
print $parts[0]."\t".$matches[1]."\n"; | |
if (!stristr($matches[1], '5.5')) { | |
print " **** THIS PHONE IS NOT UPGRADED ****\n"; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment