Asterisk answers with Status 401 Unauthorized


I have a AsteriskNOW Server with Asterisk 11 and FreePBX 12. There is a problem with my SIP Provider. I hope I can explain it understandable.

Asterisk send an REGISTER to ( answers with OK, the peer is successfully registered.

Normally, the server again signaled over the same address without problems. Sometimes, however, there is the problem that the server answers from Then Asterisk responds to INVITE with 401 unauthorized.

I can not make calls and receive calls.

Waiting for a new REGISTER does not resolve the problem. Only a “sip reload” helps further.

Some settings: allowguest=no; nat=no; srvlookup=no

What can I do? Any idea?

I have some more information:

After changing ip address the register works fine. But the qualify SIP Options ist always send to the old ip address - I mean, Asterisk hasn’t understood the change completely.

People could guess all day, you need to explain more about your setup. Network Topology, freepbx version.

It could be something as simple as using a STUN server, but who knows.

Okay, sure.

The asterisk server is local behind a NAT (dynamic ip address) and a software firewall. No ports are forwarded to the pbx.

externhost is resolved with a dyn dns service. Stun is used and set to

With iptables ip addresses are filtered.

Asterisk 11.16.0

peer settings:
[email protected]

I think the problem is, that after a ip address change the peer ip address (shown by Asterisk Info -> Peers) is not been updated.

Any more questions?