Dns problem

Hi, I am using asterisk version 11.5.1

Everything is working fine on my asterisk box.

When I set ANY dns(A good or a bad) in /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.0..
netmask 255.255.255.0
gateway 10.0..
dns-nameservers 8.8.8.8 <------------------------

The call takes about 40 seconds before the callee starts to ring.
If NO DNS is set everything works as it should.

Server Address is: 10.0..
Caller is: 10.0..21
Callee is: 10.0.
.23

Asterisk Debug on Log WITH DNS:

--- (13 headers 13 lines) ---
Really destroying SIP dialog '29362ddb1510b1787ab1a90c5896e733@10.0.*.*:5060' Method: OPTIONS
Reliably Transmitting (NAT) to 10.0.*.21:46983:
OPTIONS sip:2250@10.0.*.21:46983;ob SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK1237646c;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as60753440
To: <sip:2250@10.0.*.21:46983;ob>
Contact: <sip:asterisk@10.0.*.*:5060>
Call-ID: 7c275a984c807555320e9aae118d54e2@10.0.*.*:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 11.5.1
Date: Fri, 30 Jan 2015 15:44:50 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:10.0.*.21:46983 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.*.*:5060;rport=5060;received=10.0.*.*;branch=z9hG4bK1237646c
Call-ID: 7c275a984c807555320e9aae118d54e2@10.0.*.*:5060
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as60753440
To: <sip:2250@10.0.*.21;ob>;tag=z9hG4bK1237646c
CSeq: 102 OPTIONS
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Accept: application/sdp, application/pidf+xml, application/xpidf+xml, application/simple-message-summary, message/sipfrag;version=2.0, application/im-iscomposing+xml, text/plain
Supported: replaces, 100rel, timer, norefersub
Allow-Events: presence, message-summary, refer
User-Agent: CSipSimple_hltecan-19/r2457
Content-Type: application/sdp
Content-Length: 284

v=0
o=- 3631621547 3631621547 IN IP4 192.168.1.56
s=pjmedia
t=0 0
m=audio 4000 RTP/AVP 99 0 8 101
c=IN IP4 192.168.1.56
a=sendrecv
a=rtpmap:99 SILK/24000
a=fmtp:99 useinbandfec=0
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
--- (13 headers 13 lines) ---
Really destroying SIP dialog '7c275a984c807555320e9aae118d54e2@10.0.*.*:5060' Method: OPTIONS

<--- SIP read from UDP:10.183.24.74:45793 --->

<------------->

<--- SIP read from UDP:10.183.24.80:33857 --->

<------------->

<--- SIP read from UDP:10.0.*.*5:5060 --->

<------------->

<--- SIP read from UDP:10.183.24.71:52041 --->

<------------->

<--- SIP read from UDP:10.183.24.68:39032 --->

<------------->

<--- SIP read from UDP:10.183.24.79:56344 --->

<------------->

<--- SIP read from UDP:10.0.*.23:5060 --->

<------------->
Reliably Transmitting (no NAT) to 10.0.*.23:5060:
OPTIONS sip:2251@10.0.*.23:5060 SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK70e51baa
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as002619f6
To: <sip:2251@10.0.*.23:5060>
Contact: <sip:asterisk@10.0.*.*:5060>
Call-ID: 1bc7c1612b40fc1d775a94776424bfc8@10.0.*.*:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 11.5.1
Date: Fri, 30 Jan 2015 15:44:54 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:10.0.*.23:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.*.*:5060;received=10.0.*.*;branch=z9hG4bK70e51baa
Call-ID: 1bc7c1612b40fc1d775a94776424bfc8@10.0.*.*:5060
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as002619f6
To: <sip:2251@10.0.*.23>
CSeq: 102 OPTIONS
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Accept: application/sdp, application/pidf+xml, application/xpidf+xml, message/sipfrag;version=2.0, application/im-iscomposing+xml, text/plain
Supported: 100rel, norefersub
Allow-Events: presence, refer
User-Agent: Sipek on PJSUA v1.0/win32
Content-Type: application/sdp
Content-Length: 445

v=0
o=- 3631603494 3631603494 IN IP4 10.0.*.23
s=pjmedia
c=IN IP4 10.0.*.23
t=0 0
m=audio 4000 RTP/AVP 103 102 104 117 3 0 8 9 101
a=rtcp:4001 IN IP4 10.0.*.23
a=rtpmap:103 speex/16000
a=rtpmap:102 speex/8000
a=rtpmap:104 speex/32000
a=rtpmap:117 iLBC/8000
a=fmtp:117 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (13 headers 19 lines) ---
Really destroying SIP dialog '1bc7c1612b40fc1d775a94776424bfc8@10.0.*.*:5060' Method: OPTIONS
Really destroying SIP dialog 'zDL.yzrvaK6RbJf4tBZ2onh.eIi1jLH2' Method: BYE

<--- SIP read from UDP:10.183.24.73:57910 --->

<------------->
Reliably Transmitting (no NAT) to 10.183.24.67:60628:
OPTIONS sip:1702@10.183.24.67:60628;ob SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK376264ab
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as28beccb4
To: <sip:1702@10.183.24.67:60628;ob>
Contact: <sip:asterisk@10.0.*.*:5060>
Call-ID: 38ee61ff676eaa3a55eae3d763f8d57e@10.0.*.*:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 11.5.1
Date: Fri, 30 Jan 2015 15:44:57 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0
asterisk-server-test*CLI> sip set debug off
SIP Debugging Disabled
[Jan 30 10:45:15] NOTICE[32638]: chan_sip.c:27699 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 1102
asterisk-server-test*CLI>

Asterisk Debug on Log WITHOUT DNS:

-- (13 headers 13 lines) ---
Really destroying SIP dialog '42d290a25f536cae4a1f07e34166ac78@10.0.*.*:5060' Method: OPTIONS
Reliably Transmitting (NAT) to 10.0.*.21:46983:
OPTIONS sip:2250@10.0.*.21:46983;ob SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK0d35e3b6;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as74ef6f90
To: <sip:2250@10.0.*.21:46983;ob>
Contact: <sip:asterisk@10.0.*.*:5060>
Call-ID: 11a09f5a147fb1ed3ac38263583e08b4@10.0.*.*:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 11.5.1
Date: Fri, 30 Jan 2015 16:00:20 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:10.0.*.21:46983 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.*.*:5060;rport=5060;received=10.0.*.*;branch=z9hG4bK0d35e3b6
Call-ID: 11a09f5a147fb1ed3ac38263583e08b4@10.0.*.*:5060
From: "asterisk" <sip:asterisk@10.0.*.*>;tag=as74ef6f90
To: <sip:2250@10.0.*.21;ob>;tag=z9hG4bK0d35e3b6
CSeq: 102 OPTIONS
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Accept: application/sdp, application/pidf+xml, application/xpidf+xml, application/simple-message-summary, message/sipfrag;version=2.0, application/im-iscomposing+xml, text/plain
Supported: replaces, 100rel, timer, norefersub
Allow-Events: presence, message-summary, refer
User-Agent: CSipSimple_hltecan-19/r2457
Content-Type: application/sdp
Content-Length: 284

v=0
o=- 3631622477 3631622477 IN IP4 192.168.1.56
s=pjmedia
t=0 0
m=audio 4000 RTP/AVP 99 0 8 101
c=IN IP4 192.168.1.56
a=sendrecv
a=rtpmap:99 SILK/24000
a=fmtp:99 useinbandfec=0
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
--- (13 headers 13 lines) ---
Really destroying SIP dialog '11a09f5a147fb1ed3ac38263583e08b4@10.0.*.*:5060' Method: OPTIONS

<--- SIP read from UDP:10.0.*.21:46983 --->
BYE sip:12251@10.0.*.*:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.56:46983;rport;branch=z9hG4bKPjTbmnHnCcHufGuQmpir1muB2gVq2iPXDN
Max-Forwards: 70
From: <sip:2250@10.0.*.*>;tag=Vk7cw3MDLvJIP791VzyGlZz8DD-vQC2z
To: <sip:12251@10.0.*.*>;tag=as503cf33c
Call-ID: ITCMP8tJoFJoM6LmDOuU0UsHTKo83pQL
CSeq: 25722 BYE
User-Agent: CSipSimple_hltecan-19/r2457
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Sending to 10.0.*.21:46983 (NAT)
Scheduling destruction of SIP dialog 'ITCMP8tJoFJoM6LmDOuU0UsHTKo83pQL' in 6400 ms (Method: BYE)

<--- Transmitting (NAT) to 10.0.*.21:46983 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.56:46983;branch=z9hG4bKPjTbmnHnCcHufGuQmpir1muB2gVq2iPXDN;received=10.0.*.21;rport=46983
From: <sip:2250@10.0.*.*>;tag=Vk7cw3MDLvJIP791VzyGlZz8DD-vQC2z
To: <sip:12251@10.0.*.*>;tag=as503cf33c
Call-ID: ITCMP8tJoFJoM6LmDOuU0UsHTKo83pQL
CSeq: 25722 BYE
Server: Asterisk PBX 11.5.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
set_destination: Parsing <sip:2251@10.0.*.23:5060> for address/port to send to
set_destination: set destination to 10.0.*.23:5060
Audio is at 15724
Adding codec 100003 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 10.0.*.23:5060:
INVITE sip:2251@10.0.*.23:5060 SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK5180543c
Max-Forwards: 70
From: <sip:12250@10.0.*.*>;tag=as556be22d
To: <sip:2251@10.0.*.23:5060>;tag=8a00e7db044741dfa676bea72903b0c5
Contact: <sip:12250@10.0.*.*:5060>
Call-ID: 61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060
CSeq: 106 INVITE
User-Agent: Asterisk PBX 11.5.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
X-asterisk-Info: SIP re-invite (External RTP bridge)
Content-Type: application/sdp
Content-Length: 233

v=0
o=root 1995170150 1995170154 IN IP4 10.0.*.*
s=Asterisk PBX 11.5.1
c=IN IP4 10.0.*.*
t=0 0
m=audio 15724 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
Scheduling destruction of SIP dialog '61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060' in 6400 ms (Method: INVITE)
  == Spawn extension (default, 12251, 5) exited non-zero on 'SIP/2250-00000002'

<--- SIP read from UDP:10.0.*.23:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.*.*:5060;received=10.0.*.*;branch=z9hG4bK5180543c
Call-ID: 61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060
From: <sip:12250@10.0.*.*>;tag=as556be22d
To: <sip:2251@10.0.*.23>;tag=8a00e7db044741dfa676bea72903b0c5
CSeq: 106 INVITE
Contact: <sip:2251@10.0.*.23:5060>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: 100rel, norefersub
Content-Type: application/sdp
Content-Length: 248

v=0
o=- 3631604421 3631604420 IN IP4 10.0.*.23
s=pjmedia
c=IN IP4 10.0.*.23
t=0 0
a=X-nat:0
m=audio 4002 RTP/AVP 0 101
a=rtcp:4003 IN IP4 10.0.*.23
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (11 headers 12 lines) ---
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - (gsm|ulaw|alaw|h263|testlaw), peer - audio=(ulaw)/video=(nothing)/text=(nothing), combined - (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 10.0.*.23:4002
Peer doesn't provide video
set_destination: Parsing <sip:2251@10.0.*.23:5060> for address/port to send to
set_destination: set destination to 10.0.*.23:5060
Transmitting (no NAT) to 10.0.*.23:5060:
ACK sip:2251@10.0.*.23:5060 SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK320dae37
Max-Forwards: 70
From: <sip:12250@10.0.*.*>;tag=as556be22d
To: <sip:2251@10.0.*.23:5060>;tag=8a00e7db044741dfa676bea72903b0c5
Contact: <sip:12250@10.0.*.*:5060>
Call-ID: 61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060
CSeq: 106 ACK
User-Agent: Asterisk PBX 11.5.1
Content-Length: 0


---
set_destination: Parsing <sip:2251@10.0.*.23:5060> for address/port to send to
set_destination: set destination to 10.0.*.23:5060
Reliably Transmitting (no NAT) to 10.0.*.23:5060:
BYE sip:2251@10.0.*.23:5060 SIP/2.0
Via: SIP/2.0/UDP 10.0.*.*:5060;branch=z9hG4bK79e7dd99
Max-Forwards: 70
From: <sip:12250@10.0.*.*>;tag=as556be22d
To: <sip:2251@10.0.*.23:5060>;tag=8a00e7db044741dfa676bea72903b0c5
Call-ID: 61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060
CSeq: 107 BYE
User-Agent: Asterisk PBX 11.5.1
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Scheduling destruction of SIP dialog '61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:10.0.*.23:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.*.*:5060;received=10.0.*.*;branch=z9hG4bK79e7dd99
Call-ID: 61ee2eba4b1d323a3ca003e0717c3df6@10.0.*.*:5060
From: <sip:12250@10.0.*.*>;tag=as556be22d
To: <sip:2251@10.0.*.23>;tag=8a00e7db044741dfa676bea72903b0c5
CSeq: 107 BYE
Content-Length: 0

The main difference seems to be the repetitions of SIP READ from other UDP peers when
we look at the differences before the call is correctly placed.

I was wondering what could be the problem.

Thanks

Because, with a broken DNS configured, Linux will take many seconds to conlude that it is not going to be able to reverse resolve an address, whereas with no DNS at all it will get resolver failure quickly.

It does the same problem even if the DNS is GOOD or BAD