Re: [asterisk-users] polycom reboot script
Hi Dean - I actually just use the SIP notify command on the Asterisk console to remotely reboot my Polycom phones. It requires a pre-configured sip_notify.conf file and the Polycom option to reboot on config check. You can then call it from a script using: To concur with Avi, I used the script for quite a while, but found situations where it just wouldn't reboot certain phones. I never really bothered to troubleshoot why. Instead, I switched to the sip notify method instead and it has always worked so far. Note, though, that there's a setting in sip.cfg where you can have it only reboot on a notify if the config files have changed (this is the default setting). If you prefer to always have the phone reboot when you issue a sip notify, you can change the following line: specialEvent ... voIpProt.SIP.specialEvent.checkSync.alwaysReboot=1 - Noah On 10/8/06, Avi Miller [EMAIL PROTECTED] wrote: On 09/10/2006, at 12:12 PM, Dean Collins wrote: can anyone give me an idea on how this reboot script works? I actually just use the SIP notify command on the Asterisk console to remotely reboot my Polycom phones. It requires a pre-configured sip_notify.conf file and the Polycom option to reboot on config check. You can then call it from a script using: # asterisk -rx sip notify polycom-reboot 400 (Where 400 is the SIP ID of the phone). I'm interstate at the moment, but if you send me an email, I can lookup the settings when I'm back on Wednesday. Ta, Avi -- National Manager - Special Projects Sydney / Melbourne / Canberra / Hobart / London / 2/340 Gore StreetT: +61 (0) 3 9235 5400 Fitzroy, VIC F: +61 (0) 3 9235 5444 3065 W: http://www.squiz.net . Open Source - Own It - Squiz.net .. / ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] polycom reboot script
On 09/10/2006, at 12:12 PM, Dean Collins wrote: can anyone give me an idea on how this reboot script works? I actually just use the SIP notify command on the Asterisk console to remotely reboot my Polycom phones. It requires a pre-configured sip_notify.conf file and the Polycom option to reboot on config check. You can then call it from a script using: # asterisk -rx sip notify polycom-reboot 400 (Where 400 is the SIP ID of the phone). I'm interstate at the moment, but if you send me an email, I can lookup the settings when I'm back on Wednesday. Ta, Avi -- National Manager - Special Projects Sydney / Melbourne / Canberra / Hobart / London / 2/340 Gore StreetT: +61 (0) 3 9235 5400 Fitzroy, VIC F: +61 (0) 3 9235 5444 3065 W: http://www.squiz.net . Open Source - Own It - Squiz.net .. / ___ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script
On Mon, 29 Aug 2005, Kristian Kielhofner wrote: Matt, It sure is! You should be testing it! :) Test it and see, but 1.2 will be STABLE pretty soon here... No. No NO NO NO NO! :) 1.2 will never be called Stable, based on the controversy surrounding the naming moniker. Do you ever heard Linux 2.0, 2.2 or 2.4 referred to as stable? No. People tend to confuse Stable as in No Additional Features, Bug Fixes Only with Stable as in It never has any problems. But.. I may be too late on this one.. ;) -- Vice President of N2Net, a New Age Consulting Service, Inc. Company http://www.n2net.net Where everything clicks into place! KP-216-121-ST ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
RE: [Asterisk-Users] Polycom Reboot Script
nything like this for grandstream phones? |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED] On Behalf Of |Matthew T. O'Connor |Sent: Lunes, 29 de Agosto de 2005 12:22 a.m. |To: Asterisk Users Mailing List - Non-Commercial Discussion |Subject: [Asterisk-Users] Polycom Reboot Script | |Hello, I'm trying to setup the revised Polycom remote reboot |script as found on: |http://www.voip-info.org/tiki-index.php?page=Polycom+reboot+har dphone+script | |I'm not sure how to use this script, it's just a perl script, |so I tried creating an executable perl script and running it, |but I get the following: | |[EMAIL PROTECTED] agi-bin]# ./polycom_reboot.pl 192.168.3.205 |Checking ARP table. |192.168.3.205 is reachable. |checking for polycom config name... |touching config file /home/polycom/0004f201d398.cfg Use of |uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 97, ARP line 3. |Use of uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 99, ARP line 3. |Use of uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 99, ARP line 3. |reboot of phone 192.168.3.205 was successful | |While it does say it is successful, I can tell you the phone |does NOT reboot. | |line 97 looks like this: |$call_id = $tm . msgto$sip_to; | |It's part of this sub routine: | |sub reboot_sip_phone {# Send the phone a check-sync to reboot it |$phone_ip = shift; | |$local_ip = shift; |$sip_to = shift; |$sip_from = asterisk; |$tm = time(); |$call_id = $tm . msgto$sip_to; |$httptime = `date -R`; |$MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 |Via: SIP/2.0/UDP $local_ip |From: sip:[EMAIL PROTECTED] |To: sip:[EMAIL PROTECTED] |Event: check-sync |Date: $httptime |Call-ID: [EMAIL PROTECTED] |CSeq: 1300 NOTIFY |Contact: sip:[EMAIL PROTECTED] |Content-Length: 0 | |; | |Any Ideas? | |Thanks, | |Matt O'Connor | |___ |--Bandwidth and Colocation sponsored by Easynews.com -- | |Asterisk-Users mailing list |Asterisk-Users@lists.digium.com |http://lists.digium.com/mailman/listinfo/asterisk-users |To UNSUBSCRIBE or update options visit: | http://lists.digium.com/mailman/listinfo/asterisk-users | | ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script
Matthew T. O'Connor wrote: Kristian Kielhofner wrote: Matthew T. O'Connor wrote: Any Ideas? Have a look at /etc/asterisk/sip_notify.conf look for: [polycom-check-cfg] So, from the CLI: asterisk -r sip notify polycom-check-cfg [name] Isn't sip_notify.conf just an Asterisk 1.2 thing? I'm running 1.0.9. I'm trying to setup a production system for my company, do you think 1.2 is ready for that? Thanks, Matt Matt, It sure is! You should be testing it! :) Test it and see, but 1.2 will be STABLE pretty soon here... -- Kristian Kielhofner ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script
Kristian Kielhofner wrote: Matthew T. O'Connor wrote: Isn't sip_notify.conf just an Asterisk 1.2 thing? I'm running 1.0.9. I'm trying to setup a production system for my company, do you think 1.2 is ready for that? It sure is! You should be testing it! :) Test it and see, but 1.2 will be STABLE pretty soon here... I'm happy to help out and test out 1.2 beta, but I don't think pretty soon will be soon enough. We are opening our new office in less than two weeks. I can't imagine that 1.2 will be out of Beta by then. Thanks for you help. Matt ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
RE: [Asterisk-Users] Polycom Reboot Script
Anything like this for grandstream phones? |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED] On Behalf Of |Matthew T. O'Connor |Sent: Lunes, 29 de Agosto de 2005 12:22 a.m. |To: Asterisk Users Mailing List - Non-Commercial Discussion |Subject: [Asterisk-Users] Polycom Reboot Script | |Hello, I'm trying to setup the revised Polycom remote reboot |script as found on: |http://www.voip-info.org/tiki-index.php?page=Polycom+reboot+har dphone+script | |I'm not sure how to use this script, it's just a perl script, |so I tried creating an executable perl script and running it, |but I get the following: | |[EMAIL PROTECTED] agi-bin]# ./polycom_reboot.pl 192.168.3.205 |Checking ARP table. |192.168.3.205 is reachable. |checking for polycom config name... |touching config file /home/polycom/0004f201d398.cfg Use of |uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 97, ARP line 3. |Use of uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 99, ARP line 3. |Use of uninitialized value in concatenation (.) or string at |./polycom_reboot.pl line 99, ARP line 3. |reboot of phone 192.168.3.205 was successful | |While it does say it is successful, I can tell you the phone |does NOT reboot. | |line 97 looks like this: |$call_id = $tm . msgto$sip_to; | |It's part of this sub routine: | |sub reboot_sip_phone {# Send the phone a check-sync to reboot it |$phone_ip = shift; | |$local_ip = shift; |$sip_to = shift; |$sip_from = asterisk; |$tm = time(); |$call_id = $tm . msgto$sip_to; |$httptime = `date -R`; |$MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 |Via: SIP/2.0/UDP $local_ip |From: sip:[EMAIL PROTECTED] |To: sip:[EMAIL PROTECTED] |Event: check-sync |Date: $httptime |Call-ID: [EMAIL PROTECTED] |CSeq: 1300 NOTIFY |Contact: sip:[EMAIL PROTECTED] |Content-Length: 0 | |; | |Any Ideas? | |Thanks, | |Matt O'Connor | |___ |--Bandwidth and Colocation sponsored by Easynews.com -- | |Asterisk-Users mailing list |Asterisk-Users@lists.digium.com |http://lists.digium.com/mailman/listinfo/asterisk-users |To UNSUBSCRIBE or update options visit: | http://lists.digium.com/mailman/listinfo/asterisk-users | | ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script
Matthew T. O'Connor wrote: Any Ideas? Have a look at /etc/asterisk/sip_notify.conf look for: [polycom-check-cfg] So, from the CLI: asterisk -r sip notify polycom-check-cfg [name] -- Kristian Kielhofner ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script
Kristian Kielhofner wrote: Matthew T. O'Connor wrote: Any Ideas? Have a look at /etc/asterisk/sip_notify.conf look for: [polycom-check-cfg] So, from the CLI: asterisk -r sip notify polycom-check-cfg [name] Isn't sip_notify.conf just an Asterisk 1.2 thing? I'm running 1.0.9. I'm trying to setup a production system for my company, do you think 1.2 is ready for that? Thanks, Matt ___ --Bandwidth and Colocation sponsored by Easynews.com -- Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
RE: [Asterisk-Users] Polycom Reboot Script PRI errors!!
Kevin wrote: There is a reboot script posted on the wiki to reboot Polycom telephones. When I execute this script, I get the following messages. I am concerned as this is causing issues with asterisk and the PRI. Does anyone have any ideas why this would be happening? asterisk console: -- Remote UNIX connection -- Remote UNIX connection disconnected and in the Asterisk Log: Nov 28 22:30:42 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Nov 28 22:43:08 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Script: #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home//';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # Populate ARP table print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file exists $arpip = shift; open( ARP, $arp -an| ) || die Couldn't open arp table: $!\n; print checking for polycom config name..., \n; while (ARP) { chomp; $addr = $_; $ip = $_; $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+).*/$1/; $addr =~ s/://g; $addr = lc($addr) . '.cfg'; $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/; if ( $ip eq $arpip ) { last; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } sub touch {# We need to touch the config files or the phone # won't reboot - it depends on time synchronization print touching config file , $polycomconfig, \n; my $now = time; local (*TMP); foreach my $file (@_) { utime( $now, $now, $file ) || open( TMP, $file ) || die ($0: Couldn't touch file: $!\n); } } sub reboot_sip_phone {# Send the phone a check-sync to reboot it $phone_ip = shift; $local_ip = shift; $sip_to = shift; $sip_from = 0; $tm = time(); $call_id = $tm . msgto$sip_to; $httptime = `date -R`; $MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 Via: SIP/2.0/UDP $local_ip From: sip:[EMAIL PROTECTED] To: sip:[EMAIL PROTECTED] Event: check-sync Date: $httptime Call-ID: [EMAIL PROTECTED] CSeq: 1300 NOTIFY Contact: sip:[EMAIL PROTECTED] Content-Length: 0 ; $proto = getprotobyname('udp'); socket( SOCKET, PF_INET, SOCK_DGRAM, $proto ); $iaddr = inet_aton($phone_ip); $paddr = sockaddr_in( 5060, $iaddr ); bind( SOCKET, $paddr ); $port = 5060; $hisiaddr = inet_aton($phone_ip); $hispaddr = sockaddr_in( $port, $hisiaddr ); if ( send( SOCKET, $MESG, 0, $hispaddr ) ) { print reboot of phone , $phone_ip, was successful, \n; } else { print reboot of phone , $phone_ip, failed, \n; } } exit; ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Kevin - I rewrote this some time ago because of some issues with Polycom's latest bootroom/sip update. Try this: Also, serctl, part of the ser package, has a cisco_restart parameter that works on Polycoms as well. John #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home/PlcmSpIp/';# Where you keep your polycom files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, get_extension($phone) ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # Populate ARP table print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; }
RE: [Asterisk-Users] Polycom Reboot Script PRI errors!!
Has anyone written an equivalent script to remote reboot Cisco 79XX phones? Simon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Baker Sent: Monday, 29 November 2004 17:29 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Polycom Reboot Script PRI errors!! Kevin wrote: There is a reboot script posted on the wiki to reboot Polycom telephones. When I execute this script, I get the following messages. I am concerned as this is causing issues with asterisk and the PRI. Does anyone have any ideas why this would be happening? asterisk console: -- Remote UNIX connection -- Remote UNIX connection disconnected and in the Asterisk Log: Nov 28 22:30:42 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Nov 28 22:43:08 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Script: #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home//';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # Populate ARP table print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file exists $arpip = shift; open( ARP, $arp -an| ) || die Couldn't open arp table: $!\n; print checking for polycom config name..., \n; while (ARP) { chomp; $addr = $_; $ip = $_; $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+).*/$1/; $addr =~ s/://g; $addr = lc($addr) . '.cfg'; $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/; if ( $ip eq $arpip ) { last; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } sub touch {# We need to touch the config files or the phone # won't reboot - it depends on time synchronization print touching config file , $polycomconfig, \n; my $now = time; local (*TMP); foreach my $file (@_) { utime( $now, $now, $file ) || open( TMP, $file ) || die ($0: Couldn't touch file: $!\n); } } sub reboot_sip_phone {# Send the phone a check-sync to reboot it $phone_ip = shift; $local_ip = shift; $sip_to = shift; $sip_from = 0; $tm = time(); $call_id = $tm . msgto$sip_to; $httptime = `date -R`; $MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 Via: SIP/2.0/UDP $local_ip From: sip:[EMAIL PROTECTED] To: sip:[EMAIL PROTECTED] Event: check-sync Date: $httptime Call-ID: [EMAIL PROTECTED] CSeq: 1300 NOTIFY Contact: sip:[EMAIL PROTECTED] Content-Length: 0 ; $proto = getprotobyname('udp'); socket( SOCKET, PF_INET, SOCK_DGRAM, $proto ); $iaddr = inet_aton($phone_ip); $paddr = sockaddr_in( 5060, $iaddr ); bind( SOCKET, $paddr ); $port = 5060; $hisiaddr = inet_aton($phone_ip); $hispaddr = sockaddr_in( $port, $hisiaddr ); if ( send( SOCKET, $MESG, 0, $hispaddr ) ) { print reboot of phone , $phone_ip, was successful, \n; } else { print reboot of phone , $phone_ip, failed, \n; } } exit; ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Kevin - I rewrote this some time ago because of some issues with Polycom's latest bootroom/sip update. Try this: Also, serctl, part of the ser package, has a cisco_restart parameter that works on Polycoms as well. John #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home/PlcmSpIp/';# Where you keep your polycom files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, get_extension($phone) ); sub checkphone { # Checks for existence
Re: [Asterisk-Users] Polycom Reboot Script PRI errors!!
Simon Brown wrote: Has anyone written an equivalent script to remote reboot Cisco 79XX phones? Simon Check the wiki... there are two versions for cisco, one that uses the check-sync sip message, the other that simply logs into the phone via telnet and 'reset's the phone. I have made some changes to the latter and use it in production along with some other console commands to remotely setup things like my intercom line, server push, etc. Anyway, the wiki link is http://www.voip-info.org/wiki-Asterisk+phone+cisco+79xx If you look about 1/3 way down the page you'll see a link to 'reboot.pl' pointing to http://mklein.bendtel.net/mkreboot.pl That should get you going. Chris -- Christopher L. Wade Unistar-Sparco Computers, Inc. Senior Systems Administratordba Sparco.com Email: [EMAIL PROTECTED] 7089 Ryburn Drive Phone: (901) 872 2272 / (800) 840 8400Millington, TN 38053 Fax: (901) 872 8482 USA ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script PRI errors!!
Kevin wrote: There is a reboot script posted on the wiki to reboot Polycom telephones. When I execute this script, I get the following messages. I am concerned as this is causing issues with asterisk and the PRI. Does anyone have any ideas why this would be happening? asterisk console: -- Remote UNIX connection -- Remote UNIX connection disconnected and in the Asterisk Log: Nov 28 22:30:42 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Nov 28 22:43:08 NOTICE[1099909936]: PRI got event: 6 on Primary D-channel of span 1 Script: #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home//';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # Populate ARP table print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file exists $arpip = shift; open( ARP, $arp -an| ) || die Couldn't open arp table: $!\n; print checking for polycom config name..., \n; while (ARP) { chomp; $addr = $_; $ip = $_; $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+).*/$1/; $addr =~ s/://g; $addr = lc($addr) . '.cfg'; $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/; if ( $ip eq $arpip ) { last; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } sub touch {# We need to touch the config files or the phone # won't reboot - it depends on time synchronization print touching config file , $polycomconfig, \n; my $now = time; local (*TMP); foreach my $file (@_) { utime( $now, $now, $file ) || open( TMP, $file ) || die ($0: Couldn't touch file: $!\n); } } sub reboot_sip_phone {# Send the phone a check-sync to reboot it $phone_ip = shift; $local_ip = shift; $sip_to = shift; $sip_from = 0; $tm = time(); $call_id = $tm . msgto$sip_to; $httptime = `date -R`; $MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 Via: SIP/2.0/UDP $local_ip From: sip:[EMAIL PROTECTED] To: sip:[EMAIL PROTECTED] Event: check-sync Date: $httptime Call-ID: [EMAIL PROTECTED] CSeq: 1300 NOTIFY Contact: sip:[EMAIL PROTECTED] Content-Length: 0 ; $proto = getprotobyname('udp'); socket( SOCKET, PF_INET, SOCK_DGRAM, $proto ); $iaddr = inet_aton($phone_ip); $paddr = sockaddr_in( 5060, $iaddr ); bind( SOCKET, $paddr ); $port = 5060; $hisiaddr = inet_aton($phone_ip); $hispaddr = sockaddr_in( $port, $hisiaddr ); if ( send( SOCKET, $MESG, 0, $hispaddr ) ) { print reboot of phone , $phone_ip, was successful, \n; } else { print reboot of phone , $phone_ip, failed, \n; } } exit; ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Kevin - I rewrote this some time ago because of some issues with Polycom's latest bootroom/sip update. Try this: Also, serctl, part of the ser package, has a cisco_restart parameter that works on Polycoms as well. John #!/usr/bin/perl -w use Net::Ping; use Socket; $polycompath = '/home/PlcmSpIp/';# Where you keep your polycom files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, get_extension($phone) ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # Populate ARP table print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file
RE: [Asterisk-Users] Polycom Reboot Script - Please wiki-size me
It's been added to the wiki: http://www.voip-info.org/tiki-index.php?page=Polycom+reboot+hardphone+script MATT--- -Original Message- From: John Baker [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 12:38 AM To: [EMAIL PROTECTED] Subject: [Asterisk-Users] Polycom Reboot Script - Please wiki-size me With my thanks to Brian West and his offering in the thread, Subject: Re: [Asterisk-Users] Remote reload Cisco 7960 I offer PolyReboot.pl, a perl script for rebooting Polycom IP Phones PolyReboot.pl takes an IP address as a single argument and reboots the phone. You must have a cfg file in the Polycom style, i.e., 00ab00cd00ef.cfg - all lower case. Further, you need to use ftp for your remote cfg loading, because with ftp synchronization, the phones check the ctimes of the cfg files against what's in their cache when receiving a check-sync in order to determine if rebooting is necessary. I tested this script. It works on my Polycoms. I have the latest bootrom and the SIP 1.1.0 software version. I'm not much of a perl person, and all of this code is heavily borrowed, (Thanks again, Brian), so someone else can prettify it as they see fit. #!/usr/bin/perl # # PolyReboot.pl # # Reboots a Polycom 500 or 600 phone # use Net::Ping; use Socket; $polycompath = '/home/poly/';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # ARP table needs our phone print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file exists $arpip = shift; open( ARP, $arp -an| ) || die Couldn't open arp table: $!\n; print checking for polycom config name..., \n; while (ARP) { chomp; $addr = $_; $ip = $_; $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+).*/$1/; $addr =~ s/://g; $addr = lc($addr) . '.cfg'; $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/; if ( $ip eq $arpip ) { last; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } sub touch {# We need to touch the config file or the phone # won't reboot - it depends on time synchronization print touching config file , $polycomconfig, \n; my $now = time; local (*TMP); foreach my $file (@_) { utime( $now, $now, $file ) || open( TMP, $file ) || die ($0: Couldn't touch file: $!\n); } } sub reboot_sip_phone {# Send the phone a check-sync to reboot it $phone_ip = shift; $local_ip = shift; $sip_to = shift; $sip_from = 0; $tm = time(); $call_id = $tm . msgto$sip_to; $httptime = `date -R`; $MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 Via: SIP/2.0/UDP $local_ip From: sip:[EMAIL PROTECTED] To: sip:[EMAIL PROTECTED] Event: check-sync Date: $httptime Call-ID: [EMAIL PROTECTED] CSeq: 1300 NOTIFY Contact: sip:[EMAIL PROTECTED] Content-Length: 0 ; $proto = getprotobyname('udp'); socket( SOCKET, PF_INET, SOCK_DGRAM, $proto ); $iaddr = inet_aton($phone_ip); $paddr = sockaddr_in( 5060, $iaddr ); bind( SOCKET, $paddr ); $port = 5060; $hisiaddr = inet_aton($phone_ip); $hispaddr = sockaddr_in( $port, $hisiaddr ); if ( send( SOCKET, $MESG, 0, $hispaddr ) ) { print reboot of phone , $phone_ip, was successful, \n; } else { print reboot of phone , $phone_ip, failed, \n; } } exit; Enjoy, John ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] Polycom Reboot Script - Please wiki-size me
Oops, the cut and paste got the better of me. This one might be a little better... #!/usr/bin/perl # # PolyReboot.pl # # Reboots a Polycom 500 or 600 phone # use Net::Ping; use Socket; $polycompath = '/home/poly/';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # ARP table needs our phone print Checking ARP table.\n; $p = Net::Ping-new(icmp); if ( $p-ping( $activephone, 2 ) ) { print $activephone is ; print reachable.\n; } else { die Polycom at , $activephone, is not reachable!; } sleep(1); $p-close(); } sub arp2config {# Gets mac address from arp table, converts # to a polycom config filename, makes sure # the config file exists $arpip = shift; open( ARP, $arp -an| ) || die Couldn't open arp table: $!\n; print checking for polycom config name..., \n; while (ARP) { chomp; $addr = $_; $ip = $_; $addr =~ s/.* ([\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+:[\d\w]+).*/$1/; $addr =~ s/://g; $addr = lc($addr) . '.cfg'; $ip =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/; if ( $ip eq $arpip ) { last; } } $polycomconfig = $polycompath . $addr; unless ( -e $polycomconfig ) { print sorry, polycom config file , $polycomconfig, is not found.\n\n; exit; } return $polycomconfig; } sub touch {# We need to touch the config file or the phone # won't reboot - it depends on time synchronization print touching config file , $polycomconfig, \n; my $now = time; local (*TMP); foreach my $file (@_) { utime( $now, $now, $file ) || open( TMP, $file ) || die ($0: Couldn't touch file: $!\n); } } sub reboot_sip_phone {# Send the phone a check-sync to reboot it $phone_ip = shift; $local_ip = shift; $sip_to = shift; $sip_from = 0; $tm = time(); $call_id = $tm . msgto$sip_to; $httptime = `date -R`; $MESG = NOTIFY sip:[EMAIL PROTECTED]:5060 SIP/2.0 Via: SIP/2.0/UDP $local_ip From: sip:[EMAIL PROTECTED] To: sip:[EMAIL PROTECTED] Event: check-sync Date: $httptime Call-ID: [EMAIL PROTECTED] CSeq: 1300 NOTIFY Contact: sip:[EMAIL PROTECTED] Content-Length: 0 ; $proto = getprotobyname('udp'); socket( SOCKET, PF_INET, SOCK_DGRAM, $proto ); $iaddr = inet_aton($phone_ip); $paddr = sockaddr_in( 5060, $iaddr ); bind( SOCKET, $paddr ); $port = 5060; $hisiaddr = inet_aton($phone_ip); $hispaddr = sockaddr_in( $port, $hisiaddr ); if ( send( SOCKET, $MESG, 0, $hispaddr ) ) { print reboot of phone , $phone_ip, was successful, \n; } else { print reboot of phone , $phone_ip, failed, \n; } } exit; - Original Message - From: John Baker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 22, 2004 11:38 PM Subject: [Asterisk-Users] Polycom Reboot Script - Please wiki-size me With my thanks to Brian West and his offering in the thread, Subject: Re: [Asterisk-Users] Remote reload Cisco 7960 I offer PolyReboot.pl, a perl script for rebooting Polycom IP Phones PolyReboot.pl takes an IP address as a single argument and reboots the phone. You must have a cfg file in the Polycom style, i.e., 00ab00cd00ef.cfg - all lower case. Further, you need to use ftp for your remote cfg loading, because with ftp synchronization, the phones check the ctimes of the cfg files against what's in their cache when receiving a check-sync in order to determine if rebooting is necessary. I tested this script. It works on my Polycoms. I have the latest bootrom and the SIP 1.1.0 software version. I'm not much of a perl person, and all of this code is heavily borrowed, (Thanks again, Brian), so someone else can prettify it as they see fit. #!/usr/bin/perl # # PolyReboot.pl # # Reboots a Polycom 500 or 600 phone # use Net::Ping; use Socket; $polycompath = '/home/poly/';# Where you keep your config files $arp = '/sbin/arp'; # Location of arp command $sipserver = '192.168.XXX.XXX'; # IP of asterisk server $phone = shift; checkphone($phone); touch( arp2config($phone) ); reboot_sip_phone( $phone, $sipserver, Reboot ); sub checkphone { # Checks for existence of phone, makes sure # it's in arp table $activephone = shift; # ARP table needs our phone print Checking ARP table.\n; $p = Net::Ping-new(icmp);