Created
July 28, 2016 09:13
-
-
Save andrewyager/f901714b9f6e5b0d4edd8eded057fa3c to your computer and use it in GitHub Desktop.
This is a short script to loop through an set of extensions attached to an Asterisk box, and reboot the Polycom VVX handsets.
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'`; | |
$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