Skip to content

Instantly share code, notes, and snippets.

View snorfsneflin's full-sized avatar

snorf snorfsneflin

  • earth
View GitHub Profile
@snorfsneflin
snorfsneflin / copy-default-directory.bash
Created November 10, 2015 00:30 — forked from iloveitaly/copy-default-directory.bash
Some tools for managing polycom phones + asterisk systems
# this assumes you have a default directory defined
find /tftpboot/logs/ | ack 'logs/([^-]+)' --output '$1' | sed '/^$/d' | while read mac
do
cp -f "000000000000-directory.xml" "$mac-directory.xml"
done
@viviandarkbloom
viviandarkbloom / Polycom reboot
Created September 10, 2011 04:51
Reboot polycom phones
A bash "one-liner" that requires serious explaining:
A Polycom phone will automatically reboot if you change anything in its webui (but you have to change something). This bash/awk/curl loop changes the length of time between sntp resyncs (basically a super-trivial setting) from 86400 seconds (1 day) to 86401. If you run this twice, you would need to change 86401 back to 86400. This is a super-dirty hack. Also note that this sets the sntp server to pool.ntp.org, and the time zone to Pacific (-28800). Although those settings will get overridden if you're setting those in your DHCP scope (which you should), please adjust as necessary. To clarify, $i is an IP address. In this example, I get a list of phone IPs from asterisk and grep the ones I need to reboot, but you can iterate over any list of IPs.
----------
for i in $(asterisk -rx 'sip show peers' | grep 192.168.10 | awk '{print $2}'); do curl -s --user Polycom:456 -H application/x-www-form-urlencoded --referer http://$i/timeConf.htm -d "tcpIpApp.sntp.ad