code: protected Response createNotifyResponse(RequestEvent request, int status, String reason,
        List<Header> additionalHeaders) {
      // when used internally - WATCH OUT - retcode, errorMessage initialized here
      initErrorInfo();
  
      if ((request == null) || (request.getRequest() == null)) {
        setReturnCode(SipSession.INVALID_ARGUMENT);
        setErrorMessage("Null request given for creating NOTIFY response");
        return null;
      }
  
      Request req = request.getRequest();
      String cseqStr = "CSEQ " + ((CSeqHeader) req.getHeader(CSeqHeader.NAME)).getSeqNumber();
      LOG.trace("Creating NOTIFY {} response with status code {}, reason phrase = {}", cseqStr,
          status, reason);
  
      try {
        Response response = parent.getMessageFactory().createResponse(status, req);
  
        if (reason != null) {
          response.setReasonPhrase(reason);
        }
  
        ((ToHeader) response.getHeader(ToHeader.NAME)).setTag(myTag);
  
        response.addHeader((ContactHeader) parent.getContactInfo().getContactHeader().clone());
  
        if (additionalHeaders != null) {
          Iterator<Header> i = additionalHeaders.iterator();
          while (i.hasNext()) {
            response.addHeader(i.next());
          }
        }
  
        return response;
      } catch (Exception e) {
        setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
        setException(e);
        setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage());
      }
  
      return null;
    }
docs: if returns null, returnCode and errorMessage already set