Summary:ASTERISK-02236: [patch] Reboot Grandstreams phones from CLI (proprietary NOTIFY)
Reporter:Olle Johansson (oej)Labels:
Date Opened:2004-08-18 12:41:16Date Closed:2011-06-07 14:05:15
Versions:Frequency of
Environment:Attachments:( 0) gsnotify.diff
( 1) gsnotify.diff
( 2) gsnotify.txt
Description:This patch adds command "sip gsnotify" that sends a reboot packet to a Grandstream device. To be able to use this you have to enable SIPGSNOTIFY in the makefile or by "#define SIPGSNOTIFY" in the code. You also need grandstreams administration toolkit to produce the small key file that we attach to the NOTIFY.
Comments:By: Olle Johansson (oej) 2004-08-18 12:47:40

This version is for testing. Since the GS doesn't send OK on the NOTIFY, we're resending it until we kill it. I need to change that.

By: Brian West (bkw918) 2004-08-18 23:22:53

while were at it.. lets add the one for the 7960's and ata's


By: Brian West (bkw918) 2004-08-18 23:23:17

$MESG="NOTIFY sip:$sip_to\@$phone_ip:5060 SIP/2.0
Via: SIP/2.0/UDP $local_ip
From: <sip:$sip_from\@$local_ip>
To: <sip:$sip_to\@$phone_ip>
Event: check-sync
Date: Thu, 10 Apr 2003 21:26:53 -0000
Call-ID: $call_id\@$local_ip
CSeq: 1300 NOTIFY
Contact: <sip:$sip_from\@$local_ip>
Content-Length: 0

By: Olle Johansson (oej) 2004-08-19 01:16:33

bkw_: Is that all? No security at all... I have one for SIPURA as well, will integrate those and change this to "sip reboot <phonebrand> [<filename>] [delete]"

By: Olle Johansson (oej) 2004-08-19 01:17:36

Just for reference, Cisco docs:

By: Olle Johansson (oej) 2004-08-19 01:23:47

The SIPURA requires digest auth on the NOTIFY :-)

By: Brian West (bkw918) 2004-08-19 09:44:23

well for the 7960 you have to send it to one of the valid lines on the phone.. YOu can't just shoot a blind notify at it and it pay attention to it.  It has to come from the proxy and it has to address one of the lines directly on the phone.. Otherwise it ignores it.

By: twisted (twisted) 2004-08-20 00:13:54

I like this idea... let's get some more feedback :)

By: Andreas Anderson (aanderson) 2004-08-23 16:55:19

There is also a patch for the cisco's:


I did not wrote the original patch, so is it ok if i attach it here? It doesn't
work with CVS-HEAD, so i guess someone has to modify it anyway...

A universal command that works on any phone would be cool, the phonebrand
should not be a problem, just use every available method on the target :-)

By: Olle Johansson (oej) 2004-08-24 00:54:33

Now that we have useragent stored, we'll be able to find out what packet to send. As you see the grandstream requires a separate file, that uses a proprietary format, so we still have to issue separate commands for the gs and the other devices. One possibly could have a default filename and path, look for <peer>.reboot in a directory. Then we wouldn't need separate commands... Hmm. This is getting better.

By: powerkill (powerkill) 2004-09-02 16:58:53

Added gsnotify.diff
I put the patch and correct some problem you forgot to register in the cli (ast_cli_register(&cli_gsnotify);) Now working on CVS-HEAD-09/02/04-23:40:47

By: Olle Johansson (oej) 2004-09-03 02:39:49

We need to unregister as well :-)
Thank you for the reminder.

By: tgrman21 (tgrman21) 2004-09-03 12:43:08

Could we have the message/procedure be defined by Useragent as mentioned before?  This way one would only need to type: "sip reboot <extension>" and asterisk would send the correctly formatted message based on the Useragent, eliminating the need for a seperate command in the case something other than a NOTIFY needs to be done/sent.  We would need a configuration file that specifies what the Useragent field looks like for each device so the Useragent field could be parsed and the corresponding NOTIFY, and/or additional messages, could be sent for each device type.  Below is a sample listing of devices I currently have registered to give an idea of the things that will/could need to be parsed:

Useragent    : <Motorola VT1000 mac: 000CE5B02A12 sw:VT21_01.1.16 ln:0 cfg:3.2>
Useragent    : CSCO/7
Useragent    : PolycomSoundPointIP-SPIP_500-UA/1.3.1
Useragent    : Azacall200
Useragent    : Uniden SIP Phone p2 Ver BS4.59a
Useragent    : Cisco ATA 186  v3.0.0 atasip (031210A)

edited on: 09-03-04 12:44

edited on: 09-03-04 13:10

By: twisted (twisted) 2004-10-01 12:03:37

*poke* what's the status here?

By: mustdie (mustdie) 2004-10-01 14:28:07

Reboot for Grandstream just works great.

By: Mark Spencer (markster) 2004-10-01 23:18:57

okay so can we at least have it say "don't know how to reboot <foo>" if it doesn't know the right command for that user agent?

By: Olle Johansson (oej) 2004-10-03 16:09:19

...online again, will start coding coming week... Stay on line :-)

By: Brian West (bkw918) 2004-10-03 18:50:58

I was thinking.... why not do this:


Have template files for each phone/option so that we can add other phones without hacking the code or keeping the already formated sip message in the .c file.


7960 => reboot_7960.txt
ht286 => reboot_ht286.txt

Then you can add more phones without hacking the code?  use some var replacement and such.... anyone anyone?

I was also thinking this same thing for that voicemail notify message sent via email.


By: twisted (twisted) 2004-10-27 16:30:31



By: twisted (twisted) 2004-11-14 21:15:55.000-0600

As much as i hate to do so, I'm going to close this due to lack of interest.  Please feel free to re-open if there are updates/etc.