I am having a problem with Asterisk SIP registration with the SIP provider. The SIP provider is offering a SIP trunk to the Asterisk via the internet connection (NAT router is in the LAN -> WAN path). The unique thing with the Asterisk server internet connection is, that it is very unstable, so the SIP Trunk is unavailable a lot of times.
When the problem happens, first the Asterisk sends a SIP Register request with the wrong password, after that it is sending a SIP Register requests with the wrong username (“asterisk” or a number from the DID range that is provided by the SIP Trunk) and the SIP provider rejects the SIP Registration. Asterisk tries this a couple more times and the SIP provider is rejecting the SIP registration for the SIP Trunk. At the end Asterisk stops sending SIP Register messages alltogether. I can see this if you check the SIP Register status with “sip show registry”. After I do a “sip reload”, the SIP Trunk re-registers successfully.
This is an extract from the log:
[Sep 11 17:07:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #68)
[Sep 11 17:07:59] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #69)
[Sep 11 17:08:19] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #70)
[Sep 11 17:08:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #71)
[Sep 11 17:08:59] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #72)
[Sep 11 17:09:19] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #73)
[Sep 11 17:09:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #74)
[Sep 11 17:09:59] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #75)
[Sep 11 17:10:19] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #76)
[Sep 11 17:10:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #77)
[Sep 11 17:10:59] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #78)
[Sep 11 17:11:19] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #79)
[Sep 11 17:11:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #80)
[Sep 11 17:11:59] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #81)
[Sep 11 17:12:19] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #82)
[Sep 11 17:12:39] NOTICE[2459] chan_sip.c: -- Registration for '123456780@sbc.amis.net' timed out, trying again (Attempt #83)
[Sep 11 17:12:53] WARNING[2459] chan_sip.c: Forbidden - wrong password on authentication for REGISTER for '123456780' to 'sbc.amis.net'
[Sep 12 00:03:58] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"asterisk" <sip:asterisk@sbc.amis.net>;tag=as1388d742'
[Sep 14 10:41:49] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456782" <sip:123456782@sbc.amis.net>;tag=as184c313f'
[Sep 14 10:42:06] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456782" <sip:123456782@sbc.amis.net>;tag=as2d3545bd'
[Sep 14 10:42:13] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456782" <sip:123456782@sbc.amis.net>;tag=as1c525a66'
[Sep 14 10:42:52] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456781" <sip:123456781@sbc.amis.net>;tag=as3a6ade92'
[Sep 14 10:43:16] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456781" <sip:123456781@sbc.amis.net>;tag=as678a6491'
[Sep 14 10:43:34] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456781" <sip:123456781@sbc.amis.net>;tag=as65460bd6'
[Sep 14 11:39:11] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456780" <sip:123456780@sbc.amis.net>;tag=as5912bbc1'
[Sep 14 11:39:33] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"123456780" <sip:123456780@sbc.amis.net>;tag=as050a3877'
[Sep 14 11:58:04] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"asterisk" <sip:asterisk@sbc.amis.net>;tag=as6bc6db70'
[Sep 14 11:58:46] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"asterisk" <sip:asterisk@sbc.amis.net>;tag=as44441ce9'
[Sep 14 11:58:56] WARNING[2459] chan_sip.c: Received response: "Forbidden" from '"asterisk" <sip:asterisk@sbc.amis.net>;tag=as46c2ed4b'
These are the trunk settings in the sip.conf:
register => 123456780:secret@sbc.amis.net/123456780
[Provider_Trunk]
type=peer
host=sbc.amis.net
username=123456780
secret=secret
fromdomain=sbc.amis.net
insecure=invite
port=5060
canreinvite=no
qualify=yes
dtmfmode=inband
disallow=all
allow=alaw
allow=ulaw
context=from_trunk
nat=yes
This problem does not happen when the network connectivity is OK. It also does not happen every time the internet connection is down. But I am still curious if someone has any idea if this can be fixed by adding any new settings to sip.conf. The Asterisk version used is 1.8.5.0.