Summary:ASTERISK-03199: SIP stack stops working when externhost is set and DNS resolution fails
Reporter:cherso (cherso)Labels:
Date Opened:2005-01-06 14:24:20.000-0600Date Closed:2008-01-15 15:20:40.000-0600
Versions:Frequency of
Environment:Attachments:( 0) externhost_sip_call.txt
( 1) externhost.patch
( 2) externhost.txt
( 3) externip_sip_call.txt
Description:scenario externhost=xxx.dyndns.org
dyndns.org name server stop working (they are not working good right now)
all the sip stack is unavailable, internal sip calls too cause the dns lookup delay/fail
the ast_sip_ouraddrfor function should 1st try to test the localnet to handle the local sip calls
It should check the externhost and externrefresh just when the local test fails. If the gethostbyname fails (temporary dns downtime) it should still use the latest externhost ip address resolved

Jan  6 21:10:36 NOTICE[19081]: chan_sip.c:654 ast_sip_ouraddrfor: Warning: Re-lookup of 'xxxx.dyndns.org' failed!
so when this warning is printed all the sip system is unable to work properly

****** STEPS TO REPRODUCE ******

set the externhost
just remove dns from /etc/resolv.conf
try to made a sip call
Comments:By: nick (nick) 2005-01-06 14:47:35.000-0600

'latest' is not a date. Please put the date from 'show version' in your reports.

By: nick (nick) 2005-01-06 14:51:16.000-0600

Also, related issues discussed in 3086.

By: Mark Spencer (markster) 2005-01-06 17:36:34.000-0600

According to the code it does not do anything differently if it fails.

By: cherso (cherso) 2005-01-07 04:12:08.000-0600

this is blocking all the sip calls...
it should at least handle the local (localnet) sip calls to sip/capi/zap when the dns fails

By: cherso (cherso) 2005-01-07 07:50:55.000-0600

take a look to the logs please
same call to fwd time service
the first using externip=xxx.dyndns.org it's working
the second using externhost=xxx.dyndns.org it's not working

externip setting call is using the right ip address resolved
the externhost it's not

   -- Executing Dial("SIP/1-f42c", "sip/612@fwd.pulver.com|60") in new stack
We're at 82.50.xxx.xxx port 18684
Answering/Requesting with root capability 8

   -- Executing Dial("SIP/1-e594", "sip/612@fwd.pulver.com|60") in new stack
We're at port 18408

edited on: 01-07-05 07:52

By: Mark Spencer (markster) 2005-01-07 08:49:14.000-0600

That's fine, but it doesn't show me anything about what you're putting in externhost/externip.  So far it looks as though you're putting something different in each line.

By: cherso (cherso) 2005-01-07 12:51:17.000-0600

I'm using the same dyndns domain name.
For the 1st call I set up the externip=mydomain.dyndns.org
for the second call externhost=mydomain.dyndns.org

Something wrong in the function that is using the externhost as you can see in my logs

By: Mark Spencer (markster) 2005-01-07 15:31:05.000-0600

Fixed in CVS head.

By: cherso (cherso) 2005-01-07 18:19:14.000-0600

sorry mark I just updated the chan_sip.c with your patch but it didn't fix the problem
I will add the log of the same sip call to 612@fwd
still no audio and there is a problem with the externhost substitution
I've added some ast_log line to show them and us.
as you can see it uses the local ip address going out and
ast_log(LOG_DEBUG, "Target address %s is not local, substituting externip\n"
as not been executed
why it takes so long? 01:10:32 to 01:11:11 to start sending sip packets to fwd?
an  8 01:10:31 VERBOSE[27862]:     -- Executing Dial("SIP/9-747d", "sip/612@fwd.pulver.com|60") in new stack
Jan  8 01:10:32 DEBUG[27859]: Auto destroying call '50F5C699-C161-40C4-8891-AC22878726C2@'
Jan  8 01:11:11 DEBUG[27862]: We are in ast_sip_ouraddrfor them:, us:

edited on: 01-07-05 18:21

By: cherso (cherso) 2005-01-08 18:43:03.000-0600

got it change
memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip));
memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr));

my patch is working better. all the local sip calls are working even when the dns fails
externhost is refreshed only when we really need to go out

the delay problem reported yesterday is still there tho

By: Mark Spencer (markster) 2005-01-08 19:11:45.000-0600

Fixed in CVS head re the sizeof() and moving the externexpire code, as for the delay, well, don't have a broken DNS server.  This is as much work around for broken DNS as I feel comfortable with at this time.

By: Russell Bryant (russell) 2005-01-09 08:50:53.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:20:40.000-0600

Repository: asterisk
Revision: 4722

U   trunk/channels/chan_sip.c

r4722 | markster | 2008-01-15 15:20:40 -0600 (Tue, 15 Jan 2008) | 2 lines

Minor externip fixes (bug ASTERISK-3199)