Hi! Actually the Via header of the response of the REGISTER could be used to get the received IP and rport and then use this as contact in all requests. Benny, have'nt you recently added such a feature? regards klaus Ivan Genov wrote: > Hi, > I am using TLS connection to connect to an OpenSER server. The problem I experience is that the server establishes a second TLS connection to the client when it needs to send a request to the client (a NOTIFY packet). It looks like the issue is because the client originates the TCP connection from one port but advertises a different port in the Contact header, as can be seen from the packet below: > ----------------------------------------------------------------- > SUBSCRIBE sips:ivan at 10.0.5.5 SIP/2.0 > Via: SIP/2.0/tls 10.0.5.112:2013;rport;branch=z9hG4bKPj6a7bed4a838c416fa70d57c85ef98e21 > Max-Forwards: 70 > From: "Ivan" <sips:ivan@10.0.5.112>;tag=8e8c2497ec8e4edeb3fc031ad861698d > To: sips:ivan at 10.0.5.5 > Contact: "Ivan" <sips:ivan at 10.0.5.112:5061;transport=TLS> > Call-ID: 41d9d9772e89462ca9e71e225d03f596 > CSeq: 18467 SUBSCRIBE > Event: custom-event > Expires: 120 > Accept: text/plain > Allow-Events: presence, refer, custom-event > Content-Type: text/plain > Content-Length: 6 > > 010203 > ----------------------------------------------------------------- > This makes the server not reuse client's TLS connection because 10.0.5.112:5061 is different endpoint than 10.0.5.112:2013. As a result the server is establishing a connecion to 10.0.5.112:5061. > So what I need to do is ensure that the port advertised in the Contact header is the same as the one being used as source TCP port. > Is it possible PJSIP be configured to automatically put the source TCP port in the Contact header somehow, or maybe if the application can obtain the source port which is _going to_ be used before sending the packet, or if the application can control the source TCP port used and provide/set it to PJSIP? > Thanks, > Ivan. > > > > > _______________________________________________ > 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