add lookup params to presence_map

This commit is contained in:
Michael Jerris 2011-10-24 09:53:24 -04:00
parent 4841670777
commit ea7f6a1857
1 changed files with 17 additions and 4 deletions

View File

@ -3142,17 +3142,29 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
char *cf = "presence_map.conf"; char *cf = "presence_map.conf";
switch_xml_t cfg, xml, x_domains, x_domain, x_exten; switch_xml_t cfg, xml, x_domains, x_domain, x_exten;
char *r = NULL; char *r = NULL;
switch_event_t *params = NULL;
switch_regex_t *re = NULL; switch_regex_t *re = NULL;
int proceed = 0, ovector[100]; 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); 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"))) { if (!(x_domains = switch_xml_child(cfg, "domains"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find any domains!\n"); 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) { for (x_domain = switch_xml_child(x_domains, "domain"); x_domain; x_domain = x_domain->next) {
@ -3179,6 +3191,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
} }
end: end:
switch_event_destroy(&params);
if (xml) { if (xml) {
switch_xml_free(xml); switch_xml_free(xml);