Use STUN server while registering for receiving inbound calls

Hi,
I am registering my asterisk running on my system (system A) which is behind NAT, to a remote asterisk system which has a public IP (system B). The problem is that I can’t use default NAT settings in pjsip.conf as I don’t have a fixed public IP, it keeps on changing because I use 4G internet.
Is there a possibility that I can configure System A to detect its public IP using ICE/STUN during registration and send that in Contact header?

There is no support for using STUN to automatically determine external IP address for SIP signaling. Only configuring an IP address or hostname is supported.

Ok,
Thanks a lot @jcolp. I have tried another workaround to use external code to identify Server A’s external ip and update it using AMI UpdateConfig, just before registering.
But now even if I reload pjsip, although it shows the updated “external_signaling_address” value in “pjsip show transport trasnport-udp”, yet in the Contact header in Register message it is sending the older value of IP.
This gets resolved only after I do a “core restart now”.
Any idea if this is the default/expected behaviour or there is something wrong?

By default the reloading of transports is disabled due to PJSIP not supporting such a thing. It is recommended that a dynamic DNS hostname be used, with dnsmgr enabled that will automatically resolve and update the IP address.

Ok, Thankyou so much.
I have a limitation as the Server A is a mere Raspberry PI and it is an IOT kind of solution with multiple raspberry pi’s so we can’t really have a domain for each PI.
But as a work around I am now restarting Asterisk Instead. That is working for me.
But it is strange Asterisk doesn’t support ICE for determining public IPs while registration. Is this expected in future?

ICE isn’t used for such a thing, STUN is. I know of noone working on such functionality.

Ok, thanks, you have always been helpful. :slightly_smiling_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.