How to send SIP requests to the IP and port in the Record-Route header?

Hello team,

When FreeSWITCH receives a SIP INVITE that has Record-Routes, the subsequent SIP requests like REFER or BYE are sent to the socket, the network IP and ephemeral port where the traffic came from. How to configure FreeSWITCH to send it to the IP and port specified in the Record-Route ?

This is an example of SIP INVITE and SIP REFER. the REFER was sent to 52.203.12.137:58875 instead of 52.203.12.137:5061

2024-02-28 11:33:04.574 -05:00: 52.203.12.137:58875 -> 10.81.0.71:5062
INVITE sip:525554409012@1.1.1.1:5062;transport=tls SIP/2.0
Record-Route:  <sip:52.203.12.137:5061;r2=on;transport=tls;ftag=BXWGKvQ;lr>
Record-Route:  <sip:10.42.59.90:5060;r2=on;transport=udp;ftag=BXWGKvQ;lr>
To:  "Mexico" <sip:525554409012@1.1.1.1>
From:  "+525626504730" <sip:525626504730@52.203.12.137>;tag=BXWGKvQ
Call-ID: eb7817b9-58e3-4219-8482-aaddaf65f5d1
Via:  SIP/2.0/TLS 52.203.12.137:5061;branch=z9hG4bKf79a.bd3e1c95.0
Via:  SIP/2.0/UDP 10.42.211.54:6060;branch=z9hG4bKf79a.e67a5c87.0;i=c6ca69e3
CSeq:  1 INVITE
Max-Forwards:  68
Allow:  INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, REFER
Supported:  norefersub, timer
Accept:  application/sdp
Contact:  <sip:525626504730@10.42.211.54:6060;did=849.5c9c85f6>
Content-Type:  application/sdp
User-Agent:  GENESYS-SIPSERVICE/1.0.0.7690
Content-Length:  355



2024-02-28 11:33:46.997 -05:00: 10.81.0.71:5062 -> 52.203.12.137:58875
REFER sip:525626504730@10.42.211.54:6060;did=849.5c9c85f6 SIP/2.0
Via:  SIP/2.0/TLS 1.1.1.1:5062;rport;branch=z9hG4bKm9NXpy14e84KB
Route:  <sip:52.203.12.137:5061;r2=on;transport=tls;ftag=BXWGKvQ;lr>
Route:  <sip:10.42.59.90:5060;r2=on;transport=udp;ftag=BXWGKvQ;lr>
Max-Forwards:  70
From:  "Mexico" <sip:525554409012@1.1.1.1>;tag=6K8rcF0ZKHyFj
To:  "+525626504730" <sip:525626504730@52.203.12.137>;tag=BXWGKvQ
Call-ID: eb7817b9-58e3-4219-8482-aaddaf65f5d1
CSeq:  80015221 REFER
Contact:  <sip:525554409012@1.1.1.1:5062;transport=tls>
User-Agent:  FreeSWITCH-mod_sofia/1.10.7-release.13~64bit
Allow:  INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported:  path, replaces
Refer-To:  <sip:525551334000@amsadev.byoc.mypurecloud.com>
Referred-By:  <sip:10.83.10.17:5081>
Content-Length:  0```

Thanks,
Aubin