|
@@ -106,10 +106,10 @@ int t_suspend(struct sip_msg *msg,
|
|
* - failure route to be executed if the branch is not continued
|
|
* - failure route to be executed if the branch is not continued
|
|
* before timeout */
|
|
* before timeout */
|
|
t->uac[t->async_backup.blind_uac].on_failure = t->on_failure;
|
|
t->uac[t->async_backup.blind_uac].on_failure = t->on_failure;
|
|
|
|
+ t->flags |= T_ASYNC_SUSPENDED;
|
|
} else {
|
|
} else {
|
|
LM_DBG("this is a suspend on reply - setting msg flag to SUSPEND\n");
|
|
LM_DBG("this is a suspend on reply - setting msg flag to SUSPEND\n");
|
|
msg->msg_flags |= FL_RPL_SUSPENDED;
|
|
msg->msg_flags |= FL_RPL_SUSPENDED;
|
|
- t->flags |= T_ASYNC_SUSPENDED;
|
|
|
|
/* this is a reply suspend find which branch */
|
|
/* this is a reply suspend find which branch */
|
|
|
|
|
|
if (t_check( msg , &branch )==-1){
|
|
if (t_check( msg , &branch )==-1){
|
|
@@ -131,6 +131,7 @@ int t_suspend(struct sip_msg *msg,
|
|
|
|
|
|
LM_DBG("saving transaction data\n");
|
|
LM_DBG("saving transaction data\n");
|
|
t->uac[branch].reply->flags = msg->flags;
|
|
t->uac[branch].reply->flags = msg->flags;
|
|
|
|
+ t->flags |= T_ASYNC_SUSPENDED;
|
|
}
|
|
}
|
|
|
|
|
|
*hash_index = t->hash_index;
|
|
*hash_index = t->hash_index;
|
|
@@ -176,7 +177,13 @@ int t_continue(unsigned int hash_index, unsigned int label,
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!(t->flags & T_ASYNC_SUSPENDED)) {
|
|
|
|
+ LM_ERR("transaction is not suspended [%u:%u]\n", hash_index, label);
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (t->flags & T_CANCELED) {
|
|
if (t->flags & T_CANCELED) {
|
|
|
|
+ t->flags &= ~T_ASYNC_SUSPENDED;
|
|
/* The transaction has already been canceled,
|
|
/* The transaction has already been canceled,
|
|
* needless to continue */
|
|
* needless to continue */
|
|
UNREF(t); /* t_unref would kill the transaction */
|
|
UNREF(t); /* t_unref would kill the transaction */
|
|
@@ -219,6 +226,7 @@ int t_continue(unsigned int hash_index, unsigned int label,
|
|
/* Either t_continue() has already been
|
|
/* Either t_continue() has already been
|
|
* called or the branch has already timed out.
|
|
* called or the branch has already timed out.
|
|
* Needless to continue. */
|
|
* Needless to continue. */
|
|
|
|
+ t->flags &= ~T_ASYNC_SUSPENDED;
|
|
UNLOCK_ASYNC_CONTINUE(t);
|
|
UNLOCK_ASYNC_CONTINUE(t);
|
|
UNREF(t); /* t_unref would kill the transaction */
|
|
UNREF(t); /* t_unref would kill the transaction */
|
|
return 1;
|
|
return 1;
|
|
@@ -444,12 +452,14 @@ done:
|
|
t->uac[branch].reply = 0;
|
|
t->uac[branch].reply = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- t->flags &= ~T_ASYNC_SUSPENDED; /*This transaction is no longer suspended so unsetting the SUSPEND flag*/
|
|
|
|
|
|
+ /*This transaction is no longer suspended so unsetting the SUSPEND flag*/
|
|
|
|
+ t->flags &= ~T_ASYNC_SUSPENDED;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
kill_trans:
|
|
kill_trans:
|
|
|
|
+ t->flags &= ~T_ASYNC_SUSPENDED;
|
|
/* The script has hopefully set the error code. If not,
|
|
/* The script has hopefully set the error code. If not,
|
|
* let us reply with a default error. */
|
|
* let us reply with a default error. */
|
|
if ((kill_transaction_unsafe(t,
|
|
if ((kill_transaction_unsafe(t,
|