Skip to content

Commit

Permalink
[async] fix setting restoring type route after running report route f…
Browse files Browse the repository at this point in the history
…or launch()

Fixes #3034

(cherry picked from commit c0af4fe)
  • Loading branch information
bogdan-iancu committed Mar 17, 2023
1 parent 697c325 commit 49dc295
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions async.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ int async_launch_resume(int fd, void *param)
{
struct sip_msg *req;
async_launch_ctx *ctx = (async_launch_ctx *)param;
int bk_rt;

LM_DBG("resume for a launch job\n");

Expand Down Expand Up @@ -244,13 +245,14 @@ int async_launch_resume(int fd, void *param)
" route <%s>, param [%.*s]\n",
sroutes->request[ctx->report_route].name,
ctx->report_route_param.len, ctx->report_route_param.s);
set_route_type( REQUEST_ROUTE );
if (ctx->report_route_param.s)
route_params_push_level(
sroutes->request[ctx->report_route].name,
&ctx->report_route_param, NULL,
launch_route_param_get);
swap_route_type( bk_rt, REQUEST_ROUTE);
run_top_route( sroutes->request[ctx->report_route], req);
set_route_type( bk_rt );
if (ctx->report_route_param.s)
route_params_pop_level();

Expand All @@ -277,6 +279,7 @@ int async_script_launch(struct sip_msg *msg, struct action* a,
struct usr_avp *report_avps = NULL, **bak_avps = NULL;
async_launch_ctx *ctx;
int fd = -1;
int bk_rt;

/* run the function (the action) and get back from it the FD,
* resume function and param */
Expand Down Expand Up @@ -374,11 +377,12 @@ int async_script_launch(struct sip_msg *msg, struct action* a,
return -1;
}

set_route_type( REQUEST_ROUTE );
bak_avps = set_avp_list(&report_avps);
swap_route_type( bk_rt, REQUEST_ROUTE);

run_top_route( sroutes->request[report_route], req);

set_route_type( bk_rt );
destroy_avp_list(&report_avps);
set_avp_list(bak_avps);

Expand Down

0 comments on commit 49dc295

Please sign in to comment.