PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/servers/jain-sip-ext/src/main/java/org/mobicents/ext/javax/sip/dns/DefaultDNSServerLocator.java

http://mobicents.googlecode.com/
Java | 573 lines | 508 code | 17 blank | 48 comment | 44 complexity | 8a22ecf99f5e3d879a891224e879675a MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.ext.javax.sip.dns;
  23. import gov.nist.javax.sip.address.AddressFactoryImpl;
  24. import gov.nist.javax.sip.stack.HopImpl;
  25. import java.net.InetAddress;
  26. import java.net.UnknownHostException;
  27. import java.text.ParseException;
  28. import java.util.ArrayList;
  29. import java.util.Collections;
  30. import java.util.HashMap;
  31. import java.util.Iterator;
  32. import java.util.LinkedList;
  33. import java.util.List;
  34. import java.util.Map;
  35. import java.util.Queue;
  36. import java.util.Set;
  37. import java.util.concurrent.CopyOnWriteArraySet;
  38. import java.util.regex.Matcher;
  39. import java.util.regex.Pattern;
  40. import javax.sip.ListeningPoint;
  41. import javax.sip.address.Hop;
  42. import javax.sip.address.SipURI;
  43. import javax.sip.address.TelURL;
  44. import javax.sip.address.URI;
  45. import org.apache.log4j.Logger;
  46. import org.mobicents.ext.javax.sip.utils.Inet6Util;
  47. import org.xbill.DNS.NAPTRRecord;
  48. import org.xbill.DNS.Record;
  49. import org.xbill.DNS.SRVRecord;
  50. /**
  51. * The Address resolver to resolve proxy domain to a hop to the outbound proxy server
  52. * by doing SRV lookup of the host of the Hop as mandated by rfc3263. <br/>
  53. *
  54. * some of the rfc3263 can hardly be implemented and NAPTR query can hardly be done
  55. * since the stack populate port and transport automatically.
  56. *
  57. * @author jean.deruelle@gmail.com
  58. *
  59. */
  60. public class DefaultDNSServerLocator implements DNSServerLocator {
  61. private static final Logger logger = Logger.getLogger(DefaultDNSServerLocator.class);
  62. protected Set<String> supportedTransports;
  63. protected Set<String> localHostNames;
  64. private DNSLookupPerformer dnsLookupPerformer;
  65. public DefaultDNSServerLocator() {
  66. localHostNames = new CopyOnWriteArraySet<String>();
  67. dnsLookupPerformer = new DefaultDNSLookupPerformer();
  68. this.supportedTransports = new CopyOnWriteArraySet<String>();
  69. }
  70. /**
  71. */
  72. public DefaultDNSServerLocator(Set<String> supportedTransports) {
  73. this();
  74. this.supportedTransports = new CopyOnWriteArraySet<String>(supportedTransports);
  75. }
  76. /* (non-Javadoc)
  77. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#locateHops(javax.sip.address.URI)
  78. */
  79. public Queue<Hop> locateHops(URI uri) {
  80. SipURI sipUri = getSipURI(uri);
  81. if(sipUri != null) {
  82. return locateHopsForSipURI(sipUri);
  83. }
  84. return new LinkedList<Hop>();
  85. }
  86. /*
  87. * (non-Javadoc)
  88. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#getSipURI(javax.sip.address.URI)
  89. */
  90. public SipURI getSipURI(URI uri) {
  91. if(uri instanceof TelURL) {
  92. return lookupSipUri(((TelURL)uri).getPhoneNumber());
  93. } else if(uri.isSipURI() && ((SipURI)uri).getParameter("user") != null && ((SipURI)uri).getParameter("user").equalsIgnoreCase("phone")) {
  94. return lookupSipUri(((SipURI)uri).getUser());
  95. } else if (uri instanceof SipURI) {
  96. return (SipURI) uri;
  97. }
  98. return null;
  99. }
  100. /**
  101. * The phone number is converted to a domain name
  102. * then a corresponding NAPTR DNS lookup is done to find the SipURI
  103. * @param phoneNumber phone number used to find the corresponding SipURI
  104. * @return the SipURI found through ENUM for the given phone number
  105. */
  106. public SipURI lookupSipUri(String phoneNumber) {
  107. String domainName = convertPhoneNumberToDomainName(phoneNumber);
  108. List<NAPTRRecord> naptrRecords = dnsLookupPerformer.performNAPTRLookup(domainName, false, supportedTransports);
  109. if(naptrRecords.size() > 0) {
  110. Collections.sort(naptrRecords, new NAPTRRecordComparator());
  111. for(NAPTRRecord naptrRecord : naptrRecords) {
  112. String regexp = naptrRecord.getRegexp().toString();
  113. if(logger.isDebugEnabled()) {
  114. logger.debug("regexp " + regexp + " found for phone number " + phoneNumber);
  115. }
  116. // http://code.google.com/p/mobicents/issues/detail?id=2774 : Fix For allowing REGEX
  117. // Contribution from Oifa Yulian from Web Ukraine
  118. if(regexp.startsWith("!"))
  119. regexp=regexp.substring(1);
  120. if(regexp.endsWith("!"))
  121. regexp=regexp.substring(0,regexp.length()-1);
  122. String[] regexPortions=regexp.split("!");
  123. if(regexPortions.length==2) {
  124. if(regexPortions[1].startsWith("sip:")) {
  125. String result = regexPortions[1];
  126. Pattern pattern = Pattern.compile(regexPortions[0]);
  127. Matcher regexMatcher = pattern.matcher(phoneNumber);
  128. if(regexMatcher.matches())
  129. for(int i=0; i<regexMatcher.groupCount(); i++) {
  130. String group = regexMatcher.group(i);
  131. if(logger.isDebugEnabled()) {
  132. logger.debug("group found " + group);
  133. }
  134. result = result.replace("\\\\" + (i+1), group);
  135. }
  136. try {
  137. return new AddressFactoryImpl().createSipURI(result);
  138. }
  139. catch (ParseException e) {
  140. if(logger.isDebugEnabled()) {
  141. logger.debug("replacement " + result + " couldn't be parsed a valid sip uri : " + e.getMessage());
  142. }
  143. }
  144. } else {
  145. if(logger.isDebugEnabled()) {
  146. logger.debug("regexp seconf portion " + regexPortions[1] + " does not start with sip:");
  147. }
  148. }
  149. } else {
  150. if(logger.isDebugEnabled()) {
  151. logger.debug("regexp " + regexp + " number of portions " + regexPortions.length);
  152. }
  153. }
  154. }
  155. }
  156. return null;
  157. }
  158. /**
  159. * Convert Phone Number to a valid ENUM domain name to be used for NAPTR DNS lookup
  160. * @param phoneNumber phone number to convert
  161. * @return the corresponding domain name
  162. */
  163. private String convertPhoneNumberToDomainName(String phoneNumber) {
  164. char[] phoneNumberAsChar = phoneNumber.toCharArray();
  165. StringBuilder validPhoneNumber = new StringBuilder();
  166. for (char c : phoneNumberAsChar) {
  167. if(Character.isDigit(c)) {
  168. validPhoneNumber.append(c).append('.');
  169. }
  170. }
  171. return validPhoneNumber.reverse().append(".e164.arpa").substring(1);
  172. }
  173. public Queue<Hop> locateHopsForSipURI(SipURI sipURI) {
  174. final String hopHost = sipURI.getHost();
  175. int hopPort = sipURI.getPort();
  176. final String hopTransport = sipURI.getTransportParam();
  177. if(logger.isDebugEnabled()) {
  178. logger.debug("Resolving " + hopHost + " transport " + hopTransport);
  179. }
  180. // As per rfc3263 Section 4.2
  181. // If TARGET is a numeric IP address, the client uses that address.
  182. if(Inet6Util.isValidIP6Address(hopHost)
  183. || Inet6Util.isValidIPV4Address(hopHost)) {
  184. if(logger.isDebugEnabled()) {
  185. logger.debug("host " + hopHost + " is a numeric IP address, " +
  186. "no DNS SRV lookup to be done, using the hop given in param");
  187. }
  188. Queue<Hop> priorityQueue = new LinkedList<Hop>();
  189. String transport = hopTransport;
  190. if(transport == null) {
  191. transport = getDefaultTransportForSipUri(sipURI);
  192. }
  193. // If the URI also contains a port, it uses that port. If no port is
  194. // specified, it uses the default port for the particular transport
  195. // protocol.numeric IP address, no DNS lookup to be done
  196. if(hopPort == -1) {
  197. if(ListeningPoint.TLS.equalsIgnoreCase(transport) || (ListeningPoint.TCP.equalsIgnoreCase(transport) && sipURI.isSecure())) {
  198. hopPort = 5061;
  199. } else {
  200. hopPort = 5060;
  201. }
  202. }
  203. priorityQueue.add(new HopImpl(hopHost, hopPort, transport));
  204. return priorityQueue;
  205. }
  206. // if the host belong to the local endpoint, server or container, it tries to resolve the ip address
  207. if(localHostNames.contains(hopHost)) {
  208. if(logger.isDebugEnabled()) {
  209. logger.debug("host " + hopHost + " is a localhostName belonging to ourselves");
  210. }
  211. try {
  212. InetAddress ipAddress = InetAddress.getByName(hopHost);
  213. Queue<Hop> priorityQueue = new LinkedList<Hop>();
  214. priorityQueue.add(new HopImpl(ipAddress.getHostAddress(), hopPort, hopTransport));
  215. return priorityQueue;
  216. } catch (UnknownHostException e) {
  217. logger.warn(hopHost + " belonging to the container cannot be resolved");
  218. }
  219. }
  220. // As per rfc3263 Section 4.2
  221. // If the TARGET was not a numeric IP address, and no port was present
  222. // in the URI, the client performs an SRV query
  223. return resolveHostByDnsSrvLookup(sipURI);
  224. }
  225. /**
  226. * Resolve the Host by doing a SRV lookup on it
  227. *
  228. * @param sipUri
  229. * @return
  230. */
  231. public Queue<Hop> resolveHostByDnsSrvLookup(SipURI sipURI) {
  232. if(logger.isDebugEnabled()) {
  233. logger.debug("Resolving Hops for SipURI " + sipURI);
  234. }
  235. final String host = sipURI.getHost();
  236. final int port = sipURI.getPort();
  237. String transport = sipURI.getTransportParam();
  238. NAPTRRecord naptrRecordOfTransportLookup = null;
  239. List<Record> srvRecordsOfTransportLookup = new ArrayList<Record>();
  240. // Determine the transport to be used for a given SIP URI as defined by
  241. // RFC 3263 Section 4.1 Selecting a Transport Protocol
  242. if(transport == null) {
  243. if(logger.isDebugEnabled()) {
  244. logger.debug("transport not specified, trying to resolve it for " + sipURI);
  245. }
  246. // Similarly, if no transport protocol is specified,
  247. // and the TARGET is not numeric, but an explicit port is provided, the
  248. // client SHOULD use UDP for a SIP URI, and TCP for a SIPS URI
  249. if(port != -1) {
  250. if(logger.isDebugEnabled()) {
  251. logger.debug("port not specified, trying to resolve it for " + sipURI);
  252. }
  253. transport = getDefaultTransportForSipUri(sipURI);
  254. } else {
  255. // Otherwise, if no transport protocol or port is specified, and the
  256. // target is not a numeric IP address, the client SHOULD perform a NAPTR
  257. // query for the domain in the URI.
  258. List<NAPTRRecord> naptrRecords = dnsLookupPerformer.performNAPTRLookup(host, sipURI.isSecure(), supportedTransports);
  259. if(naptrRecords == null || naptrRecords.size() == 0) {
  260. if(logger.isDebugEnabled()) {
  261. logger.debug("no NPATR records found, doing SRV queries for supported transports for " + sipURI);
  262. }
  263. // If no NAPTR records are found, the client constructs SRV queries for
  264. // those transport protocols it supports, and does a query for each.
  265. // Queries are done using the service identifier "_sip" for SIP URIs and
  266. // "_sips" for SIPS URIs
  267. Iterator<String> supportedTransportIterator = supportedTransports.iterator();
  268. Map<String, List<Record>> resolvedTransports = new HashMap<String, List<Record>>();
  269. while (supportedTransportIterator.hasNext()) {
  270. String supportedTransport = supportedTransportIterator
  271. .next().toLowerCase();
  272. String serviceIdentifier = "_sip._";
  273. if (sipURI.isSecure()) {
  274. serviceIdentifier = "_sips._";
  275. }
  276. if(logger.isDebugEnabled()) {
  277. logger.debug("no NPATR records found, doing SRV query for supported transport " + serviceIdentifier
  278. + supportedTransport + "." + host + " for " + sipURI);
  279. }
  280. List<Record> lookupRecord = dnsLookupPerformer.performSRVLookup(serviceIdentifier
  281. + supportedTransport + "." + host);
  282. if (lookupRecord.size() > 0) {
  283. if(logger.isDebugEnabled()) {
  284. logger.debug("no NPATR records found, SRV query for supported transport " + serviceIdentifier
  285. + supportedTransport + "." + host + " successful for " + sipURI);
  286. }
  287. //Issue 3140 http://code.google.com/p/mobicents/issues/detail?id=3140
  288. //We shouldn't return fast with the first transport found
  289. //a check should be done in the case of SIPS URI and TLS transport is supported
  290. resolvedTransports.put(supportedTransport.toUpperCase(), lookupRecord);
  291. }
  292. }
  293. if (!resolvedTransports.isEmpty()){
  294. if(sipURI.isSecure() && (resolvedTransports.keySet().contains(ListeningPoint.TLS)
  295. || resolvedTransports.keySet().contains(ListeningPoint.TCP)) ){
  296. //RFC5630 3.1.3 & RFC3261 26.2.2 -> SIPS indicate "TLS-only" request
  297. //SRV Record for TLS could be either
  298. // _sips._tcp OR
  299. // _sips._tls
  300. if(logger.isDebugEnabled()) {
  301. logger.debug("SIPS URI was provided to resolve and TLS transport found by the SRV query. Setting transport to TLS for " + sipURI);
  302. }
  303. transport = ListeningPoint.TLS;
  304. if(resolvedTransports.get(transport) == null) {
  305. transport = ListeningPoint.TCP;
  306. }
  307. srvRecordsOfTransportLookup.addAll(resolvedTransports.get(transport));
  308. } else if (!sipURI.isSecure()){
  309. if(resolvedTransports.keySet().contains(ListeningPoint.TLS)){
  310. //RFC5630 3.1.3 & RFC3261 26.2.2 -> SIP over TLS indicate "best-effort TLS" request
  311. //So if SRV Record for TLS found we choose it
  312. // _sip._tls
  313. if(logger.isDebugEnabled()) {
  314. logger.debug("SIP URI was provided to resolve and TLS transport found by the SRV query. Setting transport to TLS for " + sipURI);
  315. }
  316. if(resolvedTransports.get(transport) == null) {
  317. transport = ListeningPoint.TCP;
  318. }
  319. srvRecordsOfTransportLookup.addAll(resolvedTransports.get(transport));
  320. } else {
  321. //RFC3263
  322. // A particular transport is supported if the query is successful.
  323. // The client MAY use any transport protocol it
  324. // desires which is supported by the server => we use the first one
  325. transport = resolvedTransports.keySet().iterator().next();
  326. srvRecordsOfTransportLookup.addAll(resolvedTransports.get(transport));
  327. }
  328. }
  329. }
  330. if(transport == null) {
  331. if(logger.isDebugEnabled()) {
  332. logger.debug("no SRV records found for finding transport for " + sipURI);
  333. }
  334. // If no SRV records are found, the client SHOULD use TCP for a SIPS
  335. // URI, and UDP for a SIP URI
  336. transport = getDefaultTransportForSipUri(sipURI);
  337. }
  338. } else {
  339. // Sorting the records
  340. java.util.Collections.sort(naptrRecords, new NAPTRRecordComparator());
  341. naptrRecordOfTransportLookup = naptrRecords.get(0);
  342. if(logger.isDebugEnabled()) {
  343. logger.debug("naptr records found for finding transport for " + sipURI);
  344. }
  345. String service = naptrRecordOfTransportLookup.getService();
  346. if(service.contains(DNSLookupPerformer.SERVICE_SIPS)) {
  347. transport = ListeningPoint.TLS;
  348. } else {
  349. if(service.contains(DNSLookupPerformer.SERVICE_D2U)) {
  350. transport = ListeningPoint.UDP;
  351. } else {
  352. transport = ListeningPoint.TCP;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. transport = transport.toLowerCase();
  359. //Clear
  360. if(logger.isDebugEnabled()) {
  361. logger.debug("using transport "+ transport + " for " + sipURI);
  362. }
  363. // RFC 3263 Section 4.2
  364. // Once the transport protocol has been determined, the next step is to
  365. // determine the IP address and port.
  366. if(port != -1) {
  367. if(logger.isDebugEnabled()) {
  368. logger.debug("doing A and AAAA lookups since TARGET is not numeric and port is not null for " + sipURI);
  369. }
  370. // If the TARGET was not a numeric IP address, but a port is present in
  371. // the URI, the client performs an A or AAAA record lookup of the domain
  372. // name. The result will be a list of IP addresses, each of which can
  373. // be contacted at the specific port from the URI and transport protocol
  374. // determined previously. The client SHOULD try the first record. If
  375. // an attempt should fail, based on the definition of failure in Section
  376. // 4.3, the next SHOULD be tried, and if that should fail, the next
  377. // SHOULD be tried, and so on.
  378. return dnsLookupPerformer.locateHopsForNonNumericAddressWithPort(host, port, transport);
  379. } else {
  380. if(naptrRecordOfTransportLookup != null) {
  381. // If the TARGET was not a numeric IP address, and no port was present
  382. // in the URI, the client performs an SRV query on the record returned
  383. // from the NAPTR processing of Section 4.1, if such processing was
  384. // performed.
  385. if(logger.isDebugEnabled()) {
  386. logger.debug("performing SRV lookup on NAPTR replacement found earlier " + naptrRecordOfTransportLookup.getReplacement() + " for " + sipURI);
  387. }
  388. List<Record> srvRecords = dnsLookupPerformer.performSRVLookup(naptrRecordOfTransportLookup.getReplacement().toString());
  389. if (srvRecords.size() > 0) {
  390. return sortSRVRecords(host, transport, srvRecords);
  391. } else {
  392. if(logger.isDebugEnabled()) {
  393. logger.debug("doing A and AAAA lookups since SRV lookups returned no records for NAPTR replacement found earlier " + naptrRecordOfTransportLookup.getReplacement() + " for " + sipURI);
  394. }
  395. // If no SRV records were found, the client performs an A or AAAA record
  396. // lookup of the domain name.
  397. return dnsLookupPerformer.locateHopsForNonNumericAddressWithPort(host, port, transport);
  398. }
  399. } else if(srvRecordsOfTransportLookup == null || srvRecordsOfTransportLookup.size() == 0){
  400. // If it was not, because a transport was specified
  401. // explicitly, the client performs an SRV query for that specific
  402. // transport, using the service identifier "_sips" for SIPS URIs. For a
  403. // SIP URI, if the client wishes to use TLS, it also uses the service
  404. // identifier "_sips" for that specific transport, otherwise, it uses "_sip"
  405. String serviceIdentifier = "_sip._";
  406. if ((sipURI.isSecure() && !transport.equalsIgnoreCase(ListeningPoint.UDP)) || transport.equalsIgnoreCase(ListeningPoint.TLS)) {
  407. serviceIdentifier = "_sips._";
  408. }
  409. if(logger.isDebugEnabled()) {
  410. logger.debug("performing SRV lookup because a transport was specified explicitly for " + sipURI);
  411. }
  412. List<Record> srvRecords = dnsLookupPerformer.performSRVLookup(serviceIdentifier + transport + "." + host);
  413. if (srvRecords == null || srvRecords.size() == 0) {
  414. if(logger.isDebugEnabled()) {
  415. logger.debug("doing A and AAAA lookups since SRV lookups returned no records and transport was specified explicitly for " + sipURI);
  416. }
  417. // If no SRV records were found, the client performs an A or AAAA record
  418. // lookup of the domain name.
  419. return dnsLookupPerformer.locateHopsForNonNumericAddressWithPort(host, port, transport);
  420. } else {
  421. return sortSRVRecords(host, transport, srvRecords);
  422. }
  423. } else {
  424. // If the NAPTR processing was not done because no NAPTR
  425. // records were found, but an SRV query for a supported transport
  426. // protocol was successful, those SRV records are selected
  427. return sortSRVRecords(host, transport, srvRecordsOfTransportLookup);
  428. }
  429. }
  430. }
  431. /**
  432. * @param host
  433. * @param transport
  434. * @param priorityQueue
  435. * @param srvRecords
  436. * @return
  437. */
  438. private Queue<Hop> sortSRVRecords(final String host, String transport, List<Record> srvRecords) {
  439. Queue<Hop> priorityQueue = new LinkedList<Hop>();
  440. Collections.sort(srvRecords, new SRVRecordComparator());
  441. for (Record record : srvRecords) {
  442. SRVRecord srvRecord = (SRVRecord) record;
  443. int recordPort = srvRecord.getPort();
  444. String resolvedName = srvRecord.getTarget().toString();
  445. try {
  446. String hostAddress= InetAddress.getByName(resolvedName).getHostAddress();
  447. if(logger.isDebugEnabled()) {
  448. logger.debug("Did a successful DNS SRV lookup for host:transport " +
  449. ""+ host + "/" + transport +
  450. " , Host Name = " + resolvedName +
  451. " , Host IP Address = " + hostAddress +
  452. ", Host Port = " + recordPort);
  453. }
  454. priorityQueue.add(new HopImpl(hostAddress, recordPort, transport));
  455. } catch (UnknownHostException e) {
  456. logger.error("Impossible to get the host address of the resolved name, " +
  457. "we are going to just use the domain name directly" + resolvedName, e);
  458. }
  459. }
  460. return priorityQueue;
  461. }
  462. /**
  463. * @param sipURI
  464. * @return
  465. */
  466. public String getDefaultTransportForSipUri(SipURI sipURI) {
  467. String transport;
  468. if(sipURI.isSecure()) {
  469. transport = ListeningPoint.TLS;
  470. } else {
  471. // Issue http://code.google.com/p/mobicents/issues/detail?id=2836: if no UDP connectors are present
  472. // take the TCP one
  473. if (supportedTransports.contains(ListeningPoint.UDP))
  474. transport = ListeningPoint.UDP;
  475. else if (supportedTransports.contains(ListeningPoint.TCP))
  476. transport = ListeningPoint.TCP;
  477. else
  478. throw new IllegalArgumentException("No supported transport for SIP URI " + sipURI);
  479. }
  480. return transport;
  481. }
  482. /* (non-Javadoc)
  483. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#addLocalHostName(java.lang.String)
  484. */
  485. public void addLocalHostName(String localHostName) {
  486. if(logger.isDebugEnabled()) {
  487. logger.debug("Adding localHostName "+ localHostName);
  488. }
  489. localHostNames.add(localHostName);
  490. }
  491. /* (non-Javadoc)
  492. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#removeLocalHostName(java.lang.String)
  493. */
  494. public void removeLocalHostName(String localHostName) {
  495. if(logger.isDebugEnabled()) {
  496. logger.debug("Removing localHostName "+ localHostName);
  497. }
  498. localHostNames.remove(localHostName);
  499. }
  500. /* (non-Javadoc)
  501. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#addSupportedTransport(java.lang.String)
  502. */
  503. public void addSupportedTransport(String supportedTransport) {
  504. if(logger.isDebugEnabled()) {
  505. logger.debug("Adding supportedTransport "+ supportedTransport);
  506. }
  507. supportedTransports.add(supportedTransport.toUpperCase());
  508. }
  509. /* (non-Javadoc)
  510. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#removeSupportedTransport(java.lang.String)
  511. */
  512. public void removeSupportedTransport(String supportedTransport) {
  513. if(logger.isDebugEnabled()) {
  514. logger.debug("Removing supportedTransport "+ supportedTransport);
  515. }
  516. supportedTransports.add(supportedTransport.toUpperCase());
  517. }
  518. /* (non-Javadoc)
  519. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#setDnsLookupPerformer(org.mobicents.ext.javax.sip.dns.DefaultDNSLookupPerformer)
  520. */
  521. public void setDnsLookupPerformer(DNSLookupPerformer dnsLookupPerformer) {
  522. this.dnsLookupPerformer = dnsLookupPerformer;
  523. }
  524. /* (non-Javadoc)
  525. * @see org.mobicents.ext.javax.sip.dns.DNSServerLocator#getDnsLookupPerformer()
  526. */
  527. public DNSLookupPerformer getDnsLookupPerformer() {
  528. return dnsLookupPerformer;
  529. }
  530. }