[OpenSIPS-Users] Receiving requests via registration TCP connection

Iñaki Baz Castillo ibc at aliax.net
Mon Oct 13 15:19:07 CEST 2008


2008/10/13 Bogdan-Andrei Iancu <bogdan at voice-system.ro>:

>> Of course, for this to work is needed the TCP connection remains open
>> (it could be achieved by requiring REGISTER every 32 seconds or using
>> PING-PONG TCP keepalive if both client and server implement it).
>>
>
> Or you can simply instruct OpenSIPS to keep open the TCP connection where
> the REGISTER was received - see
>   http://www.opensips.org/html/docs/modules/devel/registrar.html#id2520469

Well, I tryed it for long time in OpenSer 1.2 and it never worked as
expected. Anyway that's a different question.


>> But I wonder how "legal/valid" is this in RFC3261. I mean: is really
>> valid for a proxy to send *new* requests to a registered UA via the
>> TCP connection used for UA registration?
>>
>
> yes, it is legal - if I'm not wrong, there is even on RFC about reusing TCP
> connections.

There is a draft about reusing TCP connections, but I just mean the
pure RFC3261.



>> Imagine UA1 sends a TCP INVITE to proxy P2 responsible for UA2 AoR. So
>> UA1 starts a TCP connection from a random port (maybe 22222) to P2.
>> This connection is just supposed for requests sent **by UA1** and
>> responses sent from UA2.
>> Now imagine that P2 sends a request to UA1 against port 22222 using
>> the previous connection. AFAIK this is not defined in RFC3261 and UA1
>> could just drop these requests.
>>
>> So I wonder which is the difference between this example and the case
>> in with a registrar/proxy sends requests to a registered user via the
>> TCP connection used for UA registration.
>>
>>
>
> A server should re-use a TCP connection only if the IP:port of the other
> peer is the same with the IP:port of the connection.

Hummm, this is just true if the server want to send a new request to a
destinatino (got from DNS lookup) and by casuality there is also a
open TCP connection (an existing tuple). This is:
- The server/proxy/UA2 wants to send a request to user at domain.org.
- By DNS it gets the IP 1.2.3.4:5060
- It realizes that there is an existing connection to that destination
o reuses it.

But note that the Contact of a REGISTER sent from a natted client with
pubic IP 212.10.3.25 is:

TCP 192.168.1.58:11111 --> (from 212.10.3.25:12121) --> 88.99.4.100:5060
REGISTER
Contact: <sip:user at 192.168.1.58:5060;transport=tcp>

And the registrar/proxy replies:

TCP 88.99.4.100:5060 --> (to 212.10.3.25:12121) -->192.168.1.58:11111
200 OK
Contact: <sip:user at 192.168.1.58:5060;transport=tcp>;received="sip:212.10.3.25:12121;transport=TCP"


After the registration, the proxy forwards a new request to this UA
and it sends it using the same connection (if available):
TCP 88.99.4.100:5060 --> (to 212.10.3.25:12121) -->192.168.1.58:11111
INVITE sip:user at 192.168.1.58:5060;transport=tcp


So, the UA is receiving the request in the port 11111 that is a random
port just uses to send previously the REGISTER. Why is it valid?



> The re-usage should not
> be done on any other criteria - only if target at IP level is the same.

Is it true in the example above?


>> Opinions? With the TCP UA's I've tryed (i-e- Twinkle) it seems to work
>> (Twinkle accepts request from registrar/proxy coming via the TCP
>> connection used for registration).
>>
>>
>
> IMO, this is bogus - a device should reject incoming calls that do not have
> in RURI an registered contact.

Bogus? well, the RURI is correct since it's exactly the Contact sent
by the UA during registration, but the UA receives the request using
the random port used for the REGISTER instead of receiving the request
via the LISTENING port (5060).
This is the main question, is it valid per RFC 3261?


Thanks a lot for your comments.




-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the Users mailing list