Trunk does not come back online after Internet Outage

I’ve read a few things about this problem but I can’t fix it.

Here’s what’s happening:

A few of our customers are running FreePBX Distro 11 with voip.ms SIP trunks (not IAX2).
When the Internet drops and comes back, the trunk stays unregistered indefinitely. The public ip address sometimes changes in the process.

To make it work again, I must disable the trunk and re-enable it. I’ve tried rebooting the router but it doesn’t fix it.
Another thing that seems to fix it is to write the public ip address under “External Address” (in SIP Settings) instead of a dyndns address, which makes me think that it’s a DNS cache problem. We are using dyndns names in the “External Address” field because most of our customers don’t have a fixed IP.

The tunks are configured with IP adresses (not domain names) and they have the qualify=yes option.

Here is what happens in the log when the trunk drops:
NOTICE[2611] chan_sip.c: Peer ‘voipms’ is now UNREACHABLE! Last qualify: 28
Followed by an infinite amount of:
Registration for ‘[email protected]’ timed out, trying again (Attempt #2)

In the DNS configuration of FreePBX, I use 127.0.0.1 and 8.8.8.8

Does anyone know how to fix this ?
I’m not sure if you guys need more info to help me resolve this. If you do, please let me know.

I’m still having this issue from time to time. This morning, one of our customers had his voip.ms trunk disconnected. By checking the logs, I was able to see that the Internet connection was reset during the night, but the public IP did not change (they have a dynamic IP). I disabled the trunk for around 30 seconds and re-enabled it. It reconnected. I’ve read a ton of posts that mention DNS problems, but the trunk is configured with IP adresses, no domain names. The only domain name in use is the the external address in the SIP settings (I use the xxxxxx.deployments.pbxact.com address).

It seems to me we’ve seen this problem here before.

Bells this rings:

  • Asterisk has a “hammering” preventer that stops asking if the error persists.
  • Chan-SIP has trouble with resetting after certain errors.
  • PJ-SIP does reconnect, but there was some kind of problem.
  • There have been a couple of scripts posted that help reconnect disconnected SIP trunks.

I don’t know if any of those help, or even if they are accurate, but I know we’ve discussed this at length and the problem required some kind of external intervention.

Yeah I’ve read about the script but I wasn’t able to make it work. I might give it another try.

Failing all of that, “fwconsole restart” at the console (or in a cron job) will certainly reconnect it.

Just disabling an re-enabling the trunk makes it work.

After hours of research, I found this thread:
https://redmine.pfsense.org/issues/1629

It is, word for word, the exact description of my problem (PFSense problem)

Here’s the part with (hopeflully) the solution (time will tell):

When your IP changes multiple times in a very short period, as it did there, it’ll miss killing states for some of the old IPs because it’s changing so quickly. You’ll need to enable the ip_change_kill_states option so all states get wiped on IP change where your IP changes that quickly. Go to Diag>Command, and in the PHP execute box, paste in:

$config['system']['ip_change_kill_states'] = true;
write_config();

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