On Mon, 24 Jul 2023 at 18:47, Alex Balashov <abalashov@evaristesys.com> wrote:
Hello John,

If that's the goal per se, you will likely need to use the Path[1][2][3] extension, which allows a proxy to stay in the signalling path of non-adjacent registration contacts.

This is assuming the Asterisk project have fixed their long-standing Path bug in `chan_pjsip`, which they have hitherto refused to fix for several years. If not, you may have to engage in some hacky stateful Contact rewriting in lieu of Path.
 
For future googlers and future me: you will need Asterisk ≥ 18.17.0, 20.2.0 to have fixed Path support in chan_pjsip.
https://issues.asterisk.org/jira/browse/ASTERISK-30100 

Those are very recent versions of Asterisk.

For kamailio config you could take a look at the sample config of the outbound module: this loads the path module and adds suitable Path headers towards an internal registrar.

However, as Alex mentioned, this whole thing is quite fraught. It depends on the registrar storing the Path header, and using it on INVITE - which was the problem with earlier versions of Asterisk.



Regards
Richard