}
}
// logic to match the request.<headerName>.uri.resolve
if (name.endsWith(headerName + ".uri.resolve")) {
SipURI resolvedUri = dcrUtils.transformURI(dcrUtils.canonicalize(
header));
return (resolvedUri != null) ? resolvedUri.toString() : null;
}
// logic to match the request.<headerName>.uri.resolve.user
if (name.endsWith(headerName + ".uri.resolve.user")) {
URI canonicalizedUri = dcrUtils.canonicalize(header);
SipURI resolvedUri = dcrUtils.transformURI(canonicalizedUri);
String user;
if (resolvedUri != null) {
user = dcrUtils.getUserOrPhoneNumber(resolvedUri);
} else {
user = dcrUtils.getUserOrPhoneNumber(dcrUtils.normalize(
canonicalizedUri));
}
return user;
}
// logic to match the request.<headerName>.uri.resolve.host
if (name.endsWith(headerName + ".uri.resolve.host")) {
SipURI resolvedURI = dcrUtils.transformURI(dcrUtils.canonicalize(
header));
if (resolvedURI != null) {
return resolvedURI.getHost();
} else {
return null;
}
}
}
if (name.startsWith("parameter.")) {
StringTokenizer token = new StringTokenizer(name, ".");
int ntok = token.countTokens();
String[] elements = new String[ntok];
for (int i = 0; i < ntok; i++) {
elements[i] = token.nextToken();
}
String parameterName = null;
if (ntok > 0) {
parameterName = elements[1];
}
String parameterValue = request.getParameters()
.getParameter(parameterName);
// logic to match the parameter.<parameterName>
if (name.endsWith(elements[1])) {
return parameterValue;
}
// logic to match the parameter.<parameterName>.uri
if (name.endsWith(".uri")) {
return dcrUtils.canonicalize(parameterValue).toString();
}
// logic to match the parameter.<parameterName>.uri.user
if (name.endsWith(parameterName + ".uri.user")) {
String user = getUnresolvedUserPart(dcrUtils, parameterValue);
if (user != null) {
return user;
}
Matcher matcher = genericUriPattern.matcher(parameterValue);
if (matcher.find()) {
// Found matching user in regexp.
user = matcher.group(1);
if (user == null) {
user = matcher.group(2);
}
return user;
} else {
return null;
}
}
// logic to match the parameter.<parameterName>.uri.host
if (name.endsWith(parameterName + ".uri.host")) {
String host = getUnresolvedHostPart(dcrUtils, parameterValue);
if (host != null) {
return host;
}
Matcher matcher = genericUriPattern.matcher(parameterValue);
if (matcher.find()) {
// Found matching user in regexp.
host = matcher.group(3);
if (host == null) {
host = matcher.group(5);
}
return host;
} else {
return null;
}
}
// logic to match the parameter.<parameterName>.uri.resolve
if (name.endsWith(parameterName + ".uri.resolve")) {
SipURI transformedUri = dcrUtils.transformURI(dcrUtils.canonicalize(
parameterValue));
return (transformedUri != null) ? transformedUri.toString() : null;
}
// logic to match the parameter.<parameterName>.uri.resolve.user
// HH19522: we need to deal with multiple URIs and take the
// leftmost SIP URI if present, or the leftmost TEL URI otherwise
// Note that the format is proprietary param=uri_1,uri_2,..,uri_n
if (name.endsWith(parameterName + ".uri.resolve.user")) {
return dcrUtils.canonicalizeAndTransformMultiURIgetUser(parameterValue);
}
// logic to match the parameter.<parameterName>.resolve.host
if (name.endsWith(parameterName + ".uri.resolve.host")) {
SipURI resolvedURI = dcrUtils.transformURI(dcrUtils.canonicalize(
parameterValue));
if (resolvedURI != null) {
return resolvedURI.getHost();
} else {
return null;
}
}
}