Skip to content

Instantly share code, notes, and snippets.

@andrewyager
Last active July 28, 2016 09:49
Show Gist options
  • Save andrewyager/9944b6bb92bccbe9396675b5cf52d903 to your computer and use it in GitHub Desktop.
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.
<?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