Skip to main content

Function sofia_dig

About

sofia_dig is an API command for looking up SIP NAPTR/SRV/AAAA/A records.

Click here to expand Table of Contents

Usage

usage: sofia_dig [OPTIONS] [@dnsserver] uri

Examples

freeswitch@internal> sofia_dig conference.freeswitch.org
Preference Weight Transport Port Address
================================================================================
1 0.500 udp 5060 74.112.133.77
1 0.500 tcp 5060 74.112.133.77


Or for just UDP:

 freeswitch@internal> sofia_dig --udp conference.freeswitch.org  
Preference Weight Transport Port Address
================================================================================
1 1.000 udp 5060 74.112.133.77


You can also get the result as XML:

freeswitch@internal> sofia_dig xml freeswitch.org
<routes>
<route>
<preference>1</preference>
<weight>0.000</weight>
<transport>udp</transport>
<port>5060</port>
<address>216.82.231.90</address>
</route>
</routes>

Or resolve a SIP URI:

 freeswitch@internal> sofia_dig sip:888@conference.freeswitch.org
Preference Weight Transport Port Address
================================================================================
1 0.500 udp 5060 74.112.133.77
1 0.500 tcp 5060 74.112.133.77

If the zone doesn't have any NAPTR/SRV records, it returns a pair of "fake" routes that assume SIP UDP and TCP on port 5060 of the AAAA and the A record for the hostname.

I set up a zone with one of each kind of NAPTR/SRV records as a demo:

freeswitch@internal> sofia_dig cataclysm-software.net
Preference Weight Transport Port Address
================================================================================
1 0.200 udp 5060 65.172.243.156
2 0.200 tcp 5065 65.172.243.156
3 0.200 sctp 5080 65.172.243.156
4 0.200 tls 5070 65.172.243.156


Options

-v : "be verbatim" (doesn't seem to do anything)

-p=[udp|tcp|tls|sctp|tls-sctp|tls-udp] : only query for specific protocols

--[udp|tcp|tls|sctp|tls-sctp|tls-udp] : ditto (these are stackable, eg. --sctp --udp to query only SCTP and UDP records)

--no-sctp : duh

You can also (in theory) specify the nameserver to query by using @[dnsserver] but it doesn't seem to work (the variable is never used in the code).