miconda left a comment (kamailio/kamailio#4170)

The masking/unmasking cannot be done using the last one corresponding to 
Topoh-Server, because it has to be done in the way that the intermediary nodes 
see the same Record-Route as for the INVITE.

Lets take the example:

```
UA1 <=> P1 <=> P2(TH) <=> P3 <=> P4 <=> P3 <=> P2(TH) <=> P1 <=> UA2
```

When INVITE goes to UA2, the Record-Route headers leaving a proxy are:

  - at UA1
  - at P1: P1
  - at P2(TH): P2, X1
  - at P3: P3, P2, X1
  - at P4: P4, P3, P2, X1
  - at P3: P3, P4, P3, P2, X1
  - at P2(TH): P2, X3, X4, X3, X2, Y1
  - at P1: P1, P2, X3, X4, X3, X2, Y1
  - at UA2: P1, P2, X3, X4, X3, X2, Y1

The P is clear address, X is encoded address, Y is double encoded address.

When the response goes the opposite direction, it has to be:

  - at UA2: P1, P2, X3, X4, X3, X2, Y1
  - at P1: P1, P2, X3, X4, X3, X2, Y1
  - at P2(TH): X1, P2, P3, P4, P3, P2, X1
  - at P3: X1, P2, P3, P4, P3, P2, X1
  - at P4: X1, P2, P3, P4, P3, P2, X1
  - at P3: X1, P2, P3, P4, P3, P2, X1
  - at P2(TH): Y1, X2, X3, X4, X3, P2, P1
  - at P1: Y1, X2, X3, X4, X3, P2, P1
  - at UA1: Y1, X2, X3, X4, X3, P2, P1

Using the last route matching the TH-Server is not correct, I assume that you 
set mask ip to be P2, so all the X and Y record-routes have P2 address. If the 
mask ip is different that P2 (it can be any address, say 127.0.0.2), then it 
should work as it is now. If mask ip is P2 address, then when response comes 
first to it, it has to encode the record-routes towards UA2 via P1 and decode 
those towards UA1 via P3. When it comes second time, it has to encode those 
towards UA2 via P3 and decode those via UA1 via P1.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4170#issuecomment-2829691165
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/4170/c2829691...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to