I’m new to Freepbx and have it working quite well with one exception. I cannot seem to figure out how to get ddns service working / set up properly. I’m sure I’m just missing something with NAT or something. I am not a network expert either so sorry. I’ve been through Wiki and all seems simple but it just doesn’t work.
I can access my network by going to this DDNS address so I know that part is working. Everything works great when, in Asterisk SIP settings, I have external address as my WAN Ip Address, Chan SIP Settings IP Configuration set to Static.
My ISP changes my IP address daily and I don’t realize the phones are down until I try to make a call. At this very moment, if I put my DDNS address in Chan SIP settings and change it to dynmaic it works. If I change my External Address to the 99999999.deployments.pbxact.com it works. BUT, when my IP address changes again today, it will all stop working. I have the time interval in system admin DDNS set to lowest 15 mins. 15 Mins is too long for phones to be down for one, but for 2, it NEVER updates and system never reconnects after an IP address change.
Your external WAN address should be your DDNS FQDN and your Address Type should be set to Dynamic. Leave it that way and your problems should stop (or at least slow to a pace where you can catch them easily).
I should mention that I do have some external phones but the issue I’m facing causes all internal phones to stop working as well. In Connectivity -> SIPSTATION my contact Ip and network ip don’t match when the IP address changes. Right now, I have the DDNS address set up in both places in asterisk sip settings and it works fine. When IP changes, it will stop working until I change it back to the WAN IP, then, once I do and get it reconnected, I can put the DDNS address back in and it works. It is like it is holding on to the old IP even though the ddns address is there AND the ddns address resolves to the new IP address.
Thanks avayax. I’ve made a few changes there but no matter what, it doesn’t seem to reconnect after IP address changes. Even overnight. I’m disonnected most every morning.
System Admin:
Enable DDNS - Yes
External DDNS - 99999999.deployments.pbxact.com
Force IP Address is blank
Update interval is 15 mins.
Detected IP is my WAN IP Address as it should be.
Tony,
Are you suggesting that with Chan Sip it simply doesnt’ work unless I recycle and there is no solution? Is there a better solution for my setup with SIPSTATION? This was basically the default.
avayax,
My External Address is set to by my dyndns address.
We are doing the same thing, reload SIP channel when DDNS address changes.
Try this script and run as cronjob */5 * * * * /root/check-ddns.sh
#!/bin/sh
#
# Check if DDNS end-points have changed for SIP or IAX trunks, and if so, reload
#
# First, make sure current server is running asterisk, else exit w/o action
if [ ! -f /var/run/asterisk/asterisk.pid ]; then
exit
fi
PID=`cat /var/run/asterisk/asterisk.pid`
if [ ! -e /proc/$PID/exe ]; then
exit
fi
#
# Check last known IP address
#
DDNS=_yourDNS_.deployments.pbxact.com"
if [ ! -f /var/run/trunk-ddns/$DDNS ]; then
# If prior IP file doesn't exist, write it if can, and bail till next time
IP=`dig +short $DDNS`
if [ ! -z "$IP" ]; then
echo $IP > /var/run/trunk-ddns/$DDNS
fi
exit
fi
# Get prior IP address
IP=`cat /var/run/trunk-ddns/$DDNS`
# Get current IP address
NEWIP=`dig +short $DDNS`
if [ -z "$NEWIP" ]; then
# DNS failure on getting new address, can only assume unchanged, exit
exit
fi
# Compare new and old
if [ ! "$IP" = "$NEWIP" ]; then
# Different, note new IP address in file
echo $NEWIP > /var/run/trunk-ddns/$DDNS
# Reload SIP trunks in asterisk, presumably to force-reassociation with new end-point
/usr/sbin/asterisk -rx "sip reload"
fi
exit 0
In other words, if my IP configuration is Dynamic IP, and my external IP address changes, Asterisk won’t know until I do a manual SIP reload or click Detect Network Settings?
This is never happening automatically?
I like the script ideas. I did go ahead and order a Static IP but it takes away my dual wan automatic failover so maybe even just an email notification as provided here so we can manually detect ip and get phone up and running quickly if we loose primary ISP.
Like Avayax’s question, I guess I’m just surprised this doesn’t work. I would have thought a lot of people using this system would have this need. Curious if ANYONE has Dynamic DNS working and can share how they got it going?
Of course my IP changed about every 12 hours for the last 2 weeks and now it hasn’t changed since I started this thread! Murphy’s law. I’ll keep watching while I await delivery of static IP.