Performing batch upgrades on Polycom handsets

At Real World, we occasionally need to upgrade a large batch of Polycom Handsets en masse, and remotely.

Recently we needed to push out firmware updates for VVX series to address a bunch of minor, but significant bugs that have been around for quite some time.

There is a relatively well-known process for this:

  1. Make the updated firmware available on your provisioning server
  2. Send a “sip notify” packet to the phone requesting it check the configuration from the server
  3. Wait for the phone to reboot

People have written some scripts to make this less painful when you have SIP peers that are all very similar and sequential in name. We needed to do this for a few thousand phones, with all dissimilar usernames. Typing in ‘sip notify polycom-check-cfg EXTEN’ 2000 times at an Asterisk prompt not the way I planned to spend my evening!

I wrote this “quick and dirty” script to accomplish this task.

<?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`;
   }
  }
 }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s