[Kamailio-Devel] tcp connection reuse for notify requests?

Juha Heinanen jh at tutpro.com
Wed Oct 1 07:46:51 CEST 2008


perhaps my reply to daniel on this was not clear enough.  here is a
concrete example:

wireshark shows that UA sends subscribe to kamailio over tcp connection
from source port 60269 to destination port 5060.

+++ 1-10-2008 08:33:57.137845 INFO SIP ::send_sip_tcp
Send to: tcp:192.98.101.10:5060
SUBSCRIBE sip:test at test.fi SIP/2.0
Via: SIP/2.0/TCP 192.98.101.10:5074;rport;branch=z9hG4bKpykkhbzo
Max-Forwards: 70
To: <sip:test at test.fi>
From: "Juha Heinanen" <sip:jh at test.fi>;tag=dnjti
Call-ID: hnlisfxbzenxzil at localhost
CSeq: 602 SUBSCRIBE
Contact: <sip:jh at 192.98.101.10:5074;transport=tcp>
Accept: application/pidf+xml
Event: presence
Expires: 3600
User-Agent: Twinkle/1.3.2
Content-Length: 0

kamailio then sends notify to UA, which it receives like this:

+++ 1-10-2008 08:33:57.142896 INFO SIP ::process_sip_msg
Received from: tcp:192.98.101.10:33382
NOTIFY sip:jh at 192.98.101.10:5074;transport=tcp SIP/2.0
Via: SIP/2.0/TCP 192.98.101.10;branch=z9hG4bK9f6e.645b7503.0
To: sip:jh at test.fi;tag=dnjti
From: sip:test at test.fi;tag=25.6057.1222839237.9
CSeq: 1 NOTIFY
Call-ID: hnlisfxbzenxzil at localhost
Content-Length: 0
User-Agent: OpenXg Kamailio (1.4.1-tls (i386/linux))
Max-Forwards: 70
Event: presence
Contact: <sip:192.98.101.10:5060>
Subscription-State: active;expires=3600

as you see in above, source port is now 33382, i.e., there is a new tcp
connection established by kamailio for sending the notify.

looks like this new connection is created, because kamailio does not
know that contact sip:jh at 192.98.101.10:5074;transport=tcp is behind the
existing tcp connection 60269/5060.

i could rewrite contact's port number to 60269, but that would then
cause notify to be send with r-uri jh at 192.98.101.10:60269, which is
incorrect.  in order to fix this, looks like a new 'received' field
should be added to 'active_watchers' table that would get populated the
same way as 'received' field of 'location' table.

-- juha



More information about the Devel mailing list