[sr-dev] why new tcp connection?

Andrei Pelinescu-Onciul andrei at iptel.org
Fri Nov 6 12:02:05 CET 2009


On Nov 06, 2009 at 12:20, Juha Heinanen <jh at tutpro.com> wrote:
> Andrei Pelinescu-Onciul writes:
> 
>  > Yes, it should do either that, or add an alias parameter to its Via
>  > (assuming that the port in Via _is_ 5074).
>  > If it does add "alias" to the Via, make sure you have
>  > tcp_accept_aliases=yes in the config.
> 
> twinkle does not add alias param to via so looks like its tcp
> implementation is broken.  this comes from source tcp port 34136 to port
> 5060 at sr:
> 
> +++ 6-11-2009 12:06:27.976341 INFO SIP ::send_sip_tcp
> Send to: tcp:192.98.101.10:5060
> REGISTER sip:test.fi SIP/2.0
> Via: SIP/2.0/TCP 192.98.101.10:5074;rport;branch=z9hG4bKtabgdwsf
> Max-Forwards: 70
> To: "Juha Heinanen" <sip:jh at test.fi>
> From: "Juha Heinanen" <sip:jh at test.fi>;tag=hqmmp
> Call-ID: bmybrkvktynbuma at localhost
> CSeq: 668 REGISTER
> Contact: <sip:jh_test_fi at 192.98.101.10:5074;transport=tcp>;expires=3600
> 
>  > > or should sr figure out that twinkle in fact is behind the tcp
>  > > connection it created when it registered itself no matter what the port in
>  > > contact uri is?
>  > 
>  > You can force that, using force_tcp_alias() (adds src_ip:port_in_via as
>  > an alias for src_ip:src_port).
> 
> can force_tcp_alias() be called on any register over tcp or should it be
> tested first that there is no alias in via and that port in register
> contact uri does not match source port?

You can call it always, for all the requests. It just adds a new alias
for the via port if the alias doesn't already exists
(accept_tcp_aliases=yes and alias in via does the same thing).
So the easiest way is just to add force_tcp_alias() at the  beginning of
the route block.

If you want to support non symmetric signalling tcp UACs that are not behind
NAT (they wouldn't work behind a NAT without static port forwarding
rules anyway), you can use force_tcp_alias() only if you detect the UAC
is behind the NAT.

I would look at the contact port only if you have really broken UACs
that use a different port in Via then the one in the contact.

> 
>  > In general, especially if you have NATed UACs, it's better to always have
>  > force_tcp_alias() in the config. It will cause problems only if you have
>  >  non-NATed broken UACs that don't expect/support symmetric signalling
>  >  over TCP (e.g. open a new connection for each new request and expect
>  >  only replies to that request on the connection).
> 
> ok.
> 
>  > OTOH if you  don't force_tcp_alias() and the UACs don't add alias to the
>  > Via, it's a very slim chance that NATed UACs will work over tcp.
> 
> i'll test next what happens when i put twinkle behind nat.
> 

Andrei



More information about the sr-dev mailing list