It's very simple, it queries the Asterisk running process for all extension numbers, then uses the SIP NOTIFY method to send a reboot to the phones.
I've tested this on GXP1620 handsets so far and it works great, the phone reboots almost immediately. I've added a 25 second sleep in between each phone reboot, the idea is not to reboot your entire estate at the same time, leaving no phones available. Change that as required. My plan is to schedule this on a cron job overnight anyway, but still spacing reboots out seems to be more sensible.
Caveats: The script simply grabs all extensions and iterates through them all, so it'll try extensions that aren't Grandstream, or aren't phones (e.g. trunks) but those will just get ignored anyway.
It's very simple and rough but will do the job!#!/bin/bashEXTENSION_LIST=`asterisk -rx "sip show peers" | cut -d "/" -f 1 |cut -d " " -f 1 | grep -o '[0-9]*'`while read -r line; doecho "Rebooting extension: $line ..."asterisk -rx "sip notify spa-reboot $line"echo "(sleep)"sleep 25done <<< "$EXTENSION_LIST"
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! Verizon flip phones for sale
ReplyDeleteThanks for your beyond belief blogs stuff.
ReplyDeletebusiness tampa fl
How can I use that to reboot phone if it becomes unreachable for X amount of time ?
ReplyDeleteThank You
I discovered your website internet site online and appearance a couple of your early posts. Always maintain inside the top notch operate. I additional your Rss to my MSN News Reader. Seeking toward reading much more on your part down the road!… VoIP Service Near Me
ReplyDeleteIf you are looking for more information about flat rate locksmith Las Vegas check that right away. best phones under 9000 with fingerprint sensor
ReplyDeleteWow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. best 4g mobile under 4000 amazon
ReplyDelete