From db624a13f68823c19c45db9edb95d42bca113fd0 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 23 Oct 2024 16:48:28 +0300 Subject: [PATCH] b2b_logic: always terminate a bridge initiator Before this commit, only if the `notify` flag was used, the entity would have been deleted. (cherry picked from commit aff2d963126f097411753d699239bc938479c892) --- modules/b2b_logic/bridging.c | 4 +--- modules/b2b_logic/logic.c | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/b2b_logic/bridging.c b/modules/b2b_logic/bridging.c index 1bca4a2377d..46e2b174de6 100644 --- a/modules/b2b_logic/bridging.c +++ b/modules/b2b_logic/bridging.c @@ -1117,9 +1117,7 @@ int b2b_script_bridge(struct sip_msg *msg, str *br_ent1_str, str *br_ent2_str, goto done; } - if ((params->flags & B2BL_BR_FLAG_NOTIFY || - params->flags & B2BL_BR_FLAG_RETURN_AFTER_FAILURE) && entity) - tuple->bridge_initiator = entity; + tuple->bridge_initiator = entity; cur_route_ctx.flags |= B2BL_RT_DO_UPDATE; diff --git a/modules/b2b_logic/logic.c b/modules/b2b_logic/logic.c index dd0716a2063..8909bc0d3a3 100644 --- a/modules/b2b_logic/logic.c +++ b/modules/b2b_logic/logic.c @@ -905,9 +905,10 @@ int _b2b_handle_reply(struct sip_msg *msg, b2bl_tuple_t *tuple, /* Reply from new bridge entity */ if(statuscode >= 200 && entity == (tuple->bridge_entities[2]?tuple->bridge_entities[2]:tuple->bridge_entities[1]) && - tuple->bridge_flags & B2BL_BR_FLAG_NOTIFY && tuple->bridge_initiator != 0) + tuple->bridge_initiator != 0) { - send_bridge_notify(tuple->bridge_initiator, cur_route_ctx.hash_index, msg); + if (tuple->bridge_flags & B2BL_BR_FLAG_NOTIFY) + send_bridge_notify(tuple->bridge_initiator, cur_route_ctx.hash_index, msg); if(statuscode == 200 || !(tuple->bridge_flags & B2BL_BR_FLAG_RETURN_AFTER_FAILURE)) { if (!(tuple->bridge_flags & B2BL_BR_FLAG_DONT_DELETE_BRIDGE_INITIATOR)) {