SIP Provider unregisters after random period of time

Hi all, I have a strange problem. I have configured a voip provider and it registered fine. We are able to make and receive calls fine. But strange thing is that it randomly times out and thne unregisters after a “Forbidden” message. It only registers back when I issue a “sip reload” from console.

Below is the log

[Jun 21 00:06:54] NOTICE[17334] chan_sip.c: – Registration for ‘xxxxxxxxx@provider.com’ timed out, trying again (Attempt #2)
[Jun 21 00:07:14] NOTICE[17334] chan_sip.c: – Registration for ‘xxxxxxxxx@provider.com’ timed out, trying again (Attempt #3)
[Jun 21 00:07:34] NOTICE[17334] chan_sip.c: – Registration for ‘xxxxxxxxx@provider.com’ timed out, trying again (Attempt #4)
[Jun 21 00:07:54] WARNING[17334] chan_sip.c: Forbidden - wrong password on authentication for REGISTER for ‘xxxxxxxx’ to ‘provider.com

sa0587CLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
provider.com:5060 N xxxxxxx 45 No Authentication Tue, 21 Jun 2016 00:05:49
1 SIP registrations.
server
CLI> sip reload

Thanks.

You should post a detailed SIP log to be able to see the root cause of this.

It’s probably either your configuration or a NAT problem.

You should post your trunk configuration.

Thanks for quick replies.

@mrichards , Sorry that I don’t have a sip debug log as it happened randomly yesterday after almost 1-2 months. Same happened 3 months ago.

@surp, dear if there is a nat issue then I think it shouldn’t register at all, while it works fine for weeks. Here is trunk config.

[provider]
type=friend
secret=yyyyyyyyyy
username=XXXXXXXXX
fromuser=XXXXXXXXX
fromdomain=provider.com
host=provider.com
insecure=invite
dtmfmode= rfc2833
context=fromprovider

Hi nasirjavaid,
From the information provided, it looks like an intermittent issue on a network level.
First of all (and it was already mentioned above), the full SIP log is needed:
sip set debug on peer provider

Then, could you specify how asterisk is connected to Internet? Does the server have a public IP or a private one? If private, where is NAT performed and how is it configured in sip.conf?

Please provide [general] section of sip.conf (you may replace public IPs by made-up ones).

Hi,

Yes I can understand that a full debug log may be needed to deeply diagnose the issue but as this issue is randomly occurring so I will have to wait for next event. But even if there is a brief network issue then provider should get registered when net restores… shouldn’t it? or is there any setting which prevents re-connection?

Server is on public IP and general section of sip.conf is standard and hasn’t been changed.

Cheers.

Have you tried using IP’s instead of domain names? This could be another one of those cases where the provider uses multiple IP’s resolving to one domain. Asterisk isn’t capable of dealing with that unless you are using PJSIP. It often shows up as intermittent problems as the IP changes. Asterisk only resolves the DNS name when it registers or you do a reload. So if the IP changes between registrations Asterisk will try use the wrong IP. However, that is usually only a problem for inbound.

You need to create one SIP trunk for each IP the provider uses.

Try do a dig provider.com and see if multiple IP’s are returned.

Your provider should tell you what are you sending wrong when he is replying back with the sip 403 forbidden

Thanks for replies guys, looks like I am late on replying - lol

Well the IP doesn’t change as provider is on single static IP…
Secondly request doesn’t reach provider as it times out and then next time it gives error on username as you can see in logs.

Cheers!