SIP Trunk & Dynamic IP

Asterock
Posts: 4
Member Since:
2007-04-10

Hi guys,

I have a problem with my Trixbox and I can't seem to figure out why. I believe lots of people have come across this and I'm sure the solution is posted on here somewhere but I'm hopeless to find one that fixes my problem

I have a sip trunk with peer settings as follows:
fromdomain=sip.gotalk.com
fromuser=09XX
host=sip.gotalk.com
insecure=very
nat=yes
port=5060
qualify=yes
secret=XXX
type=peer
username=09XX

and user settings:
context=from-trunk
fromdomain=sip.gotalk.com
host=sip.gotalk.com
secret=XXX
type=user
username=09XX

with register string: 09XX:XXX@sip.gotalk.com/09XX

This is all working fine. However I'm on dynamic IP (my ISP seems to enjoy switching it every couple of days), and everytime it's changed, the sip peer's status appears to be UNREACHABLE. From the log, i've noticed that the registration kept timing out and being resent many times. Here's part of my log:
---------------------------------------------
Sep 26 11:05:52 NOTICE[15678] chan_sip.c: -- Registration for '09437254@sip.gotalk.com' timed out, trying again (Attempt #44)
Sep 26 11:05:52 DEBUG[15678] chan_sip.c: Stopping retransmission on '6af227be56b810692f0dde372fef59b2@127.0.0.1' of Request 145: Match Found
Sep 26 11:05:52 DEBUG[15678] acl.c: ##### Testing 202.169.178.10 with 10.1.2.0
Sep 26 11:05:52 DEBUG[15678] chan_sip.c: Target address 202.169.178.10 is not local, substituting externip
Sep 26 11:05:52 DEBUG[15678] chan_sip.c: Scheduled a registration timeout for sip.gotalk.com id #1408
Sep 26 11:05:53 DEBUG[15678] acl.c: ##### Testing 202.169.178.10 with 10.1.2.0
Sep 26 11:05:53 DEBUG[15678] chan_sip.c: Target address 202.169.178.10 is not local, substituting externip
Sep 26 11:05:53 DEBUG[15678] acl.c: ##### Testing 10.1.2.103 with 10.1.2.0
Sep 26 11:05:53 DEBUG[15678] chan_sip.c: Stopping retransmission on '41727e4d741bf164408bdd0717a833b2@10.1.2.10' of Request 102: Match Found
---------------------------------------------

And here's the sip debug from the CLI:
---------------------------------------------
---
asterisk*CLI>
Retransmitting #2 (no NAT) to 202.169.178.10:5060:
REGISTER sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK2ac18436;rport
From: ;tag=as1d96ee61
To:
Call-ID: 6af227be56b810692f0dde372fef59b2@127.0.0.1
CSeq: 151 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact:
Event: registration
Content-Length: 0

---
asterisk*CLI>
Retransmitting #4 (NAT) to 202.169.178.10:5060:
OPTIONS sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK0d9810b4;rport
From: "Unknown" ;tag=as2ec09c68
To:
Contact:
Call-ID: 0d985ff551b53b754da77a1956048a19@219.90.175.100
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 26 Sep 2007 01:37:31 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Content-Length: 0

---
Destroying call '0d985ff551b53b754da77a1956048a19@219.90.175.100'
Retransmitting #3 (no NAT) to 202.169.178.10:5060:
REGISTER sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK2ac18436;rport
From: ;tag=as1d96ee61
To:
Call-ID: 6af227be56b810692f0dde372fef59b2@127.0.0.1
CSeq: 151 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact:
Event: registration
Content-Length: 0

---
Retransmitting #4 (no NAT) to 202.169.178.10:5060:
REGISTER sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK2ac18436;rport
From: ;tag=as1d96ee61
To:
Call-ID: 6af227be56b810692f0dde372fef59b2@127.0.0.1
CSeq: 151 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact:
Event: registration
Content-Length: 0

---
Retransmitting #5 (no NAT) to 202.169.178.10:5060:
REGISTER sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK2ac18436;rport
From: ;tag=as1d96ee61
To:
Call-ID: 6af227be56b810692f0dde372fef59b2@127.0.0.1
CSeq: 151 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact:
Event: registration
Content-Length: 0

---
12 headers, 0 lines
Reliably Transmitting (NAT) to 202.169.178.10:5060:
OPTIONS sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK5604ac55;rport
From: "Unknown" ;tag=as6cd58843
To:
Contact:
Call-ID: 57bde5cf363875e014fd30be050ba2ab@219.90.175.100
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 26 Sep 2007 01:37:45 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Content-Length: 0

---
Retransmitting #1 (NAT) to 202.169.178.10:5060:
OPTIONS sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK5604ac55;rport
From: "Unknown" ;tag=as6cd58843
To:
Contact:
Call-ID: 57bde5cf363875e014fd30be050ba2ab@219.90.175.100
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 26 Sep 2007 01:37:45 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Content-Length: 0

---
Retransmitting #2 (NAT) to 202.169.178.10:5060:
OPTIONS sip:sip.gotalk.com SIP/2.0
Via: SIP/2.0/UDP 219.90.175.100:5060;branch=z9hG4bK5604ac55;rport
From: "Unknown" ;tag=as6cd58843
To:
Contact:
Call-ID: 57bde5cf363875e014fd30be050ba2ab@219.90.175.100
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Wed, 26 Sep 2007 01:37:45 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Content-Length: 0

---------------------------------------------

When IP changes and i discover quick enough to do a "reload" it's fine. However, if it happens overnight, sip trunk becomes UNREACHABLE. A reboot of the machine will normally fix the problem.

Your help is very much appreciated.
Thanks
Tho



W1zz
Posts: 562
Member Since:
2006-05-31
How about using a cron job

How about using a cron job to look for a changed IP address and then restarting asterisk?

--

Alan

install-ZAPHFC

Look here for more help.
Current version is 1.4.0 (25 January 2008)



techieg
Posts: 279
Member Since:
2006-06-13
ITSP Issues

I doubt that what you described is your problem. I don't know of anyone that uses a static WAN IP with TB to connect to their ITSP (at least I don't). the way it works is that when your router sends packets to your ITSP, no matter what the IP address is, it will have the WAN IP address information in message header on each packet so that the receiving end knows what WAN IP address it came from and where to send a message back to. And it seems your TB is trying to reach your ITSP but your ITSP is refusing registration or not responding to it. I am sure you are able to browse the internet without this problem regardless of what/when your WAN IP changes, it should work the same way with your ITSP. And if you are not experiencing the same problem with your internet browsing, it further proves that your router is sending the right updated WAN IP information and getting the right response from websites.

This brings me to conclude that the reason why your ITSP is unreachable has to do with something else on your ITSP's side. You should try a different ITSP like http://connect.voicepulse.com/



Asterock
Posts: 4
Member Since:
2007-04-10
Thanks techieg, your

Thanks techieg, your reasoning is very convincing as I've noticed from the log that my TB does send registration details to the ITSP with the updated IP. I guess I'll have to try Wizz's suggestion.

Thanks again
Tho



smaikol
Posts: 67
Member Since:
2007-01-28
just use dynamic dns, it's

just use dynamic dns, it's simple, it's free, it's useful! i use it in several installation with customers that have dynamic ip on adsl.

bye
smaikol



techieg
Posts: 279
Member Since:
2006-06-13
dyndns.org

Ues, you can try dyndns.org , although it is usually not necessary unless you have remote TB and extensions registering with your TB. As simple as setting;

externip=YourWANIP
localhost=YourTBLocalIPAddress/SubnetMask

I use it all the time since I always have remote stuff registering to my TB.



Asterock
Posts: 4
Member Since:
2007-04-10
Why then when TB machine is rebooted, it's OK?

Just wondering why when the TB machine is rebooted, SIP peer is registered OK again? Does this mean Asterisk gave up registering? If so, is there a way we can manually re-trigger this?

Tho



techieg
Posts: 279
Member Since:
2006-06-13
Troubleshoot

If you check your TB activity you will see that if it cannot register it keeps attempting to register. But if there is an issue it may not be able to register. There is certainly no need to re-trigger it because it automatically does this as the default nature of VoIP protocols. You cannot effectively troubleshoot this if you do not try another ITSP to at least rule out the possibility of it being an ITSP issue because you already know that your internet service is fine and TB registers but re-registering seems to be an issue. connect.voicepulse.com is a good alternative to try because they don't charge you any startup/activation fee, you only have to deposit $50 into your account which sits there if you do not use it.



16again
Posts: 370
Member Since:
2007-03-04
From your log: Sep 26

From your log:
Sep 26 11:05:52 DEBUG[15678] chan_sip.c: Target address 202.169.178.10 is not local, substituting externip

Is asterisk already aware that this externip has changed??

@techieg
After an IP change, most likely this new address is used correct in the IP-header. AFAIK the sip messages also contain IP addresses inside the SIP registration request, which I suspect doesn't match new externip



Undrhil
Posts: 264
Member Since:
2006-06-25
"How about using a cron job

"How about using a cron job to look for a changed IP address and then restarting asterisk?"

I think this is the best answer for this thread. Yet, everyone ignored it. This is basically the same thing you are already doing manually (looking for changing IP and rebooting the machine) except this way, the machine does it all for you and you never have to worry about it again.

Give it a shot. Of course, I don't know anything about cron jobs, but maybe W1zz will be able to help you get it configured, since it was their post originally?



techieg
Posts: 279
Member Since:
2006-06-13
Best Response?

@Undrhil,

This anything but "the best answer on this thread" as the current behavior described is abnormal and I have explained the basics from a network operations standpoint and where to obviously look. Did you ever think that live calls will be terminated in the process Asterisk restarting after an IP address change mid-day. You need to think about that. Restarting Asterisk (and killing all live calls ) when an IP changes is certainly nowhere near the best option.



Asterock
Posts: 4
Member Since:
2007-04-10
You've just raised a very

You've just raised a very good point which i never thought of techieg. Restarting Asterisk in the middle of a live call is certainly unpleasant. Let's assume that it's my ITSP's issue, it doesn't explain why a TB machine reboot will fix it. From the log, I still don't get "Scheduled a registration timeout for sip.gotalk.com id #1408" and "202.169.178.10 is not local, substituting externip". 202.169.178.10 is the IP of my ITSP and it's certainly static.

BTW, I'm from Australia so voicepulse.com won't be much help :(.
Cheers



techieg
Posts: 279
Member Since:
2006-06-13
Any Other ITSP Should Do.

You may have to look at another ITSP in general, it does not have to be voicepulse.



bubbapcguy
Posts: 3774
Member Since:
2006-06-02
Not a ITSP thing

it is not really a " swap ITSP" thing as you will find this with MANY of the low cost / low end providers.

Just try to re-register the sip connection to the ITSP.



techieg
Posts: 279
Member Since:
2006-06-13
Echo?

If you read the posts you will understand that he has been rebooting to re-register manually everytime there is a dynamic IP address change as opposed to SIP automatic re-registration. So you are basically echoing what he is already doing and do not want to continue with. Only if another ITSP is tried can anything else be ruled out at this point, he has done all he an possibly do on the local network. So depending on the outcome of another ITSP he will then know where to look or if the problem is resolved at that point.



jeb
Posts: 176
Member Since:
2006-08-22
Filler post

This is just a filler post so that techieg can post his good suggestion after this (again). :)

-- James



16again
Posts: 370
Member Since:
2007-03-04
Live calls??

"Did you ever think that live calls will be terminated in the process Asterisk restarting after an IP address change mid-day"
To begin with: I doubt there will be any live calls left after this IP change.



ajw01
Posts: 16
Member Since:
2007-02-25
Static IP

Sorry if this is stating the obvious here but why don't you just get a static IP??



techieg
Posts: 279
Member Since:
2006-06-13
Static IP??

Thanx for the compliment jeb, I will always provide "good suggestions" whenever I can.

If it was that easy to get static IP do you think this thread would even exist? Of course not. ISPs do not let getting static IPs easy/cheap. I know for sure that I have inquired about this from various ISPs and they would say you need to get business internet service to get static IP and that means a lot of monthly cost. For example Comcast provides residential internet connections with 8Mbps at about $50/month without static IP, to get static IP at the same bandwidth you have to get Comcast Business which costs $260/month...go figure.



mlapeyre
Posts: 1
Member Since:
2007-07-03
Analysis

1. TB has a public dynamic IP.
2. TB has not set the externip parameter, so, SIP headers contain the TB's private IP address, not a public one.
3. But it can register the first time, so, the ITSP Registrar uses the TB's external public IP to communicate with it, not the private one in the headers.
4. TB can't re-register after a change in public IP, so, because for TB's Register messages it doesn't matter which public IP has at that moment, it must be a ITSP issue with re-registering.



Conrad
Posts: 28
Member Since:
2010-01-31
No other options

Hi all, I have exactly that same problems except i have no choice but to resolve the problem because:
1.) In South Africa, there simply is no competitive alternative to my current provider. (Ones that provide SIPs).
2.) My ISP rests my IP every night between 10:00 and 12:00. So basically my TB is offline every morning when i arrive at work. (its getting a little irritating).
4.) Its not possible to get a Static IP address in SA with out bankrupting your self.
5.) I have little knowledge of Linux - so basically all i have is the web page control panel. (No use in this case).

I'm very interested in the "cron job" options - i have a number of servers and system that do all sorts of rebooting and resetting here in the office. (I very much a fan of this since i know that almost everything works after a restart, so why not just restart every night.) Besides I'm not there and do care about dropped calls.

I'm no good at Linux, I just want to know how i can reset the TB at say 6:00 am? (I'm doing this anyway every morning). At least this way ill be good to go every morning.

P.S. Basic Setup as follows:
Using:
dyndns.org

Have Added:
externhost = xxxxxx.dyndns.org
externrefresh = 5
localnet = 192.168.1.XX/255.255.255.0

Other than adding the Trunk details from the ISP and adding the detail above - this is all that i have done



415eric
Posts: 416
Member Since:
2009-10-29
Do what Conrad said

It's cheap, quick, and easy. You won't need to reboot the server at most you may make a cron job that reloads asterisk. All of my servers have static IP's but I still use externhost simply because it makes my life easy. If a client goes from 1 static to 5 statics all I have to do is change their DNS record and the system is back working. If a client changes to a different ISP I can do a quick DNS change and it all works.

For your purposes get a router that supports dyndns. Purchase a WRT54GL, 59.99 on Newegg, flash the firmware with DD-WRT, FREE.

--


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.