[mod_python3] Create an event on python_fetch()

This commit is contained in:
Adrian Fretwell 2023-01-24 15:14:29 +00:00 committed by GitHub
parent f9a9c48d81
commit 3326f4ec57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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(&params, 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;