Hi, I think you may have hit a known problem. I vaguely recall that if you use the "lock to specific listener" feature, it may cause pjsip to create new TCP connection for every outgoing request. I can't remember the exact circumstances though, and it looks like I haven't documented this in Trac (I did just now), but I do remember that this is not an easy problem to fix. So I'm afraid the workaround now is to not use the locking feature for TCP/TLS. P.S. Good to hear that Kamailio supports SIP outbound! Best regards, ?Benny On Wed, Oct 5, 2011 at 3:07 PM, Roberto Perez <robj.perez at gmail.com> wrote: > Hi, > I'm using pjsip 1.10 in an iphone application and testing against a kamailio > 3.1. > The account which I'm registering with has the outbound function active, as > I can tell from these trace: > > 16:15:35.007? ? pjsua_acc.c? Contact for acc 0 updated for SIP outbound: > <sip:111 at 192.168.1.1:5060;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-000052baa107>" > > ?16:16:07.674? ? pjsua_acc.c? SIP outbound status for acc 0 is active > > ?16:16:07.674? ? pjsua_acc.c? Acc 0 has SIP outbound active, no need to > update registration Contact > > As you already know, when the re-registration timeout counter reaches 0, it > sends a new REGISTER message. The problem is that the iPhone version creates > a *new* tcp transport/socket each time pjsip sends that re-registration > message. > This is a problem in several ways, one of them, as the new register uses a > new transport, the background mode stops working, as the original tcp > transport/socket is still on. > Diving into the pjsip code, I have seen that in the function > "pjsip_tpmgr_acquire_transport2" (which is in?sip_transport.c file), it > checks whether it can use a current transport or if it has to create a new > one. It does that with this three if conditions: > line 1575: > > if?(sel && sel->type == PJSIP_TPSELECTOR_TRANSPORT &&?sel->u.transport) { > ... } > > else?if?(sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&?sel->u.listener) { > ... } > > else { /*?This is the "normal" flow */ } > > My code always go for the second condtion, which as you can read in the > comments "Application has requested that a specific listener is to?be used. > In this case, skip transport hash table lookup.". But I haven't requested > anything :) > > What I want to do is to reuse the same transport/socket to send the > Re-register message as PJSUA sample add does. > > Am I missing any parameter to the transport creation? Why is this problem > happening? > > Thanks in advance > > Roberto. > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >