mike-xu / doubango

Automatically exported from code.google.com/p/doubango
0 stars 0 forks source link

Packet buffer is truncated to 1024 bytes when using TLS #290

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start call from device A
2. Accept call on device B

What is the expected output? What do you see instead?
Call is terminated on device B.

What version of the product are you using? On what operating system?
Latest Doubango used for iOS. TLS is enabled.

Please provide any additional information below.

REGISTER log:

RECV:SIP/2.0 200 OK
Via: SIP/2.0/TLS 
192.168.0.101:58026;branch=z9hG4bK-723995576;rport=58026;received=178.121.21.117
From: <sip:2342@x.x.x.x>;tag=804664151
To: <sip:2342@x.x.x.x>;tag=f251698a449604a8e959b300b5a3ea81.5b44
Call-ID: 3e657720-bdbd-3707-3631-bc9fe2dcabbc
CSeq: 899181813 REGISTER
Contact: 
<sips:2342@192.168.0.101:57182;transport=tcp>;expires=327;received="sip:178.121.
21.117:57182;transport=TLS", 
<sips:2342@192.168.0.101:57713;transport=tcp>;expires=1096;received="sip:178.121
.21.117:57713;transport=TLS", 
<sips:2342@192.168.0.101:57723;transport=tcp>;expires=1330;received="sip:178.121
.21.117:57723;transport=TLS", 
<sips:2342@192.168.0.101:57725;transport=tcp>;expires=1431;received="sip:178.121
.21.117:57725;transport=TLS", 
<sips:2342@192.168.0.101:57840;transport=tcp>;expires=2120;received="sip:178.121
.21.117:57840;transport=TLS", 
<sips:2342@192.168.0.101:57880;transport=tcp>;expires=2464;received="sip:178.121
.21.117:57880;transport=TLS", <sips:2342@192.168.0.101:57884;transport=tcp>;ex

*INFO: No all SIP headers in the TCP buffer.

I tried to debug and I found: 

tnet_transport_cfsocket.c line 134

ret = len = CFReadStreamRead(active_socket->cf_read_stream, buffer, 
(CFIndex)TNET_BUFFER_STREAM_MIN_SIZE);

Buffer is truncated to TNET_BUFFER_STREAM_MIN_SIZE(1024) bytes. Therefore 
INVITE is truncated and call is terminated.

Original issue reported on code.google.com by denis.tr...@gmail.com on 22 Jul 2013 at 12:05

GoogleCodeExporter commented 9 years ago
It's correct to truncate the message. You can even send it byte by byte :)
The stack will concatenate all message until it gets the complete headers and 
content.
"*INFO: No all SIP headers in the TCP buffer." -> not an error, it's expected 
for any connect transport (TCP, TLS, WebSocket...)

Original comment by boss...@yahoo.fr on 22 Jul 2013 at 5:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for answer. I attached log files when TLS is enabled.

Original comment by denis.tr...@gmail.com on 22 Jul 2013 at 6:29

Attachments:

GoogleCodeExporter commented 9 years ago
I found problem. Our server sends route field with no port and doubango tries 
connect to peer with port 5060 by default. Is it right?

Original comment by denis.tr...@gmail.com on 23 Jul 2013 at 6:17