]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add lookup params to presence_map
authorMichael Jerris <mike@jerris.com>
Mon, 24 Oct 2011 13:53:24 +0000 (09:53 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 24 Oct 2011 13:53:24 +0000 (09:53 -0400)
src/switch_ivr.c

index 99fa2ff290953b9efa4ceba141a06ed54d3e0982..608e34d191e1d96c50453a6d8bd7d60654663712 100644 (file)
@@ -3142,17 +3142,29 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
        char *cf = "presence_map.conf";
        switch_xml_t cfg, xml, x_domains, x_domain, x_exten;
        char *r = NULL;
+       switch_event_t *params = NULL;
        switch_regex_t *re = NULL;
        int proceed = 0, ovector[100];
 
-       if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+       switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
+       switch_assert(params);
+
+       if ( !zstr(domain_name) ) {
+               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain_name);
+       }
+
+       if ( !zstr(exten_name) ) {
+               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "exten", exten_name);
+       }
+
+       if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
-               return NULL;
+               goto end;
        }
 
        if (!(x_domains = switch_xml_child(cfg, "domains"))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find any domains!\n");
-               return NULL;
+               goto end;
        }
 
        for (x_domain = switch_xml_child(x_domains, "domain"); x_domain; x_domain = x_domain->next) {
@@ -3179,7 +3191,8 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
        }
 
  end:
-       
+       switch_event_destroy(&params);
+
        if (xml) {
                switch_xml_free(xml);
        }