]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11982 [mod_kazoo] add expand-headers-on-fetch
authorlazedo <luis.azedo@factorlusitano.com>
Mon, 5 Aug 2019 15:40:42 +0000 (15:40 +0000)
committerlazedo <luis.azedo@factorlusitano.com>
Mon, 5 Aug 2019 15:40:42 +0000 (15:40 +0000)
src/mod/event_handlers/mod_kazoo/kazoo_ei.h
src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c
src/mod/event_handlers/mod_kazoo/kazoo_fetch_agent.c

index 3d844655b79e83fd572eaaa62ff5b4cf84c2a468..b28a888978b1be0d2822d4ee3b8de86b600de558 100644 (file)
@@ -205,6 +205,7 @@ struct globals_s {
 
        int legacy_events;
        uint8_t tweaks[KZ_TWEAK_MAX];
+       switch_bool_t expand_headers_on_fetch;
 
 
 };
index 9357211afb7e0c7228acf737886039381a68a7fe..0d2b95a8c23e8a5fbd6f15df6bea2d2fa56f3fa7 100644 (file)
@@ -203,6 +203,9 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) {
                        } else if (!strcmp(var, "legacy-events")) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set legacy-events: %s\n", val);
                                kazoo_globals.legacy_events = switch_true(val);
+                       } else if (!strcmp(var, "expand-headers-on-fetch")) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set expand-headers-on-fetch: %s\n", val);
+                               kazoo_globals.expand_headers_on_fetch = switch_true(val);
                        }
                }
        }
index 24d4358b7e2e9c9b3c500c6cc5e5574befce7a47..555fe942bfd954cf02df3698dcea4fa1c7ecc621 100644 (file)
@@ -301,7 +301,9 @@ static switch_xml_t fetch_handler(const char *section, const char *tag_name, con
        /* after all that did we get what we were after?! */
        if (reply.xml_str) {
                /* HELL YA WE DID */
-               reply.xml_str = expand_vars(reply.xml_str);
+               if (kazoo_globals.expand_headers_on_fetch) {
+                       reply.xml_str = expand_vars(reply.xml_str);
+               }
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received %s XML (%s) after %dms: %s\n"
                                                  ,section
                                                  ,reply.uuid_str