private void doPreAccept(final Dialog dialog) {
    assert TransactionUtils.isTransactionExecutionThread()
        : "Code run in wrong thread. Must be run in TransactionThread. Now in "
            + Thread.currentThread();
    assert !done.get();

    TransactionType<InviteSrvTransaction, ? extends ServerCommonInviteTransaction> transactionType;

    if (dialog.isReInviteInProgress()) {
      transactionType = SIP_REINVITE_SERVER;
    } else {
      transactionType = SIP_INVITE_SERVER;
    }

    getTransactionManager().findTransaction(dialog, transactionType).preAccept();
  }
 private void checkReInvitePreconditions(final Dialog dialog, final Request msg)
     throws DialogStateException {
   if (EARLY == dialog.getState()) {
     throw new DialogStateException(
         dialog,
         REINVITE_FOR_EARLY_DIALOG,
         msg,
         "Can not update (reinvite) DIALOG. Dialog is not stated yet. Dialog  state is "
             + dialog.getState());
   }
   if (dialog.isReInviteInProgress()) {
     throw new DialogStateException(
         dialog,
         REINVITE_DURING_PREVIOUS_REINVITE,
         msg,
         "Can not update (reinvite) DIALOG. Previous reinvite still in progress.");
   }
 }
  /**
   * Rejects server invite
   *
   * @param dialog - associated DIALOG
   * @param statusCode - status code to send to remote party
   * @param alternativeUserAddress - alternative USER address for status code 302(Moved)
   */
  private void doReject(
      final Dialog dialog, final int statusCode, final String alternativeUserAddress) {
    assert TransactionUtils.isTransactionExecutionThread()
        : "Code run in wrong thread. Must be run in TransactionThread. Now in "
            + Thread.currentThread();
    assert !done.get();

    TransactionType<InviteSrvTransaction, ? extends ServerCommonInviteTransaction> transactionType;
    if (dialog.isReInviteInProgress()) {
      transactionType = SIP_REINVITE_SERVER;
    } else {
      transactionType = SIP_INVITE_SERVER;
    }

    assert transactionType == SIP_INVITE_SERVER || statusCode == 488;

    getTransactionManager()
        .findTransaction(dialog, transactionType)
        .reject(statusCode, alternativeUserAddress);
  }
  private void doAcceptUpdate(final Dialog dialog) {
    assert TransactionUtils.isTransactionExecutionThread()
        : "Code run in wrong thread. Must be run in TransactionThread. Now in "
            + Thread.currentThread();
    assert !done.get();

    if (dialog.isReInviteInProgress() || dialog.isUpdateInProgress()) {
      // transactionType = SIP_REINVITE_SERVER;
      TransactionType<UpdateSrvTransaction, UpdateServerTransaction> transactionType =
          SIP_UPDATE_SERVER;
      getTransactionManager().findTransaction(dialog, transactionType).accept();
    } else {
      TransactionType<InviteSrvTransaction, ? extends ServerCommonInviteTransaction>
          transactionType = SIP_INVITE_SERVER;
      getTransactionManager().findTransaction(dialog, transactionType).acceptUpdate();
    }

    /*        if (dialog.getInitiateParty() == InitiateParty.LOCAL) {
                getTransactionManager().findTransaction(dialog, SIP_INVITE_CLIENT).acceptUpdate();
            }
            else {
                getTransactionManager().findTransaction(dialog, SIP_INVITE_SERVER).acceptUpdate();
            }
    */ }