[mod_python3] Create an event on python_fetch()
This commit is contained in:
parent
f9a9c48d81
commit
3326f4ec57
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue