[Home]

Summary:ASTERISK-07468: [patch] sip notify to reboot grandstream
Reporter:Peng Yong (ppyy)Labels:
Date Opened:2006-08-05 23:50:09Date Closed:2011-06-07 14:03:01
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) htonl_test.c
( 1) reboot-grandstream.diff
( 2) reboot-grandstream.diff2
( 3) reboot-grandstream.diff3
Description:we can use this patch to reboot grandstream.

tested with grandstream GXP 2000 and HT 386.
Comments:By: Peng Yong (ppyy) 2006-08-05 23:51:42

also remove some unused "md5.h" include header in some files

By: Tilghman Lesher (tilghman) 2006-08-06 00:44:34

Given that most of the time, SIP clients register dynamically, it would be better if the arp lookup could be done automatically for the MAC address, instead of hardcoding a MAC address.  See arp(7) for the interface details.

Also, you should be using htonl(3) to encode the time parameter, instead of the 4-line hack.

By: Peng Yong (ppyy) 2006-08-06 02:09:58

Corydon76:

1. arp lookup is better than hardcoding the MAC address, but it can only used in local network.

2. do you mean following lines:
+ nowtime = time(NULL);
+ digest[4] = (unsigned char) ((nowtime >> 24) & 0xff);
+ digest[5] = (unsigned char) ((nowtime >> 16) & 0xff);
+ digest[6] = (unsigned char) ((nowtime >> 8) & 0xff);
+ digest[7] = (unsigned char) (nowtime & 0xff);

it is used as parameter for MD5Update, it should be:

char *
so i convert the nowtime into digest[4] ... digest[7].

how can i do it using htonl?

By: Tilghman Lesher (tilghman) 2006-08-06 08:42:40

ppyy:  see htonl_test.c.

By: Peng Yong (ppyy) 2006-08-06 09:09:33

thanks for Corydon76. new patch uploaded

By: Clod Patry (junky) 2006-08-06 19:48:57

tried that patch, this is my output:
caster*CLI> sip notify reboot-grandstream 13
REBOOTING type 'reboot-grandstream' to '13'
Sending NOTIFY of type 'reboot-grandstream' to '13'
Transmitting (NAT) to 192.168.1.166:5062:
NOTIFY sip:13@192.168.1.166:5062 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK02ca4883;rport
From: "asterisk" <sip:asterisk@127.0.1.1>;tag=as5ab84f95
To: <sip:13@192.168.1.166:5062>
Contact: <sip:asterisk@127.0.1.1>
Call-ID: 63211978251b60d97f5e2c73775d6d47@127.0.1.1
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: sys-control
Content-Type: application/octet-stream
Content-Length: 24




and the phone didnt reboot.



btw, this is a note i've got:
[...]
Yes, we do. But only GAPSLITE can cause our devices to reboot via SIP
NOTIFY. We sould not respond to any other reboot command sent to us.

Best Regards,
Cindy Li
Grandstream Technical Support



By: Peng Yong (ppyy) 2006-08-06 21:59:58

code clean, remove the nowtime viariable

By: Peng Yong (ppyy) 2006-08-06 22:04:03

junky:

1. which device do you test? and firmware version?

i test all these patches with Grandstream GXP2000 1.1.0.16 and Grandstream HT386 1.0.3.44 from, all works fine.

HT 386 with old firmware will not work.

2. the reset package was same with GAPSLITE, so it can also reset grandstream device. the GAPSLITE  is not free and Grandstream will charge us more than $1000

By: Olle Johansson (oej) 2006-08-07 03:28:09

This used to be proprietary to Grandstream. Have they released this algorithm in the open, really?

By: Peng Yong (ppyy) 2006-08-07 03:49:54

the reset package and algorithm are not proprietary, but GAPSLITE program are
proprietary to Grandstream.

i borrow the algorithm from another open source project SIPX.

By: Olle Johansson (oej) 2006-08-08 03:14:52

If it's not your code, you can't disclaim it to Digium.

By: Peng Yong (ppyy) 2006-08-08 03:29:54

sipx is a java project.

i only borrow algorithm, not code

By: Peng Yong (ppyy) 2006-08-08 03:32:59

i upload the java code from SIPX

By: Olle Johansson (oej) 2006-08-30 12:19:14

kpfleming or markster needs to make a decision about this.

By: Clod Patry (junky) 2006-10-01 00:42:16

Any update here?

By: Olle Johansson (oej) 2006-10-26 13:24:44

Still worried about copyright issues.

By: Olle Johansson (oej) 2006-10-26 14:25:30

I mailed kpfleming and grandstream about this. Waiting for decision.

By: Olle Johansson (oej) 2006-11-17 01:32:33.000-0600

murf, I'm handling this with grandstream.

By: Olle Johansson (oej) 2006-11-18 03:33:24.000-0600

Grandstream confirmed to me and kpfleming that they have no problems with this patch. Thanks for your patience. I wanted avoid any legal problems.

By: Olle Johansson (oej) 2006-11-18 03:34:06.000-0600

pppy: Do you have ok from SIPx to upload this java code under your disclaimer?

By: Olle Johansson (oej) 2006-11-18 03:38:49.000-0600

The code in the patch does not follow the coding guidelines, Please read the coding guidelines and update.

Also, I am a bit hesitant of adding an extra field to every memory allocation of every peer. Can we solve this differently?

By: Olle Johansson (oej) 2006-11-30 01:56:19.000-0600

...waiting for feedback...

By: Peng Yong (ppyy) 2006-11-30 07:30:29.000-0600

oej, please remove the java code.

By: Peng Yong (ppyy) 2006-11-30 08:34:30.000-0600

1. if all the phone is located in local network, then we can resolve the ip to mac address. but we should also reset phone on remote.

2. we also can add mac address as a parameter to application, but mac address is hard to remember and input.

so i prefer to add a parameter to sip.conf

By: Olle Johansson (oej) 2006-11-30 10:49:12.000-0600

Yes, but you could have a pointer to a string. Since we use this in very few cases, allocating a string for every case is a waste of memory...

By: Olle Johansson (oej) 2007-05-16 03:52:55

When we have new code, please re-open this bug report. Thanks.