[Home]

Summary:ASTERISK-15688: dnsmgr failes to match peer when SIP srvlookup is on
Reporter:Maciej Krajewski (jamicque)Labels:
Date Opened:2010-02-24 12:08:08.000-0600Date Closed:2010-03-15 10:53:41
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Netsock
Versions:Frequency of
Occurrence
Related
Issues:
is related toASTERISK-21752 Asterisk peers with host= do not accept calls from all hosts in dnsname's multiple host SRV record set
Environment:Attachments:
Description:Dnsmgr failes to match peer when SIP srvlookup is on. Asterisk tries to find a peer but it failes.

[Feb 24 19:03:05] WARNING[10845]: res_config_pgsql.c:540 realtime_multi_pgsql: PostgreSQL RealTime: Could not find any rows in table sip_ps.
[Feb 24 19:03:05] WARNING[10845]: res_config_pgsql.c:540 realtime_multi_pgsql: PostgreSQL RealTime: Could not find any rows in table sip_ps.
[Feb 24 19:03:05] NOTICE[10845]: chan_sip.c:19044 handle_request_invite: Sending fake auth rejection for device "+48607382193" <sip:607382193@sbc.freeconet.pl>;tag=as108407ed

when i type in console:
dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.freeconet.pl'
      > ast_get_srv: SRV lookup for '_sip._UDP.sip.freeconet.pl' mapped to host server1.freeconet.pl, port 5060
[Feb 24 19:05:14] NOTICE[11952]: dnsmgr.c:181 dnsmgr_refresh: dnssrv: host 'sip.freeconet.pl' changed from 213.218.116.66:5060 to 213.218.116.65:5060

however after I make a call:
dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.freeconet.pl'
[Feb 24 19:06:21] NOTICE[11952]: dnsmgr.c:181 dnsmgr_refresh: dnssrv: host 'sip.freeconet.pl' changed from 213.218.116.65:5060 to 213.218.116.66:5060
   -- refreshing 'sip.freeconet.pl'
      > ast_get_srv: SRV lookup for '_sip._UDP.sip.freeconet.pl' mapped to host server1.freeconet.pl, port 5060

and incoming calls from peer are matched properly. It only happens on every restart of asterisk till no outbound call is done. When i turn of srvlookup everything works fine.
Comments:By: Elazar Broad (ebroad) 2010-02-24 20:05:21.000-0600

Something is definitely wrong here:

---
Non-authoritative answer:
Name:    server1.freeconet.pl
Address:  213.218.116.65

Non-authoritative answer:
Name:    server2.freeconet.pl
Address:  213.218.116.66
---

Unless the provider swapped A records at some point today, we are caching the wrong address for server1.

By: Maciej Krajewski (jamicque) 2010-02-25 02:15:53.000-0600

What is wrong??
The operator uses SRV and both adresses are connected to sip.freeconet.pl
This is what SRV is all about isn't it?



By: Elazar Broad (ebroad) 2010-02-25 09:42:10.000-0600

Something is wrong = something is wrong with the way Asterisk is handling SRV records.

SRV lookups return a host(A record) responsible for a given service on a given domain. If you look at the last line of your debug, Asterisk states that _sip._UDP.sip.freeconet.pl is mapped to server1 with an address of 213.218.116.66, that is incorrect, an nslookup puts server1 at 213.218.116.65.

By: Maciej Krajewski (jamicque) 2010-02-25 09:44:05.000-0600

ok should I upload more logs?

By: Leif Madsen (lmadsen) 2010-02-25 13:07:18.000-0600

Doesn't Asterisk only return the first record in the lookup? Perhaps that is causing the mismatch? Maybe you need to specify multiple [peers] in sip.conf for all the IP addresses?

(I'm just guessing, which I suppose is bad and useless.)

By: Leif Madsen (lmadsen) 2010-02-25 13:07:53.000-0600

I think logs of the working and non-working SIP traces may be useful here, along with the relative parts of sip.conf.

By: Maciej Krajewski (jamicque) 2010-02-26 02:51:49.000-0600

If i manually configure multiple peers for trunk in sip.conf it works fine. However this is not the point why operator uses SRV's (otherwise I could define multiple peers and make specific dialplan to have operational reliability). IP of operator sip trunk may change, new nodes can be added to SRV. That's why we use domain names not ip addresses, and that's why dns_mgr is helpful here to resolve the ip addresses from domain names.
What I have found is that when I turn off srvlookup in sip.conf (SRV functionality is then off) anr restart asterisk I have one statement in dns manager:

dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.freeconet.pl'

And every thing works fine. All inbound and outbound calls are identified properly. However when I trun srvlookup on again and restart asterisk.

dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.freeconet.pl'
      > ast_get_srv: SRV lookup for '_sip._UDP.sip.freeconet.pl' mapped to host server1.freeconet.pl, port 5060

there is this strange statement in the last line. From now on no inbound call's from peer are identified properly (asterisk can't match the peer). However if I make any outbound call through peer new statement is added to dns manager and peer for inbound calls are matched properly to peer.

dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.freeconet.pl'
   -- refreshing 'sip.freeconet.pl'
      > ast_get_srv: SRV lookup for '_sip._UDP.sip.freeconet.pl' mapped to host server1.freeconet.pl, port 5060

please notice that there are 2 statements for sip.freeconet.pl. In my opinion there is something wrong with dns_mgr when resolving peer during first registration.

In my peer configuration I use only domain names "sip.freeconet.pl" no IP addresses.

By: Maciej Krajewski (jamicque) 2010-03-04 03:06:40.000-0600

Is this sufficient?

By: Leif Madsen (lmadsen) 2010-03-08 13:35:31.000-0600

I suppose this is enough for now.

By: Leif Madsen (lmadsen) 2010-03-08 13:37:27.000-0600

Actually, according to Russell this is expected behaviour.

By: Leif Madsen (lmadsen) 2010-03-08 13:38:21.000-0600

I'm assigning this to Russell for feedback about how to proceed.

By: Maciej Krajewski (jamicque) 2010-03-08 14:04:17.000-0600

imho it's a bug. Enabling srvlooups and making a configuration of peers only on domain names with enabled dns_manager should give you reliability (if peers have SRV's). Now what you can do is to disable srvlookups and pray that if any failure/congestion will happen dns_nmanager will resolve the domain name on IP of a working peer. Or enable srv_lookup but than dns_manager is worthless coz you have to configure as many peers (defining their IP addresses), as many IP addressees are under the domain name to successfully support incoming calls.

By: Russell Bryant (russell) 2010-03-15 10:53:41

This is expected behavior.  You have correctly identified that Asterisk's SRV support is extremely minimal.  You have also correctly identified the configuration required to be able to support incoming calls and work around the problem you have encountered.

Improvements to Asterisk's SRV support in patch form are welcome.  :-)