this.setState(TransactionState.TERMINATED);
} else {
    public void processRequest(SIPRequest transactionRequest,            MessageChannel sourceChannel) {        boolean toTu = false;        // Can only process a single request directed to the        // transaction at a time.        if (this.eventPending) {            synchronized (this.pendingRequests) {                if (this.pendingRequests.size() < 4)                    this.pendingRequests.add(new PendingRequest(                            transactionRequest, sourceChannel));            }            sipStack.putPending(this);            return;        }        try {            // If this is the first request for this transaction,            if (getRealState() == null) {                // Save this request as the one this                // transaction is handling                setOriginalRequest(transactionRequest);                this.setState(TransactionState.TRYING);                toTu = true;                if (isInviteTransaction() && this.isMapped) {                    // Has side-effect of setting                    // state to "Proceeding"                    sendMessage(transactionRequest                            .createResponse(100, "Trying"));                }                // If an invite transaction is ACK'ed while in                // the completed state,            } else if (isInviteTransaction()                    && TransactionState.COMPLETED == getRealState()                    && transactionRequest.getMethod().equals(Request.ACK)) {                this.setState(TransactionState.CONFIRMED);                disableRetransmissionTimer();                if (!isReliable()) {                	// bug fix by jvB                        enableTimeoutTimer(TIMER_I);                } else {                    this.setState(TransactionState.TERMINATED);                }                // Application should not Ack in CONFIRMED state                // Bug (and fix thereof) reported by Emil Ivov                return;                // If we receive a retransmission of the original                // request,            } else if (transactionRequest.getMethod().equals(                    getOriginalRequest().getMethod())) {                if (TransactionState.PROCEEDING == getRealState()                        || TransactionState.COMPLETED == getRealState()) {                    // Resend the last response to                    // the client                    if (lastResponse != null) {                        try {                            // Send the message to the client                            super.sendMessage(lastResponse);                        } catch (IOException e) {                            this.setState(TransactionState.TERMINATED);                            throw e;                        }                    }                } else if (transactionRequest.getMethod().equals(Request.ACK)                        && requestOf != null) {                    // null check bug fix by Emil Ivov                    // This is passed up to the TU to suppress                    // retransmission of OK                    requestOf.processRequest(transactionRequest, this);                }                return;            }            // Pass message to the TU            if (TransactionState.COMPLETED != getRealState()                    && TransactionState.TERMINATED != getRealState()                    && requestOf != null) {                if (getOriginalRequest().getMethod().equals(                        transactionRequest.getMethod())) {                    // Only send original request to TU once!                    if (toTu)                        requestOf.processRequest(transactionRequest, this);                } else {                    if (requestOf != null)                        requestOf.processRequest(transactionRequest, this);                }            } else {                // This seems like a common bug so I am allowing it through!                if (((SIPTransactionStack) getSIPStack())                        .isDialogCreated(getOriginalRequest().getMethod())                        && getRealState() == TransactionState.TERMINATED                        && transactionRequest.getMethod().equals(Request.ACK)                        && requestOf != null) {                    SIPDialog thisDialog = (SIPDialog) this.dialog;                    thisDialog.ackReceived(transactionRequest);                    if (((SIPTransactionStack) getSIPStack()).retransmissionFilter) {                        if (!thisDialog.ackProcessed) {                            // Filter out duplicate acks if retransmission                            // filter                            // is enabled.                            thisDialog.ackProcessed = true;                            requestOf.processRequest(transactionRequest, this);                        }                    } else {                        // Duplicate ACKs are seen by the application.                        if (requestOf != null)                            requestOf.processRequest(transactionRequest, this);                    }                } else if (transactionRequest.getMethod()                        .equals(Request.CANCEL)) {                    if (LogWriter.needsLogging)                        sipStack.logWriter                                .logMessage("Too late to cancel Transaction");                    // send OK and just ignore the CANCEL.                    try {                        this.sendMessage(transactionRequest                                .createResponse(Response.OK));                    } catch (IOException ex) {                        // Transaction is already terminated                        // just ignore the IOException.                    }                }                sipStack.logWriter.logMessage("Dropping request "                        + getRealState());            }        } catch (IOException e) {            raiseErrorEvent(SIPTransactionErrorEvent.TRANSPORT_ERROR);        }    }