if (!isTelephoneNumber(uri)) {
throw new TelUrlResolverException("The uri is not a phone number:" +
uri);
}
TelURL telUrl = null;
if (uri.isSipURI()) {
try {
telUrl = UriUtil.convertToTelURL((SipURI) uri);
} catch (UriUtilException e) {
throw new TelUrlResolverException("Could not convert URI: \"" +
uri + "\" to Tel-URL", e);
}
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"Sip-URI was converted to Tel-URL: " + telUrl);
}
} else if (uri.getScheme().equals(SipFactoryImpl.TEL_URI_PROTOCOL)) {
telUrl = (TelURL) uri;
}
String phoneNumber;
if (telUrl.isGlobal()) {
phoneNumber = telUrl.getPhoneNumber();
} else {
String phoneContext;
if ((phoneContext = telUrl.getPhoneContext()) == null) {
throw new TelUrlResolverException("The local number is missing a phone-context: "+telUrl);
} else {
phoneNumber = normalize(telUrl.getPhoneNumber(), phoneContext);
if (phoneNumber == null) {
throw new TelUrlResolverException("Could not normalize the phone number: "+telUrl);
}
if (logger.isLoggable(Level.FINEST)) {