Problem with Contact Header in case of pjsip trunk over tls

Hello Dear Community!

I have the following configuration in my distributed network:

Server A (Asterisk) uses domain_A —— Server B (Asterisk) uses domain_B

There is a pjsip trunk between them and it used just to send SIP messages

Server B sends registration request toward Server A. And Authentication method is BOTH - for inbound and outbound messages.

On the Server B “pjsip show contacts” looks like this:
Contact: md/sip:domain_A …

But on the Server A “pjsip show contacts” looks like this:
Contact: md/sip:md@192.168.1.15;transport=TLS;line

And the problem is that on the Server A side it always will be some IP (public or private) and not a domain name.
Even if I will configure “external_signaling_address=domain_A” on the Server B side.

And in my case I have problem with TLS handshake as my certificate was issued for domain_A

[2025-08-31 14:10:31] NOTICE[904140]: res_pjsip/pjsip_transport_events.c:179 verify_log_result: Transport ‘0.0.0.0-tls’ to remote ‘192.168.1.15’ - The server identity does not match to any identities specified in the certificate

Is there any way to have a domain name in the Contact Header?

Thank you in advance.

P.S. This is my first message in this community.

And thank you very much for such nice product!

BR,
Evgeny.

There is no capability currently to place a domain name into the Contact header for the local instance. It always resolves down to an IP address.

Thank you for your answer!

If you don’t mind I would like to clarify a few things..

What do you mean by the local instance? Those one which is running on a local machine behind the NAT?

Am I correct if I would say that even if asterisk will listen on the public IP address it will not try to resolve IP into domain name?
In my case I was trying to register through the NAT and external public IP but result was the same. Instead of 192.168.1.15 I had an external (public) IP not a domain name.

In this case seems every certificate should contain an IP address which is not very cozily as IP could change and domain will stay the same for a longer time.
Am I right?

BTW It would be very cool to have such feature. I mean if asterisk could resolve IP address in the Contact header.

Thanks!

In SIP there is the Contact for local, and Contact for remote. I was referring to the Contact header which is for Asterisk.

It will not.

It depends on the behavior of things in question. If the connection is reused, instead of establishing a new one, then it doesn’t matter. If that’s not the case then it would need to be present, or checking of that disabled.

There is an open feature request [1]. Noone has submitted a change to implement it, though other projects have implemented it - but never contributed the changes back to the Asterisk project.

[1] [Improvement] FQDN in Contact Header · Issue #13 · asterisk/asterisk-feature-requests · GitHub

Thank you!