Detect external IP - Asterisk SIP settings

I’m wanting to know if there is a way to automatically detect the external IP under asterisk SIP settings.
Reason why is because i’m using a prim/sec SIP trunk which runs over two separate internet lines.
Im thinking on the lines of a cron job that runs every 15 minutes but not sure how get it to detect that IP within the job.

Cheers

I know this is over a year old but there was no answer. I’m also wanting this. I have a dsl line with a dynamic address. The ip address changes every few weeks. I keep having to log into the pbx and click the detect IP address in the SIP settings manually.

Is there some automated way to do this? And yes, a cron job would be just great, has anyone written one they could share or let me know what to do and I can write one myself.

Use “Dynamic” for your external address type and register your PBX with one of the many DDNS servers. Seems to me, the Sangoma folks even have one. Right @lgaetz Lorne?

Correct. System Admin Pro gives you a DDNS fully qualified domain name.

In fact, I have done this but it’s not working for me.

In the SIP Settings page under NAT settings, I have the External Address and a Detect External IP button. I have to press that button each time the IP address changes.

In the Chan Sip settings page, I have the Dynamic IP selected and I have my DDNS name in there and a refresh time of 120s.

Maybe I am confusing two separate things here? One thing is clear though, I can’t place or receive calls after I get a new IP address until I press the Detect Externa IP button manually. I’d really love to figure out how to avoid this.

Anyone have any advise how to debug this, why isn’t it updating the address automatically?

If you push this button, the current “static” IP address for your connection is set. That is definitely not a Dynamic IP address. Have you tried putting the DDNS name in the external box to see if you can connect?

Chan-SIP requires a working DNS, and I think this is one of the places where that fact is reflected. If you use a host name instead of an address, I think your NAT will get set correctly.

I think a great feature would be to have an option to set the external IP to auto-detect. This would every so often go out and attempt to obtain the wan ip.

1 Like

Did someone find a solution for this?

I do have a working DDNS entry with Cloudflare that is updated automatically by the network firewall when a WAN failover occurs. The entry has a low TTL.

Is it safe to use a FQDN below?

General SIP settings:
Screenshot%20from%202018-10-23%2010-44-28

Chan PJSIP Settings:
Screenshot%20from%202018-10-23%2010-44-42

Based on this post, I’ve changed both settings to my FQDN and it’s working fine.