/** @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();
  }
Exemple #2
0
	@Override
	public boolean equals(Object o)
	{
		if (o == null || !(o instanceof URI))
			return false;
		URI uri = (URI) o;
		if (!_scheme.equals(uri.getScheme()))
			return false;
		
		// FIXME improve equals
		if (!toString().equals(uri.toString()))
			return false;
		
		return true;
			
	}
  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;
    }
  }
 public void testParams() throws Exception {
   URI uri = sipFactory.createURI("sip:127.0.0.1:5080");
   uri.setParameter("Key", "val");
   String s = uri.toString();
   assertEquals("sip:127.0.0.1:5080;Key=val", s);
 }