Beispiel #1
0
  public SipProxy(SipRequest request) throws TooManyHopsException {
    _tx = (ServerTransaction) request.getTransaction();
    _tx.setListener(this);

    int maxForwards = request.getMaxForwards();
    if (maxForwards == 0) throw new TooManyHopsException();
    else if (maxForwards == -1) request.setMaxForwards(70);

    if (LOG.isDebugEnabled()) LOG.debug("Created proxy for tx {}", _tx, null);
  }
Beispiel #2
0
  public void handleCancel(ServerTransaction tx, SipRequest cancel) {
    cancel.setSession(_tx.getRequest().session());
    SipResponse response = new SipResponse(cancel, SipServletResponse.SC_OK, null);
    ((ServerTransaction) cancel.getTransaction()).send(response);

    cancel();
    try {
      if (!_started) // case no request has not been proxied
      _tx.getRequest().createResponse(SipServletResponse.SC_REQUEST_TERMINATED).send();

      cancel.session().invokeServlet(cancel);
    } catch (Exception e) {
      LOG.debug(e);
    }
  }