DNS Query using SRV Record

 

 

The IMG 2020 supports utilizing an A-Record, SRV or Service Record, or both to specify which sip server to route a call to. The determination of which record to use is configured in the DNS Servers object. DNS Queries on SRV records will be described below. SRV Records are defined in RFC 2782 and identifies the server(s) that will support a particular service. In this case the IMG 2020 will be looking for the best way to route a call to a server which employs the sip service. A Channel Group can be configured so that a query is sent to a DNS server and the DNS response would be an SRV record including all the sip servers that match the initial DNS service request. From the SRV Record the IMG 2020 will handle load balancing from the priority/weight of each server using Random number method. The final result will be that the IMG 2020 will send the outbound INVITE message to the server with highest priority/weight and attempt to connect to that SIP server. If however after a few Re-INVITES the initial SIP Server cannot be reached, an outbound INVITE will be sent to the SIP server with the next highest priority/weight. This will continue until all responses in the DNS query have been exhausted and the call will fail. Up to five DNS responses in each SRV Record are supported.

The flexibility of the SRV record is not to have to assign a specific IP address to the INVITE and be able to route calls to different gateways by simply editing the DNS database. Other benefits would include flexibility on port numbers and priority.

Diagram with example

Below is diagram and explanation of how the IMG 2020 would route a call if an SRV record was being utilized. Follow diagram below.

 

  • A Call comes into Channel Group SIP_CallerA. Through the use of routing tables and translation tables the call is then routed to Channel Group SIP_SRV_RR.

  • Internal to the IMG 2020, the call is sent to Channel Group SIP_SRV_RR. Channel Group SIP_SRV_RR is configured with an external IP Network Element as described in the configuration below. That External IP Network Element (Gateway) has a Gateway Host Name in the following format:

 _<service>._<transport type>.domain name = _sip._udp.jsmith.dialogic.com (See Ext. Gateway capture above.)  

  • Once the IMG 2020 sees the Gateway Host Name in this format it knows to send the Gateway Host Name to a DNS Server which handles SRV resource records. In this example _sip._udp.jsmith.dialogic.com was sent to DNS server.

  • The DNS server looks into its Database for all the A-Records associated with this Gateway Hostname and sends them down to the IMG 2020 in an SRV Record format. Below are all the records that were found in this example: 

Answers:

_sip._udp.jsmith.dialogic.com: type SRV, class IN, priority 10, weight 5, port 5060, target jsmith.dialogic.com

_sip._udp.jsmith1.dialogic.com: type SRV, class IN, priority 5, weight 250, port 5060, target jsmith1.dialogic.com

Additional Records:

jsmith1.dialogic.com: type A class IN, addr 10.10.10.10

jsmith.dialogic.com: type A class IN, addr 10.10.10.11

  • Once the IMG 2020 gets the SRV record in the DNS response the weights and priorities are assessed. The IMG 2020 will select the A-Record within the SRV Record that satisfies the Priority/Weight/Random Number Method and return the hostname (target) with the highest priority. (Highest Priority meaning a priority of 1 is higher than a priority of 10, a priority of 500 is higher than a priority of 1000). See information below on how the priority/weight/random number is assessed.

If priorities of the two responses are equal then the weight parameter will be assessed. The IMG 2020 will use load balancing method to determine which result to use.

  • From the example above, after calculating the Priorities/Weights/Random Number method, the target host jsmith1.dialogic.com has a higher priority than jsmith.dialogic.com. In this instance, the call will first be sent to jsmith1.dialogic.com. If for some reason jsmith1.dialogic.com cannot be reached the IMG 2020 will then try and connect with SIP server that had the second highest priority. This will continue until all SIP Server entries in the DNS SRV Record have been exhausted.

  • Along with the hostnames jsmith.dialogic.com and jsmith1.dialogic.com the DNS server also sends any IP addresses configured as displayed above. This is done in the case where the hostname is not configured on the far end gateway.

  • The call is then routed to the gateway as shown in diagram above.

Configuration

The procedure below explains how to configure the IMG 2020 to query a DNS server using an SRV Record. Before configuring, the IMG 2020 must have an initial configuration created on it. Follow the Basic Configurations procedure before proceeding. Once all initial steps such as spans, interfaces, translations, internal routing, and IP Profiles, the IMG 2020 can be configured to accept SRV records. Follow steps below:

Create SIP Profile (SGP)

  • Right click on the Profiles object and select New SIP Profiles. The SIP Profiles object is a parent or container object. No configuration is needed here. Refer to the SIP Profiles topic for more information on this object.

  • Right click on the SIP Profiles object and select New SIP Profile. The first profile that gets created is a Default SIP Profile and cannot be modified. Disregard this profile.

  • Right click on the SIP Profiles object and select New SIP Profile again. In the SIP Profile object that appears, either enter a name that identifies this SIP Profile or accept the default name already entered. In this example the SIP Profile was labeled DNS_SRV_Profile.

Configure External Gateways

  • Right click on the Dialogic object and select New External Network Elements. The External Network Elements object is a parent or container object and no configuration is needed here. Refer to External Network Elements topic for more information.

  • Right click on External Network Elements and select New External Gateways. The External Gateways object is a parent or container object also and no configuration is needed here. Refer to External Gateways for more information.

  • Right click on External Gateways and select New External Gateway. Enter a name that identifies the gateway being configured. In this example the gateway was labeled DNS_SRV_GW.

 

  • Select SIP as the Protocol.

  • Select Host Name from drop down menu in the Address Type field.

  • Enter the IP Address of the gateway that the IMG 2020 will be communicating with.

  • Leave the IP Mask field as 255.255.255.255* In the Host Name field, enter the external gateway name as a service identifier with the (_) in the prefix. See example below. By entering the Gateway Host Name in the format below, it will trigger the IMG 2020 to send the query to the DNS server.

SRV Record = _<service>._<protocol>.<domainname>

  • Select from the SIP Profile field drop down menu the SIP Profile created above.


For more information on this object, refer to the External Gateway topic.

  • Configure multiple gateways using the _sip._udp.jsmith.dialogic.com format in the Gateway Hostname field. For example: The 1st Gateway Host Name is _sip._udp.jsmith.dialogic.com the second gateway could be _sip._udp.jsmith1.dialogic.com and third gateway could be _sip._udp.jsmith2.dialogic.com and so on.

Configure SIP Signaling

The configuration above displays how to configure the SIP Profile and External SIP Gateway so that the Delayed Media feature is configured. The next step is to configure the SIP signaling stack and SIP Channel Groups. Refer to the Configure SIP (Single SIP IP) topic for a procedure on how to configure the SIP functionality.

Using the Configure SIP procedure, multiple channel groups can be created as required. As long as the Gateway Host Name field in the External Gateway of the IP Network Element selected is of the format _<service>._<protocol>.<Domainname> this channel group will initiate a DNS lookup with that format.

Load Balancing

The IMG 2020 supports Load Balancing responses from a DNS request. The load balancing is built into the IMG 2020 and does not need to be configured. The load balancing technique uses a priority/weight/Random Number technique which follows RFC 2782. Below explains the load balancing technique.

  • The IMG 2020 receives a call with the hostname _sip._udp_jsmith.dialogic.com. This triggers the IMG 2020 to initiate a DNS request to a DNS Server. The DNS server returns a response to the request. The response is displayed below as an unsorted list

Unsorted List

SRV Record

Hostname

Port

Priority

Weight

jsmith1

5100

10

25

jsmith2

5300

10

50

jsmith6

5600

100

50

jsmith3

5200

10

25

jsmith5

5500

100

50

 

  •  The IMG 2020 accepts the list and does an initial sort which is done by priority. See table below

Hostname

Port

Priority

Weight

jsmith1

5100

10

25

jsmith2

5300

10

50

jsmith3

5600

10

25

jsmith5

5200

100

50

jsmith6

5500

100

50

  • For entries with same priority, create a separate list with weight 0 first in this list.

Hostname

Port

Priority

Weight

jsmith1

5100

10

25

jsmith2

5300

10

50

jsmith3

5600

10

25

  • The weights are added with the previous weight sum. The first weight does not have a previous record so weight for previous record is 0.Number Range|

Hostname:

Port:

Priority

Weight

Sum 
(Weight + Prior weight sum)

Random Number Range

jsmith1

5100

10

25

25 + 0 = 25

0 - 25

jsmith2

5300

10

50

25 + 50 = 75

26 - 75

jsmith3

5600

10

25

75 + 25 = 100

76 - 100

  • At this point a random number is generated. In this example 45 was selected as the random number. Based on the Random Number Range from the previous table, jsmith2 would be the first SIP server selected. From here, if first SIP server is not reachable, another random number is generated and that would set the priority of the second SIP server. This would continue until all servers have been selected/exhausted.

Additional Information

  • If an underscore (_) is in the prefix of the Gateway Host Name, the application will associate the hostname with a service instead of an address and a DNS query will be sent.

  • SRV record lookups are now available on a 302 Redirect Record Route.

  • DNS requests are now configurable from the DNS Servers pane. Below are rules to each selection from drop down menu.  

When A-Record is selected in DNS Servers pane, all DNS requests for that server will be A-Queries

When SRV type is selected in DNS Servers pane, all DNS requests for that server will be SRV-Queries

When Mixed Type is selected in DNS Servers Pane, DNS queries are based on hostname value. SRV Records are sent when hostname format begins with underscore (_). A-Record query is used otherwise.

  • When receiving multiple responses in the SRV records in the DNS response, the weight and priority fields are accessed for each SRV record. From here the Random Number Method is used to select the priority of which SIP server to send call to first.

  • The IMG 2020 will store a maximum of 5 SRV record results per query.

  • The port number received in the SRV record will be provided to sip server. The SRV record will override any port numbers configured on each gateway.

  • The SRV target is to be used during SIP PDU encoding (Protocol Data Unit Logging), not the service name.

  • SIP is to handle a failure to resolve a service query in the same way as an existing query. A 480 response will be returned to the initiating gateway

  • CDR's are not affected by this feature. The resolved hostname will be used in the CDR record.

  • If an outbound proxy is enabled for an external gateway that uses a Service Name, the SRV query is resolved prior to determining the proxy parameters during a call. A SRV query will execute only on an external gateway and will not be executed on an outbound proxy hostname.

  • If user wants to assign an SRV record name to another IMG 2020 the user must create an external gateway equivalent to the IMG 2020 and select it from drop down list in the external network element object created under the SIP channel group.  

Return to Documentation Home I Return to Sangoma Support