Skip to main content

Locating SIP servers using DNS in SailFin

Posted by binod on February 22, 2008 at 2:58 AM PST

As per RFC 3263, there are two new kind of records that are important for SIP. They are Naming Authority Pointer (NAPTR) Record and Service Record (SRV). In this example, NAPTR is used as a mechanism to specify the protocol (TCP or UDP) where as SRV records will be used locate the server and port from SailFin.

Example snippet from DNS zone file

_sip._udp.test.com. 3600 IN SRV 10 0 5090 sailfinserver.test.com.
_sip._tcp.test.com. 3600 IN SRV 10 0 5090 sailfinserver.test.com.
_sips._tcp.test.com. 3600 IN SRV 10 0 5061 sailfinserver.test.com.
_sips._udp.test.com. 3600 IN SRV 10 0 5061 sailfinserver.test.com.
;                  order pref flags service      regexp  replacement
test.com. IN NAPTR 0 0 "s" "SIPS+D2T" "" _sips._tcp.test.com.
test.com. IN NAPTR 1 0 "s" "SIP+D2T"  "" _sip._tcp.test.com.
test.com. IN NAPTR 2 0 "s" "SIP+D2U"  "" _sip._udp.test.com.
sailfinserver.test.com. IN A 192.168.1.100

Lets take the NAPTR record shown above, the third column, in these records suggest that the server support TLS over TCP, TCP and UDP protocols and are preferred in that order. Now, if the client support TCP and UDP, then the preference will be given to TCP as that has the lower order compared to UDP.

The SRV records suggest that the port used by the server for TCP and UDB communication is 5090 and not the usual 5060 and the actual server is sailfinserver.test.com.

Finally we have an A record that resolves the sailfinserver.test.com to the computer's IP address.

SailFin uses dnsjava apis for name resolution. It allows the user to configure a JVM option called dns.server for specifying the name server. We could specify that as a jvm-option in domain.xml

dns-jvmoption.png

If this is not specified, dnsjava also searches /etc/resolve.conf to find the name server. For experimenting that was better for me, as I always have a local name server running in the laptop. (For a moment forget Sip/SailFin, local name server (bind) performs much better for me than BSNL or opendns. That itself is a reason to run a local name server).

Here is my /etc/resolve.conf file content.

nameserver 127.0.0.1
nameserver 218.248.240.208
nameserver 4.2.2.1

Once these are configured, SailFin will be able to resolve the domain "test.com" and find correct SIP server, protocol, port etc. Here is the example of the INVITE message that I tried.

dns-invite.png

With these settings, SailFin will resolve "To" address to 192.168.1.100:5090 and will use TCP protocol.I have uploaded the following files in a zip, as an example.

1. sip-proxy.war : A sip application as explained in Sip Proxy example of sailfin.
2. xyz.zone which contains all the DNS records explained above.
3. named.conf of my bind DNS.
4. uac.xml and uas.xml files for running the sipp tests (I have hard coded the test.com in the files)

Steps to try DNS in sailfin.

1. Setup and start the nameserver (bind). The example zip file contains named.conf and the domain zone file.
2. After starting the DNS, dig it and see, if it is working (eg: dig @127.0.0.1 NAPTR test.com). Make sure that the ANSWER from DNS contains the SRV records.
3. Configure either the dns.server jvm-option in sailfin or /etc/resolve.conf
4. Start a SailFin server and deploy the sip proxy servlet.
5. Use Sipp to execute a proxy scenario using the uac.xml and uas.xml. (The only change from the proxy example will be to use the sip proxy files.

Related Topics >>

Comments

Hi Binod, I believe that the _sips._udp SRV record ...

Hi Binod,

I believe that the _sips._udp SRV record shouldn't be there. According to RFC3263, SRV and NAPTR records for SIPS URI should be defined for TCP only.

Regards
George

HI Binod, I am currently facing one problem dealing with ...

HI Binod,

I am currently facing one problem dealing with sailfin. Looking at your experinace on this subject , I hope you are the best person to answer my question.

1. I am trying to send a INVITE to a PROXY which is not registered to sailfin. sailfin is not sending that INVITE out.

INVITE sip:msml@172.16.0.30:5060

This 172.16.0.30 is in same network, and i was able to send invite using "sipp" but failed with sailfin ( I tried to generate this invite thorugh a web link using sample code, where i changed the request uri to the above shown example).

2. My orignal requirment was to send a Out of dialog REFER to this proxy (172.16.0.30:5060) through sailfin. But it was failing.

Can you please help me by answering these queries ....I appriciate in advance.

Thank you

Regards,

Ankit Bhandari

Where exactly did you add the property? Can you mail me your domain.xml snippet (binod AT dev dot java dot net)?

Hi Binod, Adding that tag does not work for me. I add that property, but once i deploy the servlet the deploy.xml file gets rewritten and the tag erased. Thanks

Hi, Should that be resolv.conf and resolve.conf? I dont use windows that much, so I may be wrong. In any case, dns.server system property should work.

Hi Binod! I wonder where it searches for file resolve.conf on windows platform? I've tried Windows/system32/drivers/etc/resolve.conf - it gave me no result. :(