We had some long discussions about TCP and the aliasing ...here are some 
conclusions:

1) You have 2 types of entities involved: network level (ip:port) and SIP level 
(SIP uris).

2) in SIP, the next hop (upstream or downstream) can be different on network 
and SIP level: even if I received the INVITE from proxyA, because of RR (or 
missing RR from A), on SIP level, for sequential requests, I may talk to proxyB 
; or during a registration via an edge proxy, the contact may still point to 
the end-point, but the TCP conn may come from the edge proxy.

3) the existing aliasing (for VIA) is done at network level: network info from 
VIA is aliased on the TCP conn (everything is network here)

4) what you did in USRLOC is a mixing (in terms of aliasing) of SIP (the 
contact URI) with net info (the TCP conn) - I understand it fixes your problem, 
but it is not the correct way to do it. Think about if end point registers via 
edge proxy (using mpath) -> you will add to the tcp conn (to edge proxy) and 
alias with the port of the end-device :P.

5) I'm not sure if what you are trying to do is correct (as forcing the tcp 
conn re-usage) in your particular case: it is clear that the end point is aware 
of the 2 ports (the uac ephemeral one 30000 and the uas listening one 5060) as 
it using 30000 in VIA and 5060 in Contact. And this (for me) is an indication 
that the device explicitly wants to be contacted on 5060, otherwise it should 
use 30000 too in the Contact URI. So you may try to fix something that is not 
broken :) (of course, considering non NAT scenarios)

6) still, there is another problem left, when opensips behaves as a proxy (and 
not as registrar) : A -> proxy -> B , where A and B are end points. If A use 
30000 in VIA (and net level) and contact 5060 (as in your case), proxy will 
create a new conn when routing a BYE from B to A (as B will use A's contact, 
with 5060 port). and if there is no registration involved (like doing 
presence), there will be alias between 30000 and 5060......

Until we will come up with a complete and correct solution, we decided not to 
accept your patch because:
     - it is mixing the SIP and network levels (works only for particular cases)
     - it is bogus when there is an edge proxy with mpath between the uac and 
registrant
     - it is not complete (does not cover the case when doing routing without 
registration).

We do not what to upload the temporary hack (which may prove into wrong 
direction) until there is a clear and complete solution.

In the mean while, what I recommend you as workaround (that at least is 
consistent with not mixing the SIP and network level and has no drawback) -> 
before save() use fix_nated_register(), see:
    http://www.opensips.org/html/docs/modules/1.11.x/nathelper.html#id294034

This will not change your message, but it will create a SIP aliase between the 
Contact URI and the outbound URI (where the Register came from):  sip:ip:5060-> 
sip:ip:30000, so it should solve your problem.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/446#issuecomment-91278866
_______________________________________________
Devel mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to