code: public void sendResponse(Response arg0) throws SipException, InvalidArgumentException {
  
          validateWrappedTransaction();
  
          final Dialog d = wrappedTransaction.getDialog();
          if (d != null) {
              final DialogWrapper dw = ra.getDialogWrapper(d);
              if (dw != null) {
                  final int statusCode = arg0.getStatusCode();
                  if (this.getRequest().getMethod().equals(Request.CANCEL) && (statusCode < 300 && statusCode > 199) && dw.getState() == null) {
                      dw.delete();
                  } else if (d.getLocalTag() == null) {
                      // a new dialog which local tag is not yet known by jain sip stack, add the tag to the response 
                      try {
                          ((ToHeader) arg0.getHeader(ToHeader.NAME)).setTag(dw.getLocalTag());
                      } catch (ParseException e) {
                          throw new SipException(e.getMessage(), e);
                      }
                  }
              }
          }
  
          if (tracer.isInfoEnabled()) {
              tracer.info(toString() + " sending response:\n" + arg0);
          }
          wrappedTransaction.sendResponse(arg0);
      }
docs: /*
  (non-Javadoc)
  @see javax.sip.ServerTransaction#sendResponse(javax.sip.message.Response)