My FreePBX 15 is up and running behind a Fritz!Box via NAT.
Everything worked fine for some time but now I found that my external “static” IP is not really static and it may be changed.
So I can’t no longer use in SIP Settings -> General SIP Settings -> NAT Settings a fixed “External Address” via “Detect Network settings”.
I want to use our own web server to get my external IP address and no external service.
Is it not possible to use a custom shell command as shown in my initial mail? How about changing a configuration via shell command after an IP change occurred? This would be pretty easy to set up but I have no clue what configuration has to be changed.
My solution is now the usage of a DNS name in the External Address field of the SIP settings.
This name is resolved via “/etc/hosts” entry.
Now I use a cron job to check frequently the external IP. In case it did change the hosts file is updated.
You don’t need the cron job (and shell script, I assume) to modify /etc/hosts. While chan_sip “always” supported a FQDN in FPBX External Address, chan_pjsip just got this capability relatively recently (some time in 2018).