Interface of a DCR-plugin that can be loaded into DCR using the DCR plug-in framework.
The following is an example of an implementation:
public class ExampleDcrPlugin implements DcrPlugin { @Override public String getKey(SipServletRequest request, SipFactory sipFactory, UriTools uriTools, TelUrlResolver telUrlResolver) { URI uri; if (request.getMethod().toUpperCase().equals("REGISTER")) { String header = request.getHeader("My-Header"); try { uri = sipFactory.createURI(header); } catch (ServletParseException e) { uri = request.getRequestURI(); } } else { uri = request.getRequestURI(); } URI canonicalizedUri = uriTools.canonicalize(uri); if (canonicalizedUri.isSipURI()) { SipURI resolvedUri; try { resolvedUri = telUrlResolver.lookupSipURI(canonicalizedUri); } catch (IOException e) { return null; } catch (TelUrlResolverException e) { return null; } return resolvedUri.getUser() + "@" + resolvedUri.getHost(); } else { return canonicalizedUri.toString(); } } @Override public String getKey(HttpServletRequest request, SipFactory sipFactory, UriTools uriTools, TelUrlResolver telUrlResolver) { return request.getRequestURL().toString(); } }