Priorities in SRV Record
- Last updated on March 7, 2023 at 4:02 PM
SkySwitch uses the SRV DNS resource record type to allow UAC devices to locate our services and to provide them the resources records to use in the event a failover is needed between primary and secondary nodes. This type of resource record is defined in the RFC 2782.
In the case of Reseller(ResellerID), their SRV record for SIP would look like this.
_sip._udp.ResellerID.hpbx.outboundproxy.com
When a UAC device uses this record to find out what primary and secondary nodes are available for registration it will perform an SRV lookup. On a command shell an SRV lookup would look like this:
nslookup -type=SRV _sip._udp.ResellerID.hpbx.outboundproxy.com
This will return two records below. For example, as below:
As an example, it will return the two records as follows:
;; ANSWER SECTION: SRV 20 10 5060 g1-wt01.nms.outboundproxy.com. SRV 30 10 5060 g1-ne02.nms.outboundproxy.com.
Definition for each value in the records returned are:
The SRV in the first column is a reference to this result being part of an SRV record.
The number in the second column is a reference to the priority of the result (More on this below).
The number in the third column is a reference to the weight of the result (This is not used in our case).
The number in the fourth column is the port number for the particular service being requested.
The fifth column is the FQDN that the UAC can use to do a DNS lookup for either an A type or CNAME type resource record.
What is the importance of the priority value?
The lower the priority number is, the more preferable the result will be. In this case, the UAC performs an SRV lookup and will register first to the g1-wt01.nms.outboundproxy.com node as it has a lower priority value. It can keep the g1-ne02.nms.outboundproxy.com result in case the first node were to stop responding and a failover event is needed.
In the event of a failover, the UAC should at some point attempt to contact the primary node again. From RFC 2782 “A client MUST attempt to contact the target host with the lowest-numbered priority it can reach;”
Since the TTL value of the SRV record and its results is 60 seconds, a new SRV query should be performed by the UAC every 60 seconds and at that time it will attempt to first register to the result with the lowest priority. This insures that once the primary node is now available the UAC will use the associated FQDN for registration.