Skip to content

Commit

Permalink
b2b_logic: fix a bridging issue when using the 'peer' identifier
Browse files Browse the repository at this point in the history
Don't fail the bridging action when using the 'peer' identifier for the
b2b_bridge() function and the current entity is already deleted.

(cherry picked from commit 266e552)
  • Loading branch information
rvlad-patrascu committed Mar 30, 2023
1 parent 665715b commit 9f5e437
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions modules/b2b_logic/logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2434,9 +2434,13 @@ static struct b2bl_new_entity *get_ent_to_bridge(b2bl_tuple_t *tuple,
b2bl_entity_id_t *e;
int i;

if (cur_entity && !str_strcmp(ent_str, const_str("this"))) {
if (!str_strcmp(ent_str, const_str("this"))) {
if (!cur_entity) {
LM_ERR("Current entity not found anymore\n");
return NULL;
}
*old_ent = cur_entity;
} else if (cur_entity && !str_strcmp(ent_str, const_str("peer"))) {
} else if (!str_strcmp(ent_str, const_str("peer"))) {
*old_ent = b2bl_search_entity(tuple, &cur_route_ctx.peer_key,
cur_route_ctx.peer_type, &entity_head);
if(*old_ent == NULL)
Expand Down Expand Up @@ -2536,11 +2540,13 @@ int b2b_scenario_bridge(struct sip_msg *msg, str *br_ent1_str, str *br_ent2_str,

new_br_ent[0] = get_ent_to_bridge(tuple, entity, br_ent1_str, &e);


if (e)
old_entity = e;
else if (!new_br_ent[0])
else if (!new_br_ent[0]) {
LM_ERR("Failed to get entity to bridge: %.*s\n", br_ent1_str->len,
br_ent1_str->s);
goto done;
}

e = NULL;
new_br_ent[1] = get_ent_to_bridge(tuple, entity, br_ent2_str, &e);
Expand All @@ -2550,8 +2556,11 @@ int b2b_scenario_bridge(struct sip_msg *msg, str *br_ent1_str, str *br_ent2_str,
LM_ERR("At least one new client entity required for bridging\n");
else
old_entity = e;
} else if (!new_br_ent[1])
} else if (!new_br_ent[1]) {
LM_ERR("Failed to get entity to bridge: %.*s\n", br_ent2_str->len,
br_ent2_str->s);
goto done;
}

if (params->flags & B2BL_BR_FLAG_NOTIFY && entity)
process_bridge_notify(entity, cur_route_ctx.hash_index, NULL);
Expand Down

0 comments on commit 9f5e437

Please sign in to comment.