|
Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 1
|
|
got problem:
i have two almost "out of box" installations of Elastix.
versions are 1.1.8 and 1.2 RC2 and both of them have the same issue.
when i add external SIP trunk from VoIP-provider with REGISTER string - it still works, and able to receive calls from VoIP, ZAP etc
when my external DSL link goes down, registration fails:
"sip show registry" shows that external provider is unreachable - that's OK,
BUT:
1. Asterisk stops responding on incoming ZAP calls, even if they are routed to LOCAL sip phones
2. i can't place calls from internal SIP-phones.
SIP calls are not routed at all.
IAX soft-phones still can work normally.
it looks like CHAN_SIP.SO is FROZEN at all - until i put internet cable back.
when i don't use REGISTER statement, internal SIP, IAX and ZAP calls are routed without any dependency on internet connection - as it should be.
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 1
|
|
"register string" is like this:
sip_registrations.conf:
register=USER4232:password@212.53.40.40/3686871
---------------------
when internet link is alive, registration is OK, all calls are routed well
*CLI> sip show registry
Host Username Refresh State Reg.Time
212.53.40.40:5060 USER4232 105 Registered Mon, 08 Sep 2008 23:01:22
---------------------
when internet link is down, registration is broken:
*CLI> sip show registry
Host Username Refresh State Reg.Time
212.53.40.40:5060 USER4232 105 Request Sent Mon, 08 Sep 2008 23:05:13
no SIP calls are routed at all - external, internall, from ZAP to internall etc
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 9
|
|
This is a longstanding, somewhat well known bug in Asterisk itself. I don't know if they ever plan to fix it, but if they do it will probably be in the 1.6 branch (maybe they will backport it and maybe they won't). This is the sort of bug that so frustrates Asterisk users and developers, because Digium knows about the issue but so far hasn't done anything about it (as far as I know).
As I understand it, the problem is only present if you have one or more SIP trunks. If you only have one SIP trunk, there is an off chance that local (extension to extension) calls may still go through, albeit very slowly. If you have two or more SIP trunks, then local calls will timeout while Asterisk twiddles its thumbs waiting for the SIP trunks to connect, and the local calls will time out and never connect.
I don't know how to find my way around the Asterisk bug tracking system, otherwise I might be able to show you where the bug has been reported. However it affects ALL distributions that use Asterisk. It only affects SIP channels, so if (for example) you have two softphones that use IAX protocol (e.g. Zoiper), they will be able to place calls back and forth, but SIP-based extensions will be unable to communicate.
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 1
|
thank's for attention.
there was a discussion forums.whirlpool.net.au/forum-replies.cfm?t=960451
i can't make it clear: is DNS resolution the source of problem, or lost connectivity to voip is the problem itself.
tried to change all FQDN names of VoIP to IP addresses - it did not help.
tried to create the "dumb trunk" that is always accessible - using OpenSER installation on the same machine - it did not help too.
really frustrating - i think hybrid PBX that falls down completely when it looses internet connectivity is useless.
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 1
|
|
after some research, found that chan_sip freezes when it cannot resolve SRV names like _sip._udp.somedomain (when we have lost internet connection, and DNS is outside).
changing all host.domain names to ip-addresses and adding string "srvlookup=no" to sip_general_custom.conf works like antifreeze.
not very beutyfull, but better then denial of service.
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 0
|
|
I bumped on the same thread in whirlpool.net.au. Dummy trunks using SPA and VM did not work for me also. I have couple of servers currently migrating to Elastix and it seems that this issue is more noticed than with the previous one.
My SIP provider specifically define to put srvlookup=yes in sip_general_custom.conf, anyways I tried it and confirm that chan_sip is not freezing but he timeout keep on repeating so call set-ups is delayed from time to time.
The problem is very repeatable so it is easy to compare between testings. I found that DNS resolution for SIP trunks is not the issue since with local caching DNS and non-caching, the result is just the same when I force asterisk to reload it config
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 9
|
I tried posting a feature request to handle this issue on the FreePBX bug tracker, as you can see it didn't get very far for the moment:
www.freepbx.org/trac/ticket/3199
Subsequently there was a discussion with a few people on IRC. There were two points I took away from that. One is that the IRC commenters seemed to agree that using a FQDN is the cause of the issue - if you can use a static IP (dotted IP address, such as 12.34.56.78) then (they say) you don't have the problem. Of course, the only issue with that is that if the provider changes fixed IP addresses and repoints the FQDN to point to the new IP, then you would not pick that change up and may lose connectivity to that provider. Maybe someone could make a script that would look up a FQDN and plug the address it points to into the correct trunk config at regular intervals, but the problem with THAT is that the setting is probably stored in the MySQL database and rewritten when ever you change FreePBX configuration. So you'd have to change the static IP address in the MySQL database and then cause FreePBX to reload... that does not sound easy at all.
philippel (the head developer of FreePBX) thought that something like dnsmasq might address the issue. His suggestion was that you run something like dnsmasq on your PBX, and you make sure that the local PBX is resolving from that cache (he said it requires a few 'tricks' from the standard dnsmasq config). Then you point dnsmasq to what ever your real dns sever is. He said that he thinks there is information in dnsmasq readme, you just have to be aware that is your desired setup, otherwise the server where dnsmasq is running will actually go to the real dns server, but a quick and dirty test is set dnsmasq up on a different server in your network, and point your asterisk server to that server as the dns source, then you don't have to worry about the issue for testing purposes. You can install it using "yum install dnsmasq" (he said it's on the dag repository???) and then you'll have to review the config...
The dnsmasq "man" page is at www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html and there's an additional doc page at www.thekelleys.org.uk/dnsmasq/doc.html
Unfortunately I am not a Linux guru so most of that was pretty much over my head. One other point that was made on IRC is that something related to DNS was fixed in Asterisk 1.6 (it's in the changelog) but the person who mentioned that did NOT know if the change was related to this particular issue. If it was, I sure wish they'd backport it.
If anyone DOES figure out how to use dnsmasq to resolve the issue, it would be very helpful if you could post step-by-step, "cookbook" type instructions so those of us who have difficulty doing anything in Linux could get this to work!
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 1
|
i'm completely new to linux too
so, as far as i understand, dnsmasq is just a caching-only dns-server, which you can setup on a pbx machine.
somewhere i found this step by step (sorry, i did not save authors name) how to setup local dns caching only server:
1. Install cache only name server on the Asterisk server (BIND with caching configuration)
yum -y install caching-nameserver
chkconfig --add named
chkconfig --level 345 named on
echo "* IN A 127.0.0.2" >> /var/named/localdomain.zone
service named start
2. Set Asterisk as its own DNS server by adding 127.0.0.1 on the first line of /etc/resolve.conf, like
127.0.0.1
your.other.dns.servers
3. Make sure Asterisk has default settings for file /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=your_asterisk_server_name.localdomain
(Do not change HOSTNAME to your_asterisk_server_name.yourdomain.com )
4. Then in file /etc/hosts, something like
127.0.0.1 your_asterisk_server_name.localdomain your_asterisk_server_name localhost.localdomain localhost
i've tried this setup. it works well for DNS names resolution,
and it helps against the issue. sometimes 
i did not take a long testing, but i found that in some hours SIP goes to bad again.
changing "srvlookup" to "no" helped me better - no faults at all.
need more testing.
|
|
|
|
Última edición: 16/09/2008 05:35 por A.G.A..Razón: english learning.
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 0
|
|
Dotted IP on SIP trunks does not help for me.
I use caching DNS all the time but this will just delay the problem and would appear the system to be unreliable. Asterisk pass DNS resolution to the O/S, I don't think centOS has DNS resolution issue.
I now found the script posted at TB before that monitors internet. Once I can get some positive results on my testing, I will post it here.
icbnsys
|
|
|
|
|
|
|
Re:Asterisk chan_sip freezes when there's no internet hace 1 Año, 10 Meses
|
Karma: 0
|
Here is the modified script. Results of my test server indicates at least 10 minutes to fail over when internet is down after that everything is OK. When internet returns it can quickly recover. Pls use and modify at your own risk.
#!/usr/bin/perl
#icheck.pl
# In the event of internet loss, Asterisk SIP channel doesn't work very
# well. The channel will become very busy registering the trunk to it
# SIP providers that tends to hung-up the server. The SIP registration
# time-out seems forever. This conditions was reported on some sites
# with NAT connection to some SOHO routers.
# This script will replace the SIP registration file with the one with
# registration entries removed.
# When internet connectivity is restored it is swapped back. Asterisk
# will be reloaded every time config is swapped. You should run this as
# a cron job, say every five minutes.
# For internet connection with dynamic IP address, host file need also to
# be modified so that the server host name will be bind to 127.0.0.1
# and removed this binding when internet returns so that the server will
# be resolved to the correct public IP not to the localhost.
# Incorrect host resolution may lead to one-way audio problem on remote
# extensions.
# How to install:
# Backup your sip registration and hosts file in a safe place. Remove
# all registration entries on sip registration file. Backup hosts file
# should contain this entry, add if needed:
# 127.0.0.1 myhost.dyndomain.com
# Save this files as bb_no_sipregistration and bb_no_hosts.
# Then create this file "vi /root/icheck.pl". Set permisson to "chmod
# uog+x".
# Contab settings:
# */5 * * * * /usr/bin/perl /root/icheck.pl
# No changes needed for hosts file if you have internet with static IP.
# Do not load or reload freePBX web gui SIP Trunks when internet is down
# since it will auto-generate sip_registrations.conf file.
use Net::Ping;
my $ip = "198.65.166.131"; # host you want to test for connectivity
my $bb_no_sipregistrations = "/etc/asterisk/bb_no_sipregistrations.conf";
my $bb_ok_sipregistrations = "/etc/asterisk/bb_ok_sipregistrations.conf";
my $running_sipregistrations = "/etc/asterisk/sip_registrations.conf";
my $bb_no_hosts = "/etc/bb_no_hosts";
my $bb_ok_hosts = "/etc/bb_ok_hosts";
my $running_hosts = "/etc/hosts";
my $bb_status = 0; # assume Internet is Down
my $wait = 5;
$p = Net::Ping->new("icmp"); # use icmp ping to desired destination
if ($p->ping($ip) )
{
# Internet is Up
print "Internet is Up.... ";
$bb_status = 1;
if ((-e $bb_ok_sipregistrations)) # check the default version of the config file
{
# Rename active hosts file to no-internet version
# rename (old name, new name)
# Load default version hosts file
# rename (old name, new name)
rename($running_sipregistrations,$bb_no_sipregistrations);
rename($bb_ok_sipregistrations,$running_sipregistrations);
# comment 2 lines below if you have Fix IP.
rename($running_hosts,$bb_no_hosts);
rename($bb_ok_hosts,$running_hosts);
print "loading default config files\n";
print "restarting asterisk\n";
system("service asterisk reload"); # reload asterisk
}
else {
print "No status change\n";
}
}
else {
print "Internet is Down.... ";
$bb_status = 0;
if ((-e $bb_no_sipregistrations)) # check to see if the no-internet version
{
# Rename active hosts file to default version
# rename (old name, new name)
# Load no-internet version hosts file
# rename (old name, new name)
rename($running_sipregistrations,$bb_ok_sipregistrations);
rename($bb_no_sipregistrations,$running_sipregistrations);
# comment 2 lines below if you have Fix IP.
rename($running_hosts,$bb_ok_hosts);
rename($bb_no_hosts,$running_hosts);
print "loading back-up config files\n";
print "restarting asterisk\n";
system("service asterisk reload"); # reload asterisk
exit;
}
else {
print "No status change\n";
exit;
}
}
icbnsys
icybernet at gmail dot com
|
|
|
|
Última edición: 17/09/2008 16:03 por icbnsys.
|
|
|