Skip to content

Commit

Permalink
tm: proper cleanup for anycast CANCEL transactions
Browse files Browse the repository at this point in the history
Thanks go to Rizwan Syed and Jonathan Hulme from ConnexCS for reporting,
providing testing environment and support the troubleshooting and fix!

Close #3111

(cherry picked from commit 24ec4eb)
  • Loading branch information
razvancrainea committed Jul 6, 2023
1 parent ff1d906 commit cbfb959
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/tm/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,21 @@ int tm_anycast_replicate(struct sip_msg *msg)
*/
int tm_anycast_cancel(struct sip_msg *msg)
{
struct cell *t;
if (!tm_repl_auto_cancel || !tm_repl_cluster)
return -1;

if (!tm_existing_invite_trans(msg))
return tm_replicate_cancel(msg)? 0: -2;
else if (t_relay_to(msg, NULL, 0) < 0) {
t = get_cancelled_t();
if (t!=NULL && t!=T_UNDEFINED)
t_unref_cell(t);

if (t_relay_to(msg, NULL, 0) < 0) {
LM_ERR("cannot handle auto-CANCEL here - send to script!\n");
return -1;
}
t_unref(msg);

return 0;
}

0 comments on commit cbfb959

Please sign in to comment.