We were able to get it working by modifying the following:
Add the following variable in res_pjsip.h
AST_STRING_FIELD(external_fqdn)
This will be configured in the tls transport section in pjsip.conf.
Add the following structure in res_pjsip/config_transport.c
ast_sorcery_object_field_register(sorcery,“transport”, “external_fqdn”,“”,OPT_STRINGFIELD_T,
0, STRFLDSET(struct ast_si_transport, external_fqdn))
Add logic in res_pjsip_nat.c to use external_fqdn if it exists under the “Update the Via header if relevant” section.
Note: You must also specify something for external_signaling_address in the pjsip.conf transport config to reach that piece of code.
We also had to acquire res_srtp.so and compile that in.
This was on asterisk version 18.3.0 on RedhHat 8.