[Home]

Summary:ASTERISK-14786: [patch] NOTIFY to contains double sip:
Reporter:Elazar Broad (ebroad)Labels:
Date Opened:2009-09-08 02:19:09Date Closed:2010-06-02 11:25:07
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Subscriptions
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) doublesip.log
( 1) doublesip.patch
Description:The To header contains an extra sip:

****** ADDITIONAL INFORMATION ******

Full debug attached.


[Sep  8 03:13:11] VERBOSE[21186] chan_sip.c: [Sep  8 03:13:11] Reliably Transmitting (no NAT) to 10.200.24.2:2707:
NOTIFY sip:201@10.200.24.2:2707;rinstance=7358d443ba7c4dd1 SIP/2.0
Via: SIP/2.0/UDP 10.200.50.8:5060;branch=z9hG4bK34fc8cb9
Max-Forwards: 70
Route: <sip:201@10.200.24.2:2707;rinstance=7358d443ba7c4dd1>
From: "asterisk" <sip:asterisk@10.200.50.8>;tag=as0dec184e
To: <sip:sip:201@10.200.24.2:2707;rinstance=7358d443ba7c4dd1>;tag=3666810c
Contact: <sip:asterisk@10.200.50.8>
Call-ID: MTVkOWYxZWE2Yjg1N2ZmMTFmOWE2OWVhNjc0MDIzYmU.
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX
Event: message-summary
Content-Type: text/plain
Subscription-State: active
Content-Length: 80

Messages-Waiting: no
Message-Account: sip:123@10.200.50.8
Voice-Message: 0/0
Comments:By: Elazar Broad (ebroad) 2009-09-08 02:26:23

I'm not sure when this crept in, however, the issue and resolution are quite simple. On line 10822 in chan_sip.c, we have 'if !strncasecmp(uri, "sip:", 4) then append sip: else append nothing', the problem is that strncasecmp() returns 0 when it finds a match, so !0 evaluates to true, appending sip: when we already have one. Removing the ! operator resolves the issue.

By: Leif Madsen (lmadsen) 2009-09-08 11:12:11

This is ready for review by Tilghman, and possible commit.

By: Olle Johansson (oej) 2009-09-10 07:19:08

THis is a bug we've tried to kill many times... Hmm.

By: Olle Johansson (oej) 2009-09-10 07:20:57

While the patch is right, the original code is a poor fix for something that is wrong in another place. We should be in full control on how we handle the uri's - not be able to send sip: sometimes and no prefix other times. This requires a bit more study. We should also not be so focused on "sip:" now that we support "sips:" ;-)

By: Digium Subversion (svnbot) 2010-04-21 13:13:37

Repository: asterisk
Revision: 258305

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r258305 | dvossel | 2010-04-21 13:13:37 -0500 (Wed, 21 Apr 2010) | 12 lines

fixes issue with double "sip:" in header field

This is a clear mistake in logic.  Future discussions
about how to avoid having to handle uri's like this
should take place in the future, but this fix needs
to go in for now.

(closes issue ASTERISK-14786)
Reported by: ebroad
Patches:
     doublesip.patch uploaded by ebroad (license 878)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=258305

By: Digium Subversion (svnbot) 2010-04-21 13:19:10

Repository: asterisk
Revision: 258314

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r258314 | dvossel | 2010-04-21 13:19:10 -0500 (Wed, 21 Apr 2010) | 19 lines

Merged revisions 258305 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r258305 | dvossel | 2010-04-21 13:13:36 -0500 (Wed, 21 Apr 2010) | 12 lines
 
 fixes issue with double "sip:" in header field
 
 This is a clear mistake in logic.  Future discussions
 about how to avoid having to handle uri's like this
 should take place in the future, but this fix needs
 to go in for now.
 
 (closes issue ASTERISK-14786)
 Reported by: ebroad
 Patches:
       doublesip.patch uploaded by ebroad (license 878)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=258314

By: Digium Subversion (svnbot) 2010-04-21 13:23:48

Repository: asterisk
Revision: 258334

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_sip.c

------------------------------------------------------------------------
r258334 | dvossel | 2010-04-21 13:23:48 -0500 (Wed, 21 Apr 2010) | 19 lines

Merged revisions 258305 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r258305 | dvossel | 2010-04-21 13:13:36 -0500 (Wed, 21 Apr 2010) | 12 lines
 
 fixes issue with double "sip:" in header field
 
 This is a clear mistake in logic.  Future discussions
 about how to avoid having to handle uri's like this
 should take place in the future, but this fix needs
 to go in for now.
 
 (closes issue ASTERISK-14786)
 Reported by: ebroad
 Patches:
       doublesip.patch uploaded by ebroad (license 878)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=258334