public void onTransactionCreate(final TransactionBuildUpEvent<BaseSipMessage> event) { assert SIP_REINVITE_CLIENT == event.getTransaction().getTransactionType(); Dialog dialog = (Dialog) event.getEntity(); final Transaction<Boolean, BaseSipMessage> transaction = event.getTransaction(); // DIALOG.putCustomParameter(Dialog.ParamKey.REINVITE_IN_PROGRESS, Boolean.TRUE); dialog.markReInviteInProgress(InitiateParty.LOCAL); // listener will un-subscribe automatically on transaction complete transaction.addListener(new AuthChallengeListener<BaseSipMessage>(transaction, dialog)); // listener will un-subscribe automatically on transaction complete transaction.addListener( new MiddleManForClientMessageBuildingSupport<BaseSipMessage>(transaction, dialog)); // listener will un-subscribe automatically on transaction complete transaction.addListener( new ReInviteStateMiddleMan<BaseSipMessage>( transaction, dialog, dialogStateListenerHolder) { protected void onDialogCleanUp(final Dialog dialog) { getStackContext().getDialogStorage().cleanUpDialog(dialog); } }); // listener will un-subscribe automatically on transaction complete transaction.addListener( new ReinviteInProgressListener<BaseSipMessage>( transaction, dialog, InitiateParty.LOCAL)); }
public void handleIncomingReInvite(final Request msg) throws DialogStateException { assert TransactionUtils.isTransactionExecutionThread() : "Code run in wrong thread. Must be run in TransactionThread. Now in " + Thread.currentThread(); assert !done.get(); assert msg != null && MessageType.SIP_INVITE == MessageType.parse(msg.getMethod()); if (!done.get()) { Logger.log("Remote party has sent ReInvite"); final Dialog dialog = getStackContext().getDialogStorage().findDialogForMessage(msg); assert dialog != null; checkReInvitePreconditions(dialog, msg); dialog.markReInviteInProgress(InitiateParty.REMOTE); TransactionType<InviteSrvTransaction, ? extends ServerCommonInviteTransaction> transactionType = SIP_REINVITE_SERVER; doHandleIncomingInvite(msg, dialog, transactionType); } }