PJSIP FQDN in Contact header - Microsoft direct routing

Hi,

there are already a few threads regarding this, but no solution.

I’ve created a patch for a 16.5.0 codebase, which enables settings contact_host for a peer. The problem is, that host part in Contact: header gets rewriten in two more files:
res/res_pjsip/pjsip_message_filter.c
res/res_pjsip_nat.c

Since I’m not a programmer, I cannot figure out how to insert a condition in those two files, that would check if contact_host variable is set and in that case it would not rewrite the host part.

I’m attaching the patch, if there is anyone willing to try this. In two files mentioned above, I commented out the lines which change the host part, these lines should be uncommented and enclosed in a condition.

This would make Asterisk able to connect to Microsoft SIP system, which would be great IMHO. A lot of customers are now demanding this connectivity.

Thanks in advance to anyone willing to help.

asterisk-16.5.0.contact_host.patch.txt (6.7 KB)

You might setup a new transport configuration in pjsip.conf to avoid the res_pjsip_nat.c comment patch.