Skip to content

Commit

Permalink
b2b_entities: reject overlapping BYE when uac is pending
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Oct 13, 2023
1 parent 5449d94 commit 9bc2024
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions modules/b2b_entities/dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,34 +1177,18 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam)
{
/* We have an UAC ongoing transaction in the dialog
* -> reject with 491 Request Pending */
if (method_value != METHOD_BYE) {
/* send reply */
LM_DBG("Received a request while having an ongoing "
"outbound/UAC one\n");
str text = str_init("Request Pending");
if(tmb.t_reply_with_body( tm_tran, 491,
&text, 0, 0, &to_tag) < 0)
{
LM_ERR("failed to send reply with tm\n");
}
LM_DBG("Sent reply [491] and unreffed the cell %p\n",
tm_tran);
} else {
LM_DBG("Received BYE while having an ongoing "
"outbound/UAC transaction\n");
str text_ok = str_init("OK");
if(tmb.t_reply_with_body( tm_tran, 200,
&text_ok, 0, 0, &to_tag) < 0)
{
LM_ERR("failed to send reply with tm\n");
}
LM_DBG("Sent reply [200] and unreffed the cell %p\n",
tm_tran);

tmb.unref_cell(tm_tran); /* for t_newtran() */
b2b_cb_flags |= B2B_NOTIFY_FL_TERM_BYE;
goto run_cb;
/* send reply */
LM_DBG("Received a request while having an ongoing "
"outbound/UAC one\n");
str text = str_init("Request Pending");
if(tmb.t_reply_with_body( tm_tran, 491,
&text, 0, 0, &to_tag) < 0)
{
LM_ERR("failed to send reply with tm\n");
}
LM_DBG("Sent reply [491] and unreffed the cell %p\n",
tm_tran);

tmb.unref_cell(tm_tran); /* for t_newtran() */
B2BE_LOCK_RELEASE(table, hash_index);
return SCB_DROP_MSG;
Expand Down

0 comments on commit 9bc2024

Please sign in to comment.