DNS resolution in Softphone.Pro

Softphone.Pro is a SIP client which connects to a PBX to make and receive calls. PBX is accessible via a local network and/or the Internet with a unique IP address. To connect, the SIP client (e.g., Softphone.Pro) must specify the PBX's IP address. It must also choose a transport protocol (UDP/TCP/TLS) and specify the port for sending requests.

End users do not need to know the PBX's numeric IP address. Instead, they enter a domain name (hostname) in the SIP account settings. Softphone.Pro converts this domain name into the PBX's IP address using the DNS system.

DNS (Domain Name System) translates human-readable names (domains) into numeric IP addresses. Programs and equipment use these addresses to communicate (e.g., to make calls over the Internet).

This article describes how Softphone.Pro uses DNS to convert a PBX domain address into an IP address. It also explains how to configure DNS in Softphone.Pro.

How DNS works

A detailed description of DNS operation is provided in RFC 1035.

In SIP telephony, DNS can be thought of as a directory. It maps the PBX's alphabetic address (e.g., sip.example.com) to its IP address (e.g., 198.51.100.10). The SIP client uses this IP address to send a registration request or make an outgoing call.

DNS servers are divided into two types:

  • Public: the most common option. They are available on the Internet with records are accessible to all Internet users. A distributed structure ensures server availability and quick IP address resolution from a domain name.
  • Private: placed on a local network, for example, in large companies. Access to records is restricted to the local network. They allow for redundancy and load balancing (e.g., by specifying primary and backup addresses for a local PBX).

DNS uses various record types. Softphone.Pro uses the following records to determine an IP address:

  • A - described in RFC 1035. Links a domain name (hostname) to an IPv4 address like 198.51.100.10.
    Example record:
    pbx.example.com.		60	IN	A	198.51.100.20
  • AAAA - described in RFC 3596. Similar to A record. Links a domain name (hostname) to an IPv6 address like 2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF.
    Example record:
    pbx.example.com.		60	IN	AAAA	2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF
  • SRV - described in RFC 2782. A special record format. It allows specifying multiple servers for a protocol. Combined with A/AAAA records, it enables a mechanism for failover and address switching (e.g., to specify a primary and backup PBX address).
    Example SRV record:
    _sip._udp.pbx.example.com.    86400 IN SRV 10 10 5060 pbx01.example.com.

The next section describes in detail how Softphone.Pro retrieves records from DNS servers and uses them to obtain the PBX's IP address.

How Softphone.Pro gets the PBX IP address from DNS

All IPs are provided as examples.

Softphone.Pro works with DNS servers to obtain the PBX IP address according to RFC 3263.

Softphone.Pro uses the following SIP account parameters to connect to the PBX:

  • Server - the address of the PBX SIP server. It can be specified as:
    • IP address (e.g., 192.168.0.100 or 192.168.0.100:5160);
    • domain name with a port (e.g., pbx.example.com:5160);
    • domain name without a port (e.g., pbx.example.com);
  • Transport - the transport protocol for connecting to the PBX.
    Possible values: Auto, UDP, TCP, TLS.
    If Auto is selected, Softphone.Pro tries to connect via UDP first. If that fails, it tries TCP.
  • Port - the port used for connection. It can be included in the Server field after the : symbol, e.g., sip.example.com:5160.
    If not specified, default values are used: 5060 (for Auto/TCP/UDP Transport) or 5061 (for TLS Transport).

Depending on these parameters, one of three possible scenarios is executed.

Server specified as an IP Address

Softphone.Pro workflow in this scenario:

Workflow with IP in Server settings

1. The request is sent to the PBX at the specified IP address. It uses the Transport selected in the settings. If no Port is specified in the Server address, default values are used: 5060 (for Auto/TCP/UDP Transport) or 5061 (for TLS Transport).

2. The PBX sends a response to the received request.

Example 1

The SIP account settings have Server set to 192.168.0.100 and Transport set to TLS. Softphone.Pro connects to the PBX with these parameters:

  • Server: 192.168.0.100 (from SIP account settings);
  • Transport: TLS (from SIP account settings);
  • Port: 5061 (default value for TLS transport);

Example 2

The SIP account settings have Server set to 192.168.0.100:5160 and Transport set to UDP. Softphone.Pro connects to the PBX with these parameters:

  • Server: 192.168.0.100 (from SIP account settings);
  • Transport: UDP (from SIP account settings);
  • Port: 5160 (from SIP account settings).

Server specified as a Domain Name with a Port

Softphone.Pro workflow in this scenario:

Workflow with domain and port in Server settings

If Server is set as a domain name and a Port is specified:

1. Softphone.Pro sends a query to the DNS server for A (IPv4) or AAAA (IPv6) records for the given domain name.

2. The DNS server responds with IP addresses corresponding to the requested domain name.

3. Softphone.Pro stores the received IP addresses (one or more). It sends requests to the first address obtained, using the specified port and transport.

4. The PBX sends a response to the received request.

Example

The SIP account settings have Server set to pbx.example.com:5160 and Transport set to Auto. Softphone.Pro sends an A/AAAA record query to the DNS server for the domain pbx.example.com. It receives the following records in response:

pbx.example.com.		60	IN	A	198.51.100.20
pbx.example.com.		60	IN	A	203.0.113.30

Softphone.Pro stores the received addresses and tries to connect to the PBX with these parameters:

  • Server: 198.51.100.20 (obtained from the DNS A record);
  • Transport: UDP (automatically selected by the application);
  • Port: 5160 (from SIP account settings).

Server specified as a Domain Name without a Port

Softphone.Pro workflow in this scenario:

Workflow with domain without a port in Server settings

If Server is set as a domain name and Port is not specified:

1. Softphone.Pro sends a query to the DNS server for SRV records for the given domain name and transport.

2. The DNS server returns a response:

2.1 If SRV records for the specified domain and transport exist, they are returned in the query result.

2.2 If no SRV records exist for the specified domain name and transport, an error is returned.

3. Softphone.Pro sends a query to the DNS server for IP addresses:

3.1 If SRV records were obtained in step 2, Softphone.Pro requests A/AAAA records for all domain names listed in the SRV record.

3.2 If no SRV records were found, Softphone.Pro requests an A/AAAA record for the domain specified in the SIP account settings.

4. The DNS server responds with one or more IP addresses for the requested domains.

5. Softphone.Pro stores the received IP addresses (one or more). It sends a request to the first address obtained, using the specified port and transport.

6. The PBX sends a response to the received request.

Example of working with SRV records in DNS

The SIP account settings have Server set to pbx.example.com and Transport set to TCP.

Softphone.Pro queries the DNS server for an SRV record for the tcp protocol. The query is _sip.tcp.pbx.example.com.. It receives the following records in response:

_sip._tcp.pbx.example.com.	60	IN	SRV	1	0	5060	pbx1.example.com.	
_sip._tcp.stun.example.com.	60	IN	SRV	1	0	5060	pbx2.example.com.

Softphone.Pro stores port 5060 (the 7th column of the record). It then queries for A/AAAA records for each domain in the DNS server's response. The query results:

For pbx1.example.com. an A record was received:

pbx1.example.com.		60	IN	A	198.51.100.20

For pbx2.example.com. an A record was received:

pbx2.example.com.		60	IN	A	203.0.113.30

Softphone.Pro builds a list of addresses using the algorithm from RFC 2782. It then sends a request to the PBX with these parameters:

  • Server: 198.51.100.20 (obtained from the A record from the DNS server);
  • Transport: TCP (specified in the SIP account settings);
  • Port: 5060 (obtained from the SRV record from the DNS server).

Configuring DNS Servers in Softphone.Pro

By default, Softphone.Pro uses the DNS servers configured in the OS. If your PBX is on a local network, has no Internet access, and is only accessible via a local address, its address record is only available on a local DNS server. Use the settings described in this section to specify the required DNS server address in Softphone.Pro settings.

Configuring DNS servers in Softphone.Pro

1. Close Softphone.Pro.

2. Open the SoftphonePro.ini application configuration file in a text editor.

3. Find the DnsServers parameter in the [AppSettings] section. Specify the DNS server address that Softphone.Pro will use. To specify multiple servers, separate them with spaces.

For example:

[AppSettings]
...
DnsServers=192.168.0.1 192.168.0.2

4. Save the changes to the file. Start Softphone.Pro and verify that the application works with the specified DNS servers.

Configuring DNS servers in Softphone.Pro Team

1. Close Softphone.Pro on the Agent's computer.

2. Use the Team softphone provisioning feature and add the following lines to the Agent's configuration file:

[AppSettings]
DnsServers=192.168.0.1 192.168.0.2

To specify multiple servers, separate them with spaces.

3. Save the changes to the file. Restart Softphone.Pro and verify that the application works with the specified DNS servers.