From 3326f4ec577ba692158d45a0efddcb925d82180d Mon Sep 17 00:00:00 2001 From: Adrian Fretwell Date: Tue, 24 Jan 2023 15:14:29 +0000 Subject: [PATCH] [mod_python3] Create an event on python_fetch() --- src/mod/languages/mod_python3/mod_python3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index 52a3312361..ca05f18710 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -354,12 +354,24 @@ static switch_xml_t python_fetch(const char *section, switch_xml_t xml = NULL; char *str = NULL; + switch_event_t *my_params = NULL; if (!zstr(globals.xml_handler)) { char *mycmd = strdup(globals.xml_handler); switch_assert(mycmd); + if (!params) { + switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(params); + my_params = params; + } + + switch_event_add_header_string(params, SWITCH_STACK_TOP, "section", switch_str_nil(section)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "tag_name", switch_str_nil(tag_name)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_name", switch_str_nil(key_name)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_value", switch_str_nil(key_value)); + eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL); if (str) { @@ -372,6 +384,10 @@ static switch_xml_t python_fetch(const char *section, } free(mycmd); + + if (my_params) { + switch_event_destroy(&my_params); + } } return xml;