Example #1
0
  /** @see Proxy#proxyTo(List) */
  public void proxyTo(List<? extends URI> targets) {

    for (URI uri : targets) {
      if (!uri.isSipURI() && getOriginalRequest().getHeader(SipHeaders.ROUTE) == null)
        throw new IllegalArgumentException("Cannot route " + uri);
      addBranch(uri);
    }
    startProxy();
  }
Example #2
0
  protected Branch addTarget(URI uri) {
    URI target = uri.clone();
    if (target.isSipURI()) {
      SipURI sipUri = (SipURI) target;
      sipUri.removeParameter("method");
      Iterator<String> it = sipUri.getHeaderNames();
      while (it.hasNext()) {
        it.remove();
      }
    }
    if (isInTargetSet(target)) {
      if (LOG.isDebugEnabled()) LOG.debug("target {} is already in target set", target);
      return null;
    } else {
      if (LOG.isDebugEnabled()) LOG.debug("adding target {} to target set", target);

      Branch branch = new Branch(target);
      _targets = LazyList.add(_targets, branch);
      return branch;
    }
  }