Skip to content

Commit

Permalink
b2b_logic: properly reset the current tuple in all cases
Browse files Browse the repository at this point in the history
The global variable used to identify the current tuple in the local_route was
not properly reset in all cases (when retrying a birdge action for example).
This could lead to a failure to identify the current tuple when acessing
the $b2b_logic variables, the b2b logic context etc., even when we're
not in the context of a local_route.

(cherry picked from commit 92772e6)
  • Loading branch information
rvlad-patrascu committed Jul 4, 2023
1 parent 98919c9 commit 5c51a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions modules/b2b_logic/bridging.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ mi_response_t *mi_b2b_bridge(const mi_params_t *params,
b2bl_htable[hash_index].locked_by = process_no;
b2b_api.send_request(&req_data);
b2bl_htable[hash_index].locked_by = -1;

local_ctx_tuple = NULL;
} else {
if (bridging_start_new_ent(tuple, bridging_entity, entity, NULL, NULL, 0) < 0) {
LM_ERR("Failed to start bridging with new entity\n");
Expand All @@ -245,6 +243,8 @@ mi_response_t *mi_b2b_bridge(const mi_params_t *params,

tuple->state = B2B_BRIDGING_STATE;

local_ctx_tuple = NULL;

b2bl_htable[hash_index].locked_by = -1;;
lock_release(&b2bl_htable[hash_index].lock);

Expand Down Expand Up @@ -1266,6 +1266,8 @@ int b2b_script_bridge_retry(struct sip_msg *msg, str *new_ent_str)
goto error;
}

local_ctx_tuple = NULL;

lock_release(&b2bl_htable[cur_route_ctx.hash_index].lock);

return 1;
Expand Down
2 changes: 1 addition & 1 deletion modules/b2b_logic/logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2904,7 +2904,7 @@ str* b2b_process_scenario_init(struct sip_msg* msg, b2bl_cback_f cbf,

if (get_new_entities(&e1, &e2) < 0) {
LM_ERR("Failed to get new bridging entities from context\n");
return NULL;
goto error;
}

if (!e1 && !e2) {
Expand Down

0 comments on commit 5c51a8e

Please sign in to comment.