Link to home
Start Free TrialLog in
Avatar of timbo007
timbo007Flag for New Zealand

asked on

Asterisk Sip help - Registration for '099749871@sip.kiwilink.co.nz' timed out

Hi there, this seems to be a tricky problem...

my configuration is as follows:

I have a ubuntu linux box (8.04) which runs my asterisk. up untill a few weeks ago I was running this on a debian server and would just reboot the system each time this problem happens and it would fix itself, but the hard drive went totally bung on me and so did the power supply so i've moved it to my desktop system in the mean time, I was hoping the problem might fix itself if I moved servers but it hasn't, I also upgraded asterisk from 1.4 to 1.6 on the new system

I have 4 internal extentions, 3 X-Lite clients and 1 ATA adapter for a wireless normal house phone. all these can call each other no problem via asterisk using sip accounts.

I have 1 external sip account to my sip provider sip.kiwilink.co.nz this works fine for a certain period then I have to restart my whole system before it will work again. (approx once per week)


so after a certain amount of time my asterisk server will stop receiving and sending outgoing calls, I get the error in my asterisk log:  Registration for '099749871@sip.kiwilink.co.nz' timed out

This also happens as soon as I restart the asterisk server (not reboot the computer just asterisk):

[Apr 24 13:29:42] NOTICE[19537]: chan_sip.c:19828 sip_poke_noanswer: Peer 'sipout' is now UNREACHABLE!  Last qualify: 0
[Apr 24 13:29:58] NOTICE[19537]: chan_sip.c:9489 sip_reg_timeout:    -- Registration for '099749871@sip.kiwilink.co.nz' timed out, trying again (Attempt #1)
[Apr 24 13:30:18] NOTICE[19537]: chan_sip.c:9489 sip_reg_timeout:    -- Registration for '099749871@sip.kiwilink.co.nz' timed out, trying again (Attempt #2)

I thought it could be a routing or network issue as my previous system had 2 seperate network cards and one was for the local network, the other for WWW. as the error seems to suggest that Asterisk cant get hold of the server.

The problem I'm faced with now is that I can't reboot this PC at the moment as I'm making a DD image of the old HDD from the broken server which looks like it will take several days to complete. and I really should fix this problem so it doesn't happen again.

My internet connection is through a Wireless G ADSL home gateway - WAG200G its using NAT to talk to my computers on the lan including the asterisk server and I'm thinking that I need some extra settings in my config for this to work better?

I just don't know why it would work fine and then stop, I haven't found a pattern that causes it to stop. I have tried restarting asterisk but that doesn't fix it either.  As I have upgraded the version of Asterisk to 1.6 and the problems keep happening I figured it must be to do with the .conf files as there is so many difference between the 2 systems and I'm totally stuck!

Cheers,

Tim




here is part of my sip.conf file:


[general]
context=default                  ; Default context for incoming calls
bindport=5060                  ; UDP Port to bind to (SIP standard port is 5060)
;bindaddr=192.168.2.188            ; IP address to bind to (0.0.0.0 binds to all)
bindaddr=0.0.0.0            ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes                  ; Enable DNS SRV lookups on outbound calls
domain=192.168.2.188                  ; Add IP address as local domain
regcontext=sipregistrations
register => 099749871:XXX@sip.kiwilink.co.nz/1234 ; 202.180.76.167 <- sip.kiwilink.co.nz's IP
;----------------------------------------- NAT SUPPORT ------------------------
 autodomain=yes

[sip_proxy]
; For incoming calls only. Example: FWD (Free World Dialup)
; We match on IP address of the proxy for incoming calls
; since we can not match on username (caller id)
type=peer
context=from-kiwi
host=202.180.76.167

[sipout]
type=friend                            ; we only want to call out, not be called
secret=XXX
username=099749871                  ; Authentication user for outbound proxies
fromuser=099749871                  ; Many SIP providers require this!
fromdomain=tim      
host=sip.kiwilink.co.nz
;usereqphone=yes                  ; This provider requires ";user=phone" on URI
call-limit=2                        ; permit only 5 simultaneous outgoing calls to this peer
the peer
canreinvite=no
qualify=yes
context=from-sipout
;context=maincontext
;disallow=all
;allow=alaw
insecure=invite

Avatar of timbo007
timbo007
Flag of New Zealand image

ASKER

Hers an update...

I can reset my ADSL router and then restart asterisk without rebooting PC and it will start working again! This is still not ideal though... all the time I have internet access etc
Seems as though there are no Asterisk experts around!!
please can someone shed some light on this situation? the above comment I think is suggesting the issue could be to do with my adsl router, but then why would the internet etc still work fine through it? (there are 4 pc's in total on my network) the problem is that it may take a week or so before I know if theres still a problem after trying something and its been working fine for the last few days for instance...
Have you contacted the support of kiwilink to ask if there should be any extra settings? I suppose, that when the problem occurs your ADSL connection is being reset for some reason, at least most providers here in Europe drop the line every 24 hours and then after you reconnect you have new external IP. Maybe this is the problem ...
Maybe a simple corn job which restarts asterisk every night will solve the problem

0 3 * * * asterisk -rx "restart now"
Thanks these are great ideas, I will ask my provider to confirm my sip settings, I don't actually think the adsl router drops any connections or looses any connectivity, its just when I turn it off and turn it back on the Asterisk starts working. I think it was more related to the network adapter being reset sort of thing, and also in NZ (at least for my ISP) they seem to give me the same IP again and again, but perhaps they have just changed that policy and its changing every few days now?? That seems logical so I will monitor my IP and see if it changes.

Cheers!
curiously, what does the output of

asterisk -rx 'sip show registry'

look like during this situation?
hit submit to quickly -- obviously blank your username(s) out of your post... I'm just curious to see the registration state.
hi rdbnz..

below is it but its fine now as you are meaning when the problem happens, so I will have to wait for it to break again :( I think I remember doing this ages ago and it may have said 'registration timed out' but can't confirm that...

My username is no secret as its the phone number :)

I have not added the cron job yet as I would like to see if I can find a better solution so will just wait for it to break again...

I tried restarting my router and I do get the same IP address time and time again

Host                            Username       Refresh State                Reg.Time                 
sip.kiwilink.co.nz:5060         09974XXXX          105 Registered           Thu, 30 Apr 2009 23:34:42
1 SIP registrations.

Open in new window

i've had a similar problem with one of my sip trunk providers.  i send a registration & they don't respond, due to an overloaded sip server on their end.

here's a couple of things you can do:
when it happens just issue a "sip reload" at your asterisk cli prompt.  sometimes that cleared things for me.

in your sip.conf config in the [general] section, you can do something like
registertimeout=2
registerattempts=0

to force re-registration attempts more often, and for perpetuity until the other end responds.

my guess is the provider's end, but that's hard to tell without traces and such.  try the above & see how it goes... that's what i have in my current production config at the moment and am chugging along.

Thanks rdbnz, (are you in NZ? I am... and I thought you might be as you have nz in your username...)

I'm pretty certain its not at my providers end because the very second I reboot or restart my router it works, if I restart Asterisk when the problem occurs it does not reconnect which I imagine would have reloaded the SIP connection to the server like 'sip reload'. I will try doing that though and see what the response is. (also I don't think NZ has any SIP servers that could possibly be overloaded due to our monopolistic Telcos that squash technologies like SIP & Asterisk meaning not many people use them...)

This has been an ongoing problem for many months now but I am only just trying to fix it now :(

(no, not in new zealand... nz is part of my real name.)

in my case, my provider was overloaded.  we were only able to come to that conclusion after much network debugging and snooping to the point where i could prove i was sending registrations which they received but didn't respond to.

next time it happens, 'core set verbose 3' to grab some debug output and 'sip show registry' to get the registration state.  we'll see if we can find anything...
so it broke again.... All I was able to do to resolve the issue is reboot my router I suspect that the router is hanging after a certain amount of sip data goes through it. I will try rebooting the router every few days and see if that solves it, if it does then that makes it a very annoying problem as I don't want to have to reboot my router all the time... any ideas?

Below is the "sip show registry" during when it was down, reconnecting and then online...
Connected to Asterisk 1.6.0.9 currently running on tim-desktop (pid = 22628)
tim-desktop*CLI> sip show registry 
Host                            Username       Refresh State                Reg.Time                 
sip.kiwilink.co.nz:5060         09974xxxx          105 Request Sent         Tue, 12 May 2009 02:10:45
 
tim-desktop*CLI> sip show registry
Host                            Username       Refresh State                Reg.Time                 
sip.kiwilink.co.nz:5060         09974xxxx          105 Unregistered         Tue, 12 May 2009 02:10:45
 
tim-desktop*CLI> sip show registry
Host                            Username       Refresh State                Reg.Time                 
sip.kiwilink.co.nz:5060         09974xxxx          105 Registered           Tue, 12 May 2009 14:08:26

Open in new window

Ok, remembered to do the 'core set verbose 3' this time and came back with the following (in code)

This time it directly happened as a result of me setting my adsl router to PPPoE when it should have been PPPoA (PPPoE didn't work - I was just testing to see if my ISP supported this method for bridging mode) but when I changed it back to PPPoA Asterisk didn't work, instantly when I rebooted my adsl route I could make calls again...

So its looking like my ADSL router may have something to do with it.. I will look for an updated firmware for it ( a Linksys WAG200G) ... any other ideas?
tim-desktop*CLI> core set verbose 3
Verbosity was 0 and is now 3
  == Using SIP RTP CoS mark 5
    -- Executing [13761111@default:1] Dial("SIP/tim-0086c210", "SIP/3761111@sipout,40,r") in new stack
  == Using SIP RTP CoS mark 5
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'SIP/tim-0086c210' status is 'CHANUNAVAIL'
tim-desktop*CLI> 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of rbdnz
rbdnz
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had a careful look through my config and couldn't find "sip application layer gateway" but have added the UDP pass through to the asterisk server port 5060. I think I will close this question and award you the points rbdnz as all your ideas have been on the right track and helped me none the less. I am now in the process of building a new server with virtual servers to run Asterisk, web proxy, web server & a firewall and then the router will just act as a DMZ to the firewall as my long term solution. I think for sure the problem lies somewhere in the linksys and I think you have helped prove it.

My next question will be titles 'how to make asterisk ring' as in when callers call our phones there is only silence until someone answers... should be a breeze compared to this one :)
cheers, theres no point in spending more time on this i think the point is that my linksys router is causing the problem so replacing it will solve it, thanks!