code: public SipServletResponse createResponseToOriginalRequest(
              SipSession session, int status, String reasonPhrase) {
  
          if (session == null) {
              throw new NullPointerException("Null arg");
          }
          final MobicentsSipSession sipSession = (MobicentsSipSession) session;
          if (!sipSession.isValidInternal()) {
              throw new IllegalArgumentException("sip session " + sipSession.getId() + " is invalid !");
          }
          final MobicentsSipServletMessage sipServletMessageImpl = getOriginalRequest(sipSession);
          if (!(sipServletMessageImpl instanceof SipServletRequestImpl)) {
              throw new IllegalStateException("session creating transaction message is not a request !");
          }
          final SipServletRequestImpl sipServletRequestImpl = (SipServletRequestImpl) sipServletMessageImpl;
          if (RoutingState.FINAL_RESPONSE_SENT.equals(sipServletRequestImpl.getRoutingState())) {
              // checked by TCK test com.bea.sipservlet.tck.agents.api.javax_servlet_sip.B2buaHelperTest.testCreateResponseToOriginalRequest101
              throw new IllegalStateException("subsequent response is inconsistent with an already sent response. a Final response has already been sent for this request " + sipServletRequestImpl);
          }
          if (logger.isDebugEnabled()) {
              logger.debug("creating response to original request " + sipServletRequestImpl + " on session " + session);
          }
  
          //set dialog from session in case is forked/derived
          //do this before creating response so proper toTag is selected
          SIPTransaction tx = (SIPTransaction) sipServletRequestImpl.getTransaction();
          SIPDialog newDialog = (SIPDialog)sipSession.getSessionCreatingDialog();
          if (newDialog != null && tx != null) {
              logger.debug("recovering dialog on transaction before send:" + System.identityHashCode(newDialog));
              tx.setDialog(newDialog, newDialog.getDialogId());
          }
  
          SipServletResponseImpl response = (SipServletResponseImpl) sipServletRequestImpl.createResponse(status, reasonPhrase);
  
  
  
  
  
          return response;
      }
docs: /*
  (non-Javadoc)
  @see javax.servlet.sip.B2buaHelper#createResponseToOriginalRequest(javax.servlet.sip.SipSession, int, java.lang.String)