Hello,

I saw there are some topics on this already and carefully walked through all of them, but can't solve following issue.

For a reason I do need that in Record-Route header sent to endpoint would present FQDN. If it matters, it's UDP/WSS conversion done on Kamailio.

So, scheme is quite simple

Enpoint A  ->UDP-> Kamailio ->WSS-> Endpoint B (NAT)

Main issue here, that if in Record-Route headers it's FQDN, but not IP addresses, on a new transactions with a dialog (ACK on 200, PRACK, BYE), Kamailio loose_route() function resolves address of destination not current dialog, but actual R-URI (or itself, if R-URI is something from WebRTC world) that is not correct due to NAT.

If in RR headers IP addresses are present - all is working as expected.

As an example (RR with FQDN)

B answers 200

SIP/2.0 200 OK
Record-Route: <sip:KAMAILIO_FQDN:8089;transport=ws;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss>
Record-Route: <sip:KAMAILIO_FQDN;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss>
Via: SIP/2.0/UDP <A_IP_ADDRESS>:5060;received=A IP ADDRESS;rport=5060;branch=z9hG4bKPj67fb6d86-97d7-4231-995b-e54b0f62881e
To: <sip:88290@<KAMAILIO_FQDN>>;tag=hvra7mj3q0
From: <sip:+XXXX7688881@<KAMAILIO_FQDN>>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d
Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb
CSeq: 18326 INVITE
Contact: <sip:88290@toleivu2gdbh.invalid;transport=wss>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound
Content-Type: application/sdp
Content-Length: 817


ACK looks like

ACK sip:88290@toleivu2gdbh.invalid;transport=wss SIP/2.0
Via: SIP/2.0/UDP A_IP_ADDRESS:5060;rport;branch=z9hG4bKPj8d05548a-91ef-4332-8617-32f8eeebf8f2
From: <sip:88881@A_IP_ADDRESS>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d
To: <sip:88290@KAMAILIO_FQDN>;tag=hvra7mj3q0
Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb
CSeq: 18326 ACK
Route: <sip:FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss>
Route: <sip:FQDN:8089;transport=ws;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss>
Max-Forwards: 70
User-Agent: Asterisk PBX 13.33.0
Content-Length:  0

And Kamailio on loose_route() loops ACK to itself. (with result of function == 1)

In a case if in Record-Route/Route headers just IP address of Kamailio present, all works as expected, but it's not really behavior I want to achieve.

I've tried to play with record_route_preset("...") specifying only WSS part (as suggested in https://skalatan.de/de/blog/kamailio-sbc-teams) with FQDN, but no luck.

Also wanted to try approach using record_route_preset() function in branch route, but it was working only with first branch, not affecting others (but I assume having different RR headers across branches is not a good idea)

-- 
Regards,
Igor