The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


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 >> Mobile and Embedded      
Comments
Comments are listed in date ascending order (oldest first)

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. :(

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, 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

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