public class DefaultDNSServerLocator extends Object implements DNSServerLocator
| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
localHostNames |
protected Map<String,Set<String>> |
localHostNamesToIPMap |
protected Set<String> |
supportedTransports |
| Constructor and Description |
|---|
DefaultDNSServerLocator() |
DefaultDNSServerLocator(Set<String> supportedTransports) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLocalHostName(String localHostName)
Adds a local host name for which the DNS lookups can be bypassed, by example if an URI is targeted at the local server
|
void |
addSupportedTransport(String supportedTransport)
Add a supported transport (UDP, TCP, TLS, SCTP) to the set of supported transports.
|
String |
getDefaultTransportForSipUri(javax.sip.address.SipURI sipURI) |
DNSLookupPerformer |
getDnsLookupPerformer()
Retrieve the
DNSLookupPerformer performing the DNS lookups |
javax.sip.address.SipURI |
getSipURI(javax.sip.address.URI uri)
From the uri passed in parameter, try to find the corresponding SipURI.
|
Queue<javax.sip.address.Hop> |
locateHops(javax.sip.address.URI uri)
Discovers servers according to RFC 3263 and/or ENUM support for the given uri passed in parameters
|
Queue<javax.sip.address.Hop> |
locateHopsForSipURI(javax.sip.address.SipURI sipURI) |
javax.sip.address.SipURI |
lookupSipUri(String phoneNumber)
The phone number is converted to a domain name
then a corresponding NAPTR DNS lookup is done to find the SipURI
|
void |
mapLocalHostNameToIP(String localHostName,
Set<String> ipAddresses)
Adds a local host name for which the DNS lookups that are bypassed DNSJava can resolve to a set of IP Addresses
|
void |
removeLocalHostName(String localHostName)
Removes a local host name for which the DNS lookups can be bypassed, by example if an URI is targeted at the local server
|
void |
removeSupportedTransport(String supportedTransport)
Remove a supported transport (UDP, TCP, TLS, SCTP) to the set of supported transports.
|
Queue<javax.sip.address.Hop> |
resolveHostByAandAAAALookup(String hopHost,
int hopPort,
String hopTransport)
Resolve Hostname to lookup IPAddresses corresponding to a given host including local Host Names as DNSJava is bypassing /etc/hosts
|
Queue<javax.sip.address.Hop> |
resolveHostByDnsSrvLookup(javax.sip.address.SipURI sipURI)
Resolve the Host by doing a SRV lookup on it
|
void |
setDnsLookupPerformer(DNSLookupPerformer dnsLookupPerformer)
Sets the
DNSLookupPerformer to perform the DNS lookups |
void |
unmapLocalHostNameToIP(String localHostName)
Removes a local host name to ip addresses mapping
|
public Queue<javax.sip.address.Hop> locateHops(javax.sip.address.URI uri)
DNSServerLocatorlocateHops in interface DNSServerLocatoruri - the uri for which the DNS lookups have to be donepublic javax.sip.address.SipURI getSipURI(javax.sip.address.URI uri)
DNSServerLocatorFrom the uri passed in parameter, try to find the corresponding SipURI. If the uri in parameter is already a SipURI without a user=phone param, it is just returned If the uri in parameter is a TelURL or SipURI with a user=phone param, the phone number is converted to a domain name then a corresponding NAPTR DNS lookup is done to find the SipURI
Usage Example
try {
URI uri = addressFactory.createTelURL("+12153208617");
SipURI sipURI = dnsServerLocator.getSipURI(uri);
} catch (ServletParseException e) {
logger.error("Impossible to create the tel URL", e);
}
getSipURI in interface DNSServerLocatoruri - the uri used to find the corresponding SipURIpublic javax.sip.address.SipURI lookupSipUri(String phoneNumber)
phoneNumber - phone number used to find the corresponding SipURIpublic Queue<javax.sip.address.Hop> locateHopsForSipURI(javax.sip.address.SipURI sipURI)
public Queue<javax.sip.address.Hop> resolveHostByAandAAAALookup(String hopHost, int hopPort, String hopTransport)
DNSServerLocatorresolveHostByAandAAAALookup in interface DNSServerLocatorhopHost - hostname to lookuphopPort - port if any (not useful for lookup, will just be added in the resulting Hop from the Queue)hopTransport - transport if any (not useful for lookup, will just be added in the resulting Hop from the Queue)public Queue<javax.sip.address.Hop> resolveHostByDnsSrvLookup(javax.sip.address.SipURI sipURI)
sipUri - public String getDefaultTransportForSipUri(javax.sip.address.SipURI sipURI)
sipURI - public void addLocalHostName(String localHostName)
DNSServerLocatoraddLocalHostName in interface DNSServerLocatorlocalHostName - the name of the local host to addpublic void removeLocalHostName(String localHostName)
DNSServerLocatorremoveLocalHostName in interface DNSServerLocatorlocalHostName - the name of the local host to removepublic void mapLocalHostNameToIP(String localHostName, Set<String> ipAddresses)
DNSServerLocatormapLocalHostNameToIP in interface DNSServerLocatorlocalHostName - the name of the local host to addipAddresses - the list of ip addresses to map to that hostnamepublic void unmapLocalHostNameToIP(String localHostName)
DNSServerLocatorunmapLocalHostNameToIP in interface DNSServerLocatorlocalHostName - the name of the local host to removepublic void addSupportedTransport(String supportedTransport)
DNSServerLocatoraddSupportedTransport in interface DNSServerLocatorsupportedTransport - the supported transport to addpublic void removeSupportedTransport(String supportedTransport)
DNSServerLocatorremoveSupportedTransport in interface DNSServerLocatorsupportedTransport - the supported transport to removepublic void setDnsLookupPerformer(DNSLookupPerformer dnsLookupPerformer)
DNSServerLocatorDNSLookupPerformer to perform the DNS lookupssetDnsLookupPerformer in interface DNSServerLocatordnsLookupPerformer - the dnsLookupPerformer to setpublic DNSLookupPerformer getDnsLookupPerformer()
DNSServerLocatorDNSLookupPerformer performing the DNS lookupsgetDnsLookupPerformer in interface DNSServerLocatorCopyright © 2016. All Rights Reserved.