code: public boolean sendUnidirectionalResponse(RequestEvent request, int statusCode,
        String reasonPhrase, String toTag, Address contact, int expires) {
      initErrorInfo();
  
      if ((request == null) || (request.getRequest() == null)) {
        setErrorMessage("Cannot send response, request information is null");
        setReturnCode(INVALID_ARGUMENT);
        return false;
      }
  
      Response response;
  
      try {
        response = parent.getMessageFactory().createResponse(statusCode, request.getRequest());
  
        if (reasonPhrase != null) {
          response.setReasonPhrase(reasonPhrase);
        }
  
        if (toTag != null) {
          ((ToHeader) response.getHeader(ToHeader.NAME)).setTag(toTag);
        }
  
        if (contact != null) {
          response.addHeader(parent.getHeaderFactory().createContactHeader(contact));
        }
  
        if (expires != -1) {
          response.addHeader(parent.getHeaderFactory().createExpiresHeader(expires));
        }
  
      } catch (Exception ex) {
        setException(ex);
        setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
        setReturnCode(EXCEPTION_ENCOUNTERED);
        return false;
      }
  
      return sendUnidirectionalResponse(response);
    }
docs: This method sends out a stateless response to the given request.
  
  @param request The RequestEvent object that contains the request we are responding to.
  @param statusCode The status code of the response to send (may use SipResponse constants).
  @param reasonPhrase If not null, the reason phrase to send.
  @param toTag If not null, it will be put into the 'To' header of the response. Required by
  final responses such as OK.
  @param contact If not null, it will be used to create a 'Contact' header to be added to the
  response.
  @param expires If not -1, an 'Expires' header is added to the response containing this value,
  which is the time the message is valid, in seconds.
  @return True if the response was successfully sent, false otherwise.