/**
   * @see
   *     com.fjl.test.tools.sip.call.state.SipDialogState#handleInviteErrorResponse(com.fjl.test.tools.sip.call.SipDialog,
   *     javax.sip.ResponseEvent, com.fjl.test.tools.sip.SipEventListener)
   */
  @Override
  public void handleInviteErrorResponse(
      SipDialog sipDialog, ResponseEvent responseEvent, SipEventListener sipEventListener)
      throws SipClientStackException {
    logger.trace("ReInvitedState.handleInviteErrorResponse");
    boolean isDialogToBeClosed =
        SipTools.isErrorCodeCloseDialog(responseEvent.getResponse().getStatusCode());
    if (isDialogToBeClosed) {
      sipDialog.setSipDialogState(DialogState.CLOSED);
    } else {
      // remains in same state
    }

    sipEventListener.handleInviteErrorResponse(sipDialog.getCallId(), responseEvent);
  }
 /**
  * @see
  *     com.fjl.test.tools.sip.call.state.SipDialogState#sendInviteErrorResponse(com.fjl.test.tools.sip.call.SipDialog,
  *     javax.sip.ServerTransaction, int, java.util.Vector)
  */
 @Override
 public void sendInviteErrorResponse(
     SipDialog sipDialog,
     ServerTransaction serverTransaction,
     int statusCode,
     Vector<SipHeader> headers)
     throws SipClientStackException {
   logger.trace("ReInvitedState.sendInviteErrorResponse");
   sipDialog.createAndSendResponse(serverTransaction, statusCode, null, headers);
   boolean toBeClosed = SipTools.isErrorCodeCloseDialog(statusCode);
   if (toBeClosed) {
     sipDialog.setSipDialogState(DialogState.CLOSED);
   } else {
     sipDialog.setSipDialogState(DialogState.IN_CALL);
   }
 }