dnssipsrv

performs a NAPTR query


This may look like a very simple question, but I haven't found the answer on the Internet.

Anyone can give me clues how to performs a NAPTR query for a SIP domain? (this is mostly for DNS lookup), or any references also great for me (This one exist on rfc2915).

Maybe using terminal or any tools maybe and further i'd like to do it using java so if any piece of code will very helpful.


Solution

  • The RFC you are looking for is "Session Initiation Protocol (SIP): Locating SIP Servers".

    Here's an abbreviated summary of how to select the transport protocol and resolve the SIP server address.

    1. If transport parameter is specified it takes precedence,
    2. If no transport parameter and target is an IP address then sip should use udp and sips tcp,
    3. If no transport parameter and target is a host name with an explicit port then sip should use udp and sips tcp and host should be resolved using an A or AAAA record DNS lookup (section 4.2),
    4. If no transport protocol and no explicit port and target is a host name then the client should do an NAPTR lookup and utilise records for services SIP+D2U, SIP+D2T, SIP+D2S, SIPS+D2T and SIPS+D2S,
    5. If NAPTR record(s) are found select the desired transport and lookup the SRV record,
    6. If no NAPTR records are found lookup SRV record for desired protocol _sip._udp, _sip._tcp, _sips._tcp, _sip._tls,
    7. If no SRV records found lookup A or AAAA record.

    In the real World virtually no SIP providers use NAPTR records, probably half or less use SRV records and the rest rely solely on A records. In my own SIP software I turned off the NAPTR lookup since it just wasted time and it's highly likely that if a SIP provider has bothered to set up NAPTR records they are also going to have set up the standard SRV records.

    In hindsight the SIP protocol designers should probably have left the whole SIP server address resolution alone and let implementers use standard IP load balancing and failover mechanisms. Because SIP clients don't all support SRV records, again in my experience less than half, using such records is better than nothing but is not a great solution for failover or load balancing.

    If you are looking for a hostname with SIP NAPTR records try columbia.edu and snom.com last time I checked they both had some.