Asterisk16 PJSIP "Contact:" ( fqdn problem)

Call from Asterisk to sip.pstnhub.microsoft.com
Asterisk16(172.18.1.16)–NAT[11.22.33.44]–sip.pstnhub.microsoft.com
This is INVITE from Asterisk16 to sip.pstnhub.microsoft.com :

Transmitting SIP request (806 bytes) to TLS:52.114.75.24:5061
INVITE sip:+380770081@sip.pstnhub.microsoft.com:5061 SIP/2.0
Via: SIP/2.0/TLS 11.22.33.44:5061;rport;branch=z9hG4bKPjd2eab8f8-666c-4cb0-94ed-cc747dafcd8a;alias
From: sip:6001@firma123.com;tag=a6c72b0c-d26b-47be-908f-4dda08120050
To: sip:+380770081@sip.pstnhub.microsoft.com
Contact: sip:asterisk@11.22.33.44:5061;transport=TLS

How to change the string
Contact: sip:asterisk@11.22.33.44:5061;transport=TLS
so that it would be in this form
Contact: sip:asterisk@firma123.com:5061;transport=TLS

Please, help me.

why do I need it?
This is answer from sip.pstnhub.microsoft.com:

VIA: SIP/2.0/TLS 11.22.33.44:5061;branch=z9hG4bKPjd2eab8f8-666c-4cb0-94ed-cc747dafcd8a;rport;alias
REASON: Q.850;cause=21;text=“88a1e69a-e890-4ce4-922a-a8a158042533;Provided Trunk FQDN ‘11.22.33.44’ is not allowed. Connection allows following fqdns: firma123.com, sbc.firma123.com.”

in the field of Contact there has to be FQDN…

Serg

From the SIP RFC:

Contact contains a SIP or SIPS URI that represents a direct route to
contact Alice, usually composed of a username at a fully qualified
domain name (FQDN). While an FQDN is preferred, many end systems do not have registered domain names, so IP addresses are permitted.

So the requirement is invalid.

I can not affect Microsoft. ; (
Therefore, I am looking for - how to reconfigure an asterisk 16, so that in the Contact field, instead of the IP there was a FQDN…

Can anyone know what can be changed in the source code of pjsip?
or
how to achieve this by changing the configuration file asterisk pjsip.conf ?

If you don’t see an option in pjsip.conf or the wiki then there isn’t a way to do. (In fact such options HAVE to be documented when implemented and thus appear on the wiki).

Code modifications would be required, easiest option would be to follow contact_user and see how it is done.

Exactly known -
in which variable (array) is the generated header string?
"Contact: … "

That’s a developer question, but this is an end user forum. Also, as PJSIP is third party code, it is possible that the Asterisk developers didn’t need to touch that part of the code.

In which forum would you advise asking this question?

Serg

The asterisk-dev mailing list[1] can be used for developer discussion. I pointed to contact_user as a way to find the location as you’ll need to be able to find/understand things in order to modify the code. It’s done in the res/res_pjsip.c file, just search for contact_user.

[1] http://lists.digium.com/mailman/listinfo/asterisk-dev

Thank. I do not have much experience writing programs in C.
I hope it will be enough. :slight_smile:
I will try to look for the place I need in res_pjsip.c