Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This is a short script to loop through an set of extensions attached to an Asterisk box, and reboot the Polycom VVX handsets.
$phones = `asterisk -rx 'sip show peers'`;
$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 (stristr($peer, 'vvx')) {
print "$parts[0] is a vvx\n";
print "sending sip notify polycom-check-cfg $parts[0]\n";
print `asterisk -rx 'sip notify polycom-check-cfg $parts[0]'\n`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment