Hi! I have encountered a problem with pjsip (in QjSimple). Typical TCP flow: ----REGISTER 1------> <---401-------------- ----REGISTER 2 w/cred-> <---200---------------- ----REGISTER 3 updated contact-> <---401------------------------- .... The problem is, that pjsip opens a new TCP connection for every REGISTER transaction - it creates a new TCP transport for each request. Thus, of course, the updated contact is of course wrong as the new connection has a new port, and so pjsip sends REGISTER like crazy. The problem does not happen in pjsua-client. I verified the code how the transport is configured/added but I can not see a difference between QjSimple and pjsua. Any hints are appreciated. regards Klaus 16:42:20.171 pjsua_core.c pjsua version 1.3 for i686-pc-mingw32 initialized 16:42:20.171 tcplis:2149 SIP TCP listener ready for incoming connections at 10.10.0.51:2149 16:42:20.171 pjsua_media.c RTP socket reachable at 10.10.0.51:4000 16:42:20.171 pjsua_media.c RTCP socket reachable at 10.10.0.51:4001 16:42:20.187 pjsua_media.c RTP socket reachable at 10.10.0.51:4002 16:42:20.187 pjsua_media.c RTCP socket reachable at 10.10.0.51:4003 16:42:20.187 pjsua_media.c RTP socket reachable at 10.10.0.51:4004 16:42:20.187 pjsua_media.c RTCP socket reachable at 10.10.0.51:4005 16:42:20.187 pjsua_media.c RTP socket reachable at 10.10.0.51:4006 16:42:20.187 pjsua_media.c RTCP socket reachable at 10.10.0.51:4007 16:42:20.187 pjsua_acc.c Account sip:klaus.darilion at sip.labs.nic.at added with id 0 16:42:20.187 endpoint Request msg REGISTER/cseq=38360 (tdta05C4EF58) created. 16:42:20.187 tsx05C8F06C Transaction created for Request msg REGISTER/cseq=38361 (tdta05C4EF58) 16:42:20.187 tsx05C8F06C Sending Request msg REGISTER/cseq=38361 (tdta05C4EF58) in state Null 16:42:20.187 sip_resolve.c Starting async DNS SRV query: target=_sip._tcp.sip.labs.nic.at, transport=TCP, port=0 16:42:20.187 _sip._tcp.sip. Starting async DNS SRV query_job: target=_sip._tcp.sip.labs.nic.at:5060 16:42:20.187 resolver.c Nameserver 10.10.0.1:53 state changed Active --> Probing 16:42:20.187 resolver.c Transmitting 43 bytes to NS 0 (10.10.0.1:53): DNS SRV query for _sip._tcp.sip.labs.nic.at 16:42:20.187 tsx05C8F06C State changed from Null to Calling, event=TX_MSG 16:42:20.187 pjsua_acc.c Registration sent 16:42:20.359 resolver.c Received 94 bytes DNS response from 10.10.0.1:53 16:42:20.359 resolver.c Nameserver 10.10.0.1:53 state changed Probing --> Active 16:42:20.359 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at: DNS "Name Error" (PJLIB_UTIL_EDNS_NXDOMAIN) 16:42:20.359 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at, trying resolving A record for sip.labs.nic.at 16:42:20.359 _sip._tcp.sip. Starting async DNS A query_job for sip.labs.nic.at 16:42:20.359 resolver.c Transmitting 33 bytes to NS 0 (10.10.0.1:53): DNS A query for sip.labs.nic.at 16:42:20.500 resolver.c Received 100 bytes DNS response from 10.10.0.1:53 16:42:20.500 resolver.c Nameserver 10.10.0.1:53 state changed Active --> Active 16:42:20.500 _sip._tcp.sip. DNS A for sip.labs.nic.at: 83.136.32.159 16:42:20.500 _sip._tcp.sip. Server resolution complete, 1 server entry(s) found 16:42:20.500 tcpc05CE401C TCP client transport created 16:42:20.500 tcpc05CE401C TCP transport 10.10.0.51:2160 is connecting to 83.136.32.159:5060... 16:42:20.500 pjsua_core.c TX 518 bytes Request msg REGISTER/cseq=38361 (tdta05C4EF58) to tcp 83.136.32.159:5060: REGISTER sip:sip.labs.nic.at SIP/2.0 Via: SIP/2.0/tcp 10.10.0.51:2160;rport;branch=z9hG4bKPj18bdb201822e49adade88350f9478321 Route: <sip:sip.labs.nic.at;transport=tcp;lr> Max-Forwards: 70 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38361 REGISTER User-Agent: QjSimple 0.5pre by ipcom.at Contact: <sip:klaus.darilion at 10.10.0.51:2149;transport=TCP> Expires: 300 Content-Length: 0 --end msg-- 16:42:20.578 tcpc05CE401C TCP transport 10.10.0.51:2160 is connected to 83.136.32.159:5060 16:42:20.625 sip_endpoint.c Processing incoming message: Response msg 100/REGISTER/cseq=38361 (rdata05CE41B8) 16:42:20.625 pjsua_core.c RX 415 bytes Response msg 100/REGISTER/cseq=38361 (rdata05CE41B8) from tcp 83.136.32.159:5060: SIP/2.0 100 Trying ... (stop retransmitting) Via: SIP/2.0/tcp 10.10.0.51:2160;rport=2160;branch=z9hG4bKPj18bdb201822e49adade88350f9478321;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38361 REGISTER Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:20.625 tsx05C8F06C Incoming Response msg 100/REGISTER/cseq=38361 (rdata05CE41B8) in state Calling 16:42:20.625 tsx05C8F06C State changed from Calling to Proceeding, event=RX_MSG 16:42:20.640 sip_endpoint.c Processing incoming message: Response msg 401/REGISTER/cseq=38361 (rdata05CE41B8) 16:42:20.640 pjsua_core.c RX 537 bytes Response msg 401/REGISTER/cseq=38361 (rdata05CE41B8) from tcp 83.136.32.159:5060: SIP/2.0 401 Unauthorized Via: SIP/2.0/tcp 10.10.0.51:2160;rport=2160;branch=z9hG4bKPj18bdb201822e49adade88350f9478321;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at>;tag=5fcf32020f171aefa0445747f7988cba.28ce Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38361 REGISTER WWW-Authenticate: Digest realm="sip.labs.nic.at", nonce="4a608dec196a1b76da35107049111541d3e58972" Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:20.640 tsx05C8F06C Incoming Response msg 401/REGISTER/cseq=38361 (rdata05CE41B8) in state Proceeding 16:42:20.640 tsx05C8F06C State changed from Proceeding to Completed, event=RX_MSG 16:42:20.640 tsx05C95594 Transaction created for Request msg REGISTER/cseq=38362 (tdta05C4EF58) 16:42:20.640 tsx05C95594 Sending Request msg REGISTER/cseq=38362 (tdta05C4EF58) in state Null 16:42:20.640 sip_resolve.c Starting async DNS SRV query: target=_sip._tcp.sip.labs.nic.at, transport=TCP, port=0 16:42:20.640 _sip._tcp.sip. Starting async DNS SRV query_job: target=_sip._tcp.sip.labs.nic.at:5060 16:42:20.640 resolver.c Picked up DNS SRV record for _sip._tcp.sip.labs.nic.at from cache, ttl=60 16:42:20.640 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at: DNS "Name Error" (PJLIB_UTIL_EDNS_NXDOMAIN) 16:42:20.640 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at, trying resolving A record for sip.labs.nic.at 16:42:20.640 _sip._tcp.sip. Starting async DNS A query_job for sip.labs.nic.at 16:42:20.640 resolver.c Picked up DNS A record for sip.labs.nic.at from cache, ttl=300 16:42:20.640 _sip._tcp.sip. DNS A for sip.labs.nic.at: 83.136.32.159 16:42:20.640 _sip._tcp.sip. Server resolution complete, 1 server entry(s) found 16:42:20.640 tcpc05C0E17C TCP client transport created 16:42:20.640 tcpc05C0E17C TCP transport 10.10.0.51:2161 is connecting to 83.136.32.159:5060... 16:42:20.640 pjsua_core.c TX 714 bytes Request msg REGISTER/cseq=38362 (tdta05C4EF58) to tcp 83.136.32.159:5060: REGISTER sip:sip.labs.nic.at SIP/2.0 Via: SIP/2.0/tcp 10.10.0.51:2161;rport;branch=z9hG4bKPj8dba4c2e650d464695baf75b2d4b2e38 Route: <sip:sip.labs.nic.at;transport=tcp;lr> Max-Forwards: 70 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38362 REGISTER User-Agent: QjSimple 0.5pre by ipcom.at Contact: <sip:klaus.darilion at 10.10.0.51:2149;transport=TCP> Expires: 300 Authorization: Digest username="klaus.darilion", realm="sip.labs.nic.at", nonce="4a608dec196a1b76da35107049111541d3e58972", uri="sip:sip.labs.nic.at", response="c07fae51d9b5392066e9218893ccecaf" Content-Length: 0 --end msg-- 16:42:20.640 tsx05C95594 State changed from Null to Calling, event=TX_MSG 16:42:20.640 tsx05C8F06C Timeout timer event 16:42:20.640 tsx05C8F06C State changed from Completed to Terminated, event=TIMER 16:42:20.640 tsx05C8F06C Timeout timer event 16:42:20.640 tsx05C8F06C State changed from Terminated to Destroyed, event=TIMER 16:42:20.640 tsx05C8F06C Transaction destroyed! 16:42:20.671 tcpc05C0E17C TCP transport 10.10.0.51:2161 is connected to 83.136.32.159:5060 16:42:20.718 sip_endpoint.c Processing incoming message: Response msg 100/REGISTER/cseq=38362 (rdata05C0E318) 16:42:20.718 pjsua_core.c RX 415 bytes Response msg 100/REGISTER/cseq=38362 (rdata05C0E318) from tcp 83.136.32.159:5060: SIP/2.0 100 Trying ... (stop retransmitting) Via: SIP/2.0/tcp 10.10.0.51:2161;rport=2161;branch=z9hG4bKPj8dba4c2e650d464695baf75b2d4b2e38;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38362 REGISTER Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:20.718 tsx05C95594 Incoming Response msg 100/REGISTER/cseq=38362 (rdata05C0E318) in state Calling 16:42:20.718 tsx05C95594 State changed from Calling to Proceeding, event=RX_MSG 16:42:20.828 sip_endpoint.c Processing incoming message: Response msg 200/REGISTER/cseq=38362 (rdata05C0E318) 16:42:20.828 pjsua_core.c RX 876 bytes Response msg 200/REGISTER/cseq=38362 (rdata05C0E318) from tcp 83.136.32.159:5060: SIP/2.0 200 OK Via: SIP/2.0/tcp 10.10.0.51:2161;rport=2161;branch=z9hG4bKPj8dba4c2e650d464695baf75b2d4b2e38;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=a04356dc0f01499eaf43450a199f42fa To: <sip:klaus.darilion at sip.labs.nic.at>;tag=5fcf32020f171aefa0445747f7988cba.2309 Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38362 REGISTER Contact: <sip:klaus.darilion at 83.136.33.3:1983;transport=tcp>;expires=60;received="sip:83.136.33.3:1987;transport=TCP", <sip:klaus.darilion at 83.136.33.3:2061;transport=tcp>;expires=75;received="sip:83.136.33.3:2064;transport=TCP", <sip:klaus.darilion at 83.136.33.3:2138;transport=tcp>;expires=97;received="sip:83.136.33.3:2142;transport=TCP", <sip:klaus.darilion at 10.10.0.51:2149;transport=TCP>;expires=300;received="sip:83.136.33.3:2161;transport=TCP" Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:20.828 tsx05C95594 Incoming Response msg 200/REGISTER/cseq=38362 (rdata05C0E318) in state Proceeding 16:42:20.828 tsx05C95594 State changed from Proceeding to Completed, event=RX_MSG 16:42:20.828 pjsua_acc.c IP address change detected for account 0 (10.10.0.51:2149 --> 83.136.33.3:2161). Updating registration.. 16:42:20.828 endpoint Request msg REGISTER/cseq=38362 (tdta06022AC0) created. 16:42:20.828 tsx05C8F06C Transaction created for Request msg REGISTER/cseq=38363 (tdta06022AC0) 16:42:20.828 tsx05C8F06C Sending Request msg REGISTER/cseq=38363 (tdta06022AC0) in state Null 16:42:20.828 sip_resolve.c Starting async DNS SRV query: target=_sip._tcp.sip.labs.nic.at, transport=TCP, port=0 16:42:20.828 _sip._tcp.sip. Starting async DNS SRV query_job: target=_sip._tcp.sip.labs.nic.at:5060 16:42:20.828 resolver.c Picked up DNS SRV record for _sip._tcp.sip.labs.nic.at from cache, ttl=60 16:42:20.828 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at: DNS "Name Error" (PJLIB_UTIL_EDNS_NXDOMAIN) 16:42:20.828 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at, trying resolving A record for sip.labs.nic.at 16:42:20.828 _sip._tcp.sip. Starting async DNS A query_job for sip.labs.nic.at 16:42:20.828 resolver.c Picked up DNS A record for sip.labs.nic.at from cache, ttl=300 16:42:20.828 _sip._tcp.sip. DNS A for sip.labs.nic.at: 83.136.32.159 16:42:20.828 _sip._tcp.sip. Server resolution complete, 1 server entry(s) found 16:42:20.828 tcpc045152A4 TCP client transport created 16:42:20.828 tcpc045152A4 TCP transport 10.10.0.51:2162 is connecting to 83.136.32.159:5060... 16:42:20.828 pjsua_core.c TX 516 bytes Request msg REGISTER/cseq=38363 (tdta06022AC0) to tcp 83.136.32.159:5060: REGISTER sip:sip.labs.nic.at SIP/2.0 Via: SIP/2.0/tcp 10.10.0.51:2162;rport;branch=z9hG4bKPj0c7203153a2b4613af4b1f8ea749faed Route: <sip:sip.labs.nic.at;transport=tcp;lr> Max-Forwards: 70 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=2d0d2a7fe54a4b7aad2751496eb2a0a5 To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38363 REGISTER User-Agent: QjSimple 0.5pre by ipcom.at Contact: <sip:klaus.darilion at 10.10.0.51:2149;transport=TCP> Expires: 0 Content-Length: 0 --end msg-- 16:42:20.828 tsx05C8F06C State changed from Null to Calling, event=TX_MSG 16:42:20.828 pjsua_acc.c Unregistration sent 16:42:20.828 endpoint Request msg REGISTER/cseq=18508 (tdta044DED88) created. 16:42:20.828 tsx05DA206C Transaction created for Request msg REGISTER/cseq=18509 (tdta044DED88) 16:42:20.828 tsx05DA206C Sending Request msg REGISTER/cseq=18509 (tdta044DED88) in state Null 16:42:20.828 sip_resolve.c Starting async DNS SRV query: target=_sip._tcp.sip.labs.nic.at, transport=TCP, port=0 16:42:20.828 _sip._tcp.sip. Starting async DNS SRV query_job: target=_sip._tcp.sip.labs.nic.at:5060 16:42:20.828 resolver.c Picked up DNS SRV record for _sip._tcp.sip.labs.nic.at from cache, ttl=60 16:42:20.828 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at: DNS "Name Error" (PJLIB_UTIL_EDNS_NXDOMAIN) 16:42:20.828 _sip._tcp.sip. DNS SRV resolution failed for _sip._tcp.sip.labs.nic.at, trying resolving A record for sip.labs.nic.at 16:42:20.828 _sip._tcp.sip. Starting async DNS A query_job for sip.labs.nic.at 16:42:20.828 resolver.c Picked up DNS A record for sip.labs.nic.at from cache, ttl=300 16:42:20.828 _sip._tcp.sip. DNS A for sip.labs.nic.at: 83.136.32.159 16:42:20.828 _sip._tcp.sip. Server resolution complete, 1 server entry(s) found 16:42:20.828 tcpc05D5F404 TCP client transport created 16:42:20.828 tcpc05D5F404 TCP transport 10.10.0.51:2163 is connecting to 83.136.32.159:5060... 16:42:20.828 pjsua_core.c TX 519 bytes Request msg REGISTER/cseq=18509 (tdta044DED88) to tcp 83.136.32.159:5060: REGISTER sip:sip.labs.nic.at SIP/2.0 Via: SIP/2.0/tcp 10.10.0.51:2163;rport;branch=z9hG4bKPj247d33c71e1843d28b8a58bc144aa46d Route: <sip:sip.labs.nic.at;transport=tcp;lr> Max-Forwards: 70 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=1de2ffe21d4241709c3868450d3ea76a To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: e97ace942a0b4176a4f221e9220a25c5 CSeq: 18509 REGISTER User-Agent: QjSimple 0.5pre by ipcom.at Contact: <sip:klaus.darilion at 83.136.33.3:2161;transport=tcp> Expires: 300 Content-Length: 0 --end msg-- 16:42:20.828 tsx05DA206C State changed from Null to Calling, event=TX_MSG 16:42:20.828 pjsua_acc.c Registration sent 16:42:20.828 tsx05C95594 Timeout timer event 16:42:20.828 tsx05C95594 State changed from Completed to Terminated, event=TIMER 16:42:20.828 tsx05C95594 Timeout timer event 16:42:20.828 tsx05C95594 State changed from Terminated to Destroyed, event=TIMER 16:42:20.828 tdta05C4EF58 Destroying txdata Request msg REGISTER/cseq=38362 (tdta05C4EF58) 16:42:20.828 tsx05C95594 Transaction destroyed! 16:42:20.968 tcpc045152A4 TCP transport 10.10.0.51:2162 is connected to 83.136.32.159:5060 16:42:20.968 tcpc05D5F404 TCP transport 10.10.0.51:2163 is connected to 83.136.32.159:5060 16:42:21.125 sip_endpoint.c Processing incoming message: Response msg 100/REGISTER/cseq=18509 (rdata05D5F5A0) 16:42:21.125 pjsua_core.c RX 415 bytes Response msg 100/REGISTER/cseq=18509 (rdata05D5F5A0) from tcp 83.136.32.159:5060: SIP/2.0 100 Trying ... (stop retransmitting) Via: SIP/2.0/tcp 10.10.0.51:2163;rport=2163;branch=z9hG4bKPj247d33c71e1843d28b8a58bc144aa46d;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=1de2ffe21d4241709c3868450d3ea76a To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: e97ace942a0b4176a4f221e9220a25c5 CSeq: 18509 REGISTER Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:21.125 tsx05DA206C Incoming Response msg 100/REGISTER/cseq=18509 (rdata05D5F5A0) in state Calling 16:42:21.125 tsx05DA206C State changed from Calling to Proceeding, event=RX_MSG 16:42:21.125 sip_endpoint.c Processing incoming message: Response msg 100/REGISTER/cseq=38363 (rdata04515440) 16:42:21.125 pjsua_core.c RX 415 bytes Response msg 100/REGISTER/cseq=38363 (rdata04515440) from tcp 83.136.32.159:5060: SIP/2.0 100 Trying ... (stop retransmitting) Via: SIP/2.0/tcp 10.10.0.51:2162;rport=2162;branch=z9hG4bKPj0c7203153a2b4613af4b1f8ea749faed;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=2d0d2a7fe54a4b7aad2751496eb2a0a5 To: <sip:klaus.darilion at sip.labs.nic.at> Call-ID: 4b9df509667a4846a190f9aa648ae9f0 CSeq: 38363 REGISTER Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg-- 16:42:21.125 tsx05C8F06C Incoming Response msg 100/REGISTER/cseq=38363 (rdata04515440) in state Calling 16:42:21.125 tsx05C8F06C State changed from Calling to Proceeding, event=RX_MSG 16:42:21.125 sip_endpoint.c Processing incoming message: Response msg 401/REGISTER/cseq=18509 (rdata05D5F5A0) 16:42:21.125 pjsua_core.c RX 537 bytes Response msg 401/REGISTER/cseq=18509 (rdata05D5F5A0) from tcp 83.136.32.159:5060: SIP/2.0 401 Unauthorized Via: SIP/2.0/tcp 10.10.0.51:2163;rport=2163;branch=z9hG4bKPj247d33c71e1843d28b8a58bc144aa46d;received=83.136.33.3 From: <sip:klaus.darilion at sip.labs.nic.at>;tag=1de2ffe21d4241709c3868450d3ea76a To: <sip:klaus.darilion at sip.labs.nic.at>;tag=5fcf32020f171aefa0445747f7988cba.77ea Call-ID: e97ace942a0b4176a4f221e9220a25c5 CSeq: 18509 REGISTER WWW-Authenticate: Digest realm="sip.labs.nic.at", nonce="4a608dec196a1b76da35107049111541d3e58972" Server: Kamailio (1.5.0-notls (i386/linux)) Content-Length: 0 --end msg--