Locating SIP Servers - Comments on the RFC3263 for SIPS URIs

Search for a command to run...

No comments yet. Be the first to comment.
Managing the cost of your cloud infrastructure can be a complex and daunting task, especially as your organization grows and the number of resources increases. One way to handle this challenge is to use a tool like Infracost, which allows you to see ...

There are times when you have to integrate into a proprietary or legacy system, most of the time, using an API to implement the integration. Testing such integration with a proprietary or legacy system can be complex, if possible at all, since most o...

H2 database is a powerful Java SQL database that is very fast, implements JDBC API, provides an html console, and has a very small footprint, around 2MB. Because of its size and the SQL compatibility that the H2 database provides, it can be used as a...

This is the next article in the JTapi hands-on series that will present the Call and Connection interfaces from the Jtapi API. Using the Call and Connection interface, this article shows how to create and disconnect calls, and also inspect Connection...

RFC3263 describes the DNS procedure and guidelines to be followed in order to locate SIP Servers.
From the abstract of RFC3263:
The document here describes those DNS procedures in detail.
When it comes to implement the proposed guidelines from RFC3263 in order to locate SIP server, the specification doesn’t seem to cover enough all the possible situations, specially for SIPS URI, and that is why we should consider to change some points there.
The purpose of this post is, first to indicate which points of the proposed RFC3263 mechanisms could create problems when it comes to resolve the transport for SIPS URIs and how these points should be changed by applying some rules on the results of the DNS query. Second this post provides what is the minimum DNS configuration for SIP, that is the minimum required NAPTR, SRV and A records according to the RFC3263.
The proposed mechanism from the specification for the transport resolution, suggest to have NAPTR query first and if this doesn’t return any results to issue a SRV query. At this point the the specification fails to provide clear directions on how to choose the transport when the URI under question is a SIPS URI.
We should consider to change the way the transport resolution mechanism have to be done keeping in mind the RFC5630 “The Use of the SIPS URI Scheme in the Session Initiation Protocol (SIP)” guidelines.
So as said before RFC3263 states that if the NATPR query returns no records, an SRV query should be performed and if that query returns any results that contains transports that the client can support, then the client can choose any of the results:
The “..use any transport protocol it desires which is supported by the server.” creates a confusion and problems when it comes to SIPS URIs. The SRV query results should be examined and some rules should be applied before we choose the transport.
Another point of conflict coming from RFC3263 for the transport resolution, is in the case where port is available in the URI. The specification states :
This should be “TLS for a SIPS URI”
RFC5630 purpose is to clarify the use of SIPS URI.
RFC5630 [3.1.3 – Using TLS with SIP Instead of SIPS] defines two uses of TLS, one with SIPS URI, and one with SIP URI. As it states SIPS URI should be treated as “TLS-only” requests, while using TLS with SIP URI should be treated as “best-effort TLS”.Taken from there, we should further enhance RFC3263 guidelines by taking into account RFC5630.SRV records of a DNS server should be clear of what they want to provide.
So if one would like to use the “best-effort TLS” approach this DNS SRV record should be included:
And if the client supports TLS, then TLS should be the chosen transport.
If the SIP server should follow the “TLS only” approach, then one of the following SRV records should be included (or both to support all possible queries) :
OR
And the client will have to go with the TLS transport.
Of course, a server could provide both and so to give the ability to the client even if using SIP URI to go with a TLS transport if available.
When it comes to the NAPTR lookup, RFC3263 proposed mechanism to resolve transport is sufficient and the guidelines for SIP and SIPS URIs are clear enough:
If the NAPTR lookup returns no results, a DNS SRV query should be done.
Here we need to clarify and change how the DNS results should be treated for a given request when transport is to be discovered, given the fact that the client supports TCP, UDP and TLS.
The statement from RFC5623 that the client should “use any transport protocol it desires which is supported by the server” is not enough to make a clear decision for the transport and further process of the result should be done using some rules.
For example, a SIP Registrar may provide the following SRV record for SIPS URI:
If the client is to pick the TCP transport as is, then this will fail because the TCP connector wont be able to establish a connection with the TLS connector on the other side. In this example, the client should treat _sips._tcp result as “TLS only” and choose TLS as transport.
Since the DNS SRV records defined for a SIP server may vary from one application to the other, the client should collect all the results of a DNS SRV lookup, and then apply the following rules:
Of course if an SRV lookup doesn’t returns any result, the regular approach should be followed, that is to pick the default transport for the given URI.
Should there be a preference between TCP and UDP?
According to RFC3263 4.1, the minimum required NAPTR records a SIP proxy, redirect server, or registrar should have, if it comes to be resolved through a DNS lookup, are the following:
From RFC3263:
Of course Domain, TTL, Priority, Preference, Port and FQDN of the the record should be set according to the application/needs.
Accordingly, the minimum DNS SRV records that should be defined are:
So in the above example for SIP URIs and UDP or TCP transport, the request will be routed using port 5060 to the sipserver1.example.com. For secure SIPS URIs, the 5061 port should be used and the same server.
Of course Domain, TTL, Priority, Weight, Port and FQDN of the the record should be set according to the application/needs.
Finally the DNS zone configuration should contain an A record for the domain:
That will be used to resolve the FQDN of servers to an IP Address.
Here is an example of a complete DNS Zone configuration for the example.com domain.
$TTL 1800
@ IN SOA ns1.example.com. root.example.com. (
2012030101 ; serial# 1800 ; refresh, seconds 1800 ; retry, seconds 1800 ; expire, seconds 1800 ) ; minimum TTL, seconds;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; DNS Servers for ‘example.com’
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NS record for example.com
; server: sipserver1.example.com
;
example.com. IN NS sipserver1.example.com.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Call Routing for SIP domain ‘example.com’
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NAPTR record for SIPS TCP example.com
; priority: 2 weight: 0
; protocol: “SIPS+D2T” regex: “” uri: _sips._tcp.example.com
;
example.com. IN NAPTR 2 0 “s” “SIPS+D2T” “” _sips._tcp.example.com.
; NAPTR record for SIP TCP example.com
; priority: 2 weight: 0
; protocol: “SIP+D2T” regex: “” uri: _sip._tcp.example.com
;
example.com. IN NAPTR 2 0 “s” “SIP+D2T” “” _sip._tcp.example.com.
; NAPTR record for SIP UDP example.com
; priority: 2 weight: 0
; protocol: “SIP+D2U” regex: “” uri: _sip._udp.example.com
;
example.com. IN NAPTR 2 0 “s” “SIP+D2U” “” _sip._udp.example.com.
; SRV record for domain SIP TCP example.com
; priority: 1 weight: 0 port: 5060 server: sipserver1.example.com
;
_sip._tcp.example.com. IN SRV 1 0 5060 sipserver1.example.com.
; SRV record for domain SIP UDP example.com
; priority: 1 weight: 0 port: 5060 server: sipserver1.example.com
;
_sip._udp.example.com. IN SRV 1 0 5060 sipserver1.example.com.
; SRV record for domain SIP TLS example.com
; priority: 1 weight: 0 port: 5061 server: sipserver1.example.com
;
_sip._tls.example.com. IN SRV 1 0 5061 sipserver1.example.com.
; SRV record for domain SIPS TCP example.com
; priority: 1 weight: 0 port: 5061 server: sipserver1.example.com
;
_sips._tcp.example.com. IN SRV 1 0 5061 sipserver1.example.com.
; SRV record for domain SIPS TLS example.com
; priority: 1 weight: 0 port: 5061 server: sipserver1.example.com
;
_sips._tls.example.com. IN SRV 1 0 5061 sipserver1.example.com.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; IP Addresses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; A record for sipserver1.example.com
;
sipserver1.example.com. IN A 192.168.1.207
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In order to test A records, a simple ping would be enough. If the command ping sipserver1.example.com would result some replies, then A record configuration is okTo test SRV records, for Linux use dig command and for Windows use nslookup.
Also, in order to check NAPTR records again use Linux dig.
For Windows i am not aware of a program that could be used to check NAPTR records, as nslookup doesn’t support this type of records (tested on Windows XP and Windows 7)
Linux example: dig example.com NAPTR will result with the available NAPTR records on the DNS server