[OpenSIPS-Devel] How to make OpenSIPS reuse client's TCP/TLS connection (and not try to connect on its own)?

Klaus Darilion klaus.mailinglists at pernau.at
Mon Aug 25 11:12:15 CEST 2008


Actually your client announces port 5061 in the Contact header. Either 
the client should announce the port of the ephemeral or perform NAT 
traversal at the proxy, e.g. fix_nated_contact()

If the SUBSCRIBE processing happens on the same proxy which does the NAt 
traversal there may be an issue - presence module would need some kind 
of "received_avp" feature (like registrar module) - I do not know if 
this is supported yet.

regards
klaus

Ivan Genov schrieb:
> Hi Bogdan,
>  
> Thanks for the answer.  I now realize I have not provided all relevant 
> information and I have not been fully correct with my first message.
>  
> I have to mention that I have a custom module on the server, which takes 
> care of subscriptions for one custom event. This module is workign fine 
> and it is responsible for sending NOTIFYs when needed.
>  
> I am pasting three packets of the communication between the client and 
> the server below. The client sends SUBSCRBE through the TLS connection 
> and the server responds with 202 OK to the client using the same (single 
> at that time) TLS connection which came from the client. But after that, 
> when the server (my custom module) needs to send NOTIFY to the client, 
> for some reason the server establishes a new TLS connection to the 
> client through which it sends the NOTIFY. Here are the packets:
>  
> -----------------------------------------------------------------
> 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 at 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
> -----------------------------------------------------------------
> SIP/2.0 202 OK
> Via: SIP/2.0/tls 
> 10.0.5.112:2013;rport=2013;branch=z9hG4bKPj6a7bed4a838c416fa70d57c85ef98e21
> From: "Ivan" <sips:ivan at 10.0.5.112>;tag=8e8c2497ec8e4edeb3fc031ad861698d
> To: sips:ivan at 10.0.5.5;tag=10.0.1219249054.4
> Call-ID: 41d9d9772e89462ca9e71e225d03f596
> CSeq: 18467 SUBSCRIBE
> Expires: 120
> Server: OpenSER (1.3.0-tls (i386/linux))
> Content-Length: 0
> -----------------------------------------------------------------
> NOTIFY sips:ivan at 10.0.5.112:5061;transport=TLS SIP/2.0
> Via: SIP/2.0/TLS 10.0.5.5:5061;branch=z9hG4bKc2bf.75041b55.0
> To: sip:ivan at 10.0.5.112;tag=8e8c2497ec8e4edeb3fc031ad861698d
> From: sip:ivan at 10.0.5.5;tag=10.0.1219249054.4
> CSeq: 1 NOTIFY
> Call-ID: 41d9d9772e89462ca9e71e225d03f596
> Content-Length: 6
> User-Agent: OpenSER (1.3.0-tls (i386/linux))
> Max-Forwards: 70
> Event: custom-event
> Subscription-State: active;expires=120
> Content-Type: text/plain
>  
> 010203
> -----------------------------------------------------------------
>  
> Can it be told from these packets what makes the server think the 
> connection point is different? I suspect the connection point looks 
> different to the server because 
> "sips:ivan at 10.0.5.112:5061;transport=TLS" is different SIP URI than 
> "sips:ivan at 10.0.5.5", maybe? 10.0.5.112 is the client's IP and 10.0.5.5 
> is the server's.
>  
>  
> Thanks in advance,
>  
> Ivan.
>  
>  
> ----- Original Message ----
> From: Bogdan-Andrei Iancu <bogdan at voice-system.ro>
> To: Ivan Genov <ivangg_q at yahoo.com>
> Cc: devel at lists.opensips.org
> Sent: Wednesday, August 20, 2008 1:20:20 AM
> Subject: Re: [OpenSIPS-Devel] How to make OpenSIPS reuse client's 
> TCP/TLS connection (and not try to connect on its own)?
> 
> Hi Ivan,
> 
> The OpenSIPS reuses the TCP/TLS connection only if the connection point
> (where it tries to connect to) is already involved in a established
> connection.
> 
> In your case, maybe the connection point looks different than any
> existing connections, so a new one is opened.
> 
> Regards,
> Bogdan
> 
> Ivan Genov wrote:
>  > Hi,
>  > 
>  > I am noticing that when a client connects to the OpenSIPS server via
>  > TLS the server is establishing a new TLS connection to the client and
>  > sends the respond through it. This works OK for internal LAN, but if
>  > you are trying to connect with the client from outside Internet (or
>  > other unreachable for the OpenSIPS place) the OpenSIPS cannot
>  > establish this connection and it will not work.
>  > 
>  > My expectation was that the SIP server would reuse the same TCP/TLS
>  > connection that the client made to it, but obviously it is not so. Do
>  > you know if there is a way to configure the server (possibly the
>  > client), so that the server reuses the client's connection and does
>  > not try to create a new one?
>  > 
>  > 
>  > Thanks,
>  > 
>  > Ivan.
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > Devel mailing list
>  > Devel at lists.opensips.org <mailto:Devel at lists.opensips.org>
>  > http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>  > 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel



More information about the Devel mailing list