[asterisk-bugs] [Asterisk 0012282]: Asterisk sends SIP-over-TCP INVITE to wrong port number

noreply at bugs.digium.com noreply at bugs.digium.com
Wed Mar 26 05:48:16 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12282 
====================================================================== 
Reported By:                rjain
Assigned To:                putnopvut
====================================================================== 
Project:                    Asterisk
Issue ID:                   12282
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 110578 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             03-23-2008 08:28 CDT
Last Modified:              03-26-2008 05:48 CDT
====================================================================== 
Summary:                    Asterisk sends SIP-over-TCP INVITE to wrong port
number
Description: 
The scenario is that a SIP UA registers with Asterisk using TCP transport.
The UA puts its IP address, port number and transport=tcp parameter in the
REGISTER's Conact: header. Asterisk stores these contact parameters
correctly in its registration table. However, when it comes to sending an
INVITE to this UA, Asterisk puts a wrong port number in the destination
port number field of the TCP header. Due to this, the UA never receives the
INVITE. The TCP port number is actually correct in the SIP payload
including the Request-URI and the To: header in the INVITE, but it's not
correct in the TCP header. 

Asterisk log file and wireshark trace are attached.
====================================================================== 

---------------------------------------------------------------------- 
 rjain - 03-26-08 05:48  
---------------------------------------------------------------------- 
Thanks for the quick turnaround on this. The patch actually breaks
registration itself. Asterisk generates 200 OK to the REGISTER but the 200
OK never gets to the machine running the client. A few seconds later
Asterisk crashes. gdb backtrace and sip debug outputs are below.
 
I'll be more than happy to test your patches as we work through this, but
if you need a way to test this yourself, let me know. I'm using Windows
Messenger as my SIP/TCP client. This can also be tested using SIPp. I can
write up some SIPp scripts and send them your way if you like.

(gdb) where
http://bugs.digium.com/view.php?id=0  0x00602a60 in fgets () from
/lib/tls/libc.so.6
http://bugs.digium.com/view.php?id=1  0xf66e898e in _sip_tcp_helper_thread
(pvt=0x0, ser=0x9ad9fc0) at
chan_sip.c:2212
http://bugs.digium.com/view.php?id=2  0x0811ab66 in ast_make_file_from_fd
(data=0x9ad9fc0) at tcptls.c:445
http://bugs.digium.com/view.php?id=3  0x081247f5 in dummy_start (data=0x9ad9fc0)
at utils.c:870
http://bugs.digium.com/view.php?id=4  0x007e41d5 in start_thread () from
/lib/tls/libpthread.so.0
http://bugs.digium.com/view.php?id=5  0x006752da in clone () from
/lib/tls/libc.so.6
(gdb)
 

Connected to Asterisk SVN-trunk-r110578M currently running on localhost
(pid = 9604)
localhost*CLI> sip set debug on
SIP Debugging enabled
localhost*CLI>
<--- SIP read from TCP://192.168.15.100:3630 --->
REGISTER sip:192.168.15.101 SIP/2.0
Via: SIP/2.0/TCP 192.168.15.100:9327
Max-Forwards: 70
From:
<sip:9001 at 192.168.15.101>;tag=da00a00e905446b0bb1b6f9bf12a1696;epid=1652e880b3
To: <sip:9001 at 192.168.15.101>
Call-ID: 92282ef187c842419ffbb5bf8bbff907
CSeq: 1 REGISTER
Contact: <sip:192.168.15.100:9327;transport=tcp>;methods="INVITE, MESSAGE,
INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER,
BENOTIFY";proxy=replace
User-Agent: RTC/1.3.5470 (Messenger 5.1.0701)
Supported: com.microsoft.msrtc.presence, adhoclist
ms-keep-alive: UAC;hop-hop=yes
Event: registration
Allow-Events: presence
Content-Length: 0


<------------->
--- (14 headers 0 lines) ---
Sending to 192.168.15.100 : 9327 (no NAT)

<--- Transmitting (no NAT) to 192.168.15.100:9327 --->
SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.15.100:9327;received=192.168.15.100
From:
<sip:9001 at 192.168.15.101>;tag=da00a00e905446b0bb1b6f9bf12a1696;epid=1652e880b3
To: <sip:9001 at 192.168.15.101>;tag=as55ca9fb2
Call-ID: 92282ef187c842419ffbb5bf8bbff907
CSeq: 1 REGISTER
User-Agent: Asterisk PBX SVN-trunk-r110578M
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
Expires: 120
Contact: <sip:192.168.15.100:9327;transport=tcp>;expires=120
Date: Tue, 25 Mar 2008 23:35:15 GMT
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '92282ef187c842419ffbb5bf8bbff907' in
32000 ms (Method: REGISTER)
Really destroying SIP dialog '0d43654a061f59756be514254da3d9d3 at 127.0.0.1'
Method: REGISTER
localhost*CLI> 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-26-08 05:48  rjain          Note Added: 0084554                          
======================================================================




More information about the asterisk-bugs mailing list