try {
Record[] records = doLookup(e164arpa_domain, Type.NAPTR);
Arrays.sort(records, new NaptrComparator());
for (Record record : records) {
NAPTRRecord naptrRecord = (NAPTRRecord) record;
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"number of DNS/NAPTR records:" + records.length);
logger.log(Level.FINE,
"NAPTRRecord.toString():" + record.toString());
}
String flag = naptrRecord.getFlags();
String service = naptrRecord.getService();
Name replacement = naptrRecord.getReplacement();
if (service.equalsIgnoreCase("E2U+sip") ||
service.equalsIgnoreCase("sip+E2U")) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"flag:" + naptrRecord.getFlags() + " flaglength:" +
naptrRecord.getFlags().length());
logger.log(Level.FINE,
"regexp:" + naptrRecord.getRegexp() +
" replacement:" + replacement);
}
if (!EnumUtil.isEmpty(replacement) && (flag.length() == 0)) {
return lookupTelUrlNAPTRRecord(AUS,
replacement.toString(), visited, ++depth);
}
String substitution = EnumUtil.applyRegExp(AUS,
naptrRecord.getRegexp());
if (substitution == null) {
// try next record
continue;
}