From f3abb0fb5754453b64718c0aa8683f859964a067 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Mon, 15 Nov 2021 09:51:44 +0200 Subject: [PATCH] Proper stack of the AVP list when running the dialog specific routes Fixes #2464 Credits go to Ben Newlin for reporting and assisting with the fixing. (cherry picked from commit 7193c5d8d86fa527433eab8c2c2af4b40a76e275) --- modules/dialog/dlg_handlers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index cf33b0dacc5..8eee0de183e 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -122,6 +122,8 @@ int run_dlg_script_route(struct dlg_cell *dlg, int rt_idx) static struct sip_msg* fake_msg= NULL; context_p old_ctx, *new_ctx; int old_route_type; + struct usr_avp **old_avps; + struct usr_avp *local_avps = NULL; /************* pre-run sequance ****************/ @@ -130,6 +132,8 @@ int run_dlg_script_route(struct dlg_cell *dlg, int rt_idx) return -1; } + old_avps = set_avp_list( &local_avps ); + swap_route_type(old_route_type, REQUEST_ROUTE); /************* actual run sequance ****************/ @@ -147,8 +151,9 @@ int run_dlg_script_route(struct dlg_cell *dlg, int rt_idx) context_destroy(CONTEXT_GLOBAL, *new_ctx); current_processing_ctx = old_ctx; - /* remove all added AVP - here we use all the time the default AVP list */ - reset_avps( ); + /* remove all added AVP and restore the original list */ + set_avp_list( old_avps ); + destroy_avp_list( &local_avps ); return 0; }