[pjsip] TCP problems

Anshuman S. Rawat arawat at 3clogic.com
Fri Jun 1 11:13:23 EDT 2012


Hi,

I am trying to use SIP over TCP on PJSIP and running into problems.

I have a feeling that memory is being clobbered somewhere while receiving messages. I added some logging to the pjsip_tpmgr_receive_packet() i.e. I log the contents of the packet before any processing is done (i.e. removal of leading newlines), then just before pjsip_find_msg() is called (for TCP only) and log the error if any. Here's one such trace:


//message as before removing leading newlines
18:10:14.062 sip_transport.  1. RX 402 bytes packet from tcp 50.16.212.227:7060 :
SIP/2.0 100 Giving a try
Via: SIP/2.0/TCP 192.168.3.35:3768;rport=3768;branch=z9hG4bKPjd780ec6470ca4d65be801f42695e320a;received=115.252.66.186
From: sip:webuser at switch2.3clogic.com:5506;tag=2a0e5ae02aeb4ea7baa482560845137f
To: sip:sim1000000215 at switch2.3clogic.com:5506
Call-ID: 5014d797232a4bf8a458e82daf81a92b
CSeq: 12836 INVITE
Server: OpenSIPS (1.6.0-tls (i386/linux))
Content-Length: 0

-- end of packet.
//message before call to pjsip_find_msg()
 18:10:14.062 sip_transport.  2. RX 402 bytes packet from tcp 50.16.212.227:7060 :
SIP/2.0 180 Ringing
Via: SIP/2.0/TCP 192.168.3.35:3768;received=115.252.66.186;rport=3768;branch=z9hG4bKPjd780ec6470ca4d65be801f42695e320a
Record-Route: <sip:50.16.212.227:5506;lr=on;ftag=2a0e5ae02aeb4ea7baa482560845137f;did=9ef.24fc1bd4>
Record-Route: <sip:50.16.212.227:7060;r2=on;lr;ftag=2a0e5ae02aeb4ea7baa482560845137f>
Record-Route: <sip:50.16.212.227:7060;transport=tcp;r2=on;lr;ftag=2a0e5ae02aeb4ea7baa482560845137f>
From: sip:webuser at switch2.3clogic.com:5506;tag=2a0e5ae02aeb4ea7baa482560845137f
To: sip:sim1000000215 at switch2.3clogic.com:5506;tag=as6771ece1
Call-ID: 5014d797232a4bf8a458e82daf81a92b
CSeq: 12836 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:sim1000000215 at 50.16.212.126:5080>
Content-Length: 0

-- end of packet.
 18:10:14.062 sip_transport.  3. RX 402 bytes packet from tcp 50.16.212.227:7060 : msg_status: 171024


As you can see the original message has been clobbered by the next message in sequence. I am still trying to figure out where memory for incoming messages is allocated and how it's being used.
If anyone has any pointers for this, please feel free to share them. Any help will be appreciated.

Regards,
Anshuman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120601/ea68f47c/attachment.html>


More information about the pjsip mailing list