diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index a894b8ec7f..e46ca39a57 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2821,7 +2821,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p const char *read_id = NULL; const char *caller_id_name = NULL; const char *caller_id_number = NULL; - switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params = NULL, x_param = NULL; + switch_xml_t x_user = NULL, x_params = NULL, x_param = NULL; switch_event_t *vars = NULL; const char *vm_cc = NULL, *vtmp, *vm_ext = NULL; int disk_quota = 0; @@ -2845,22 +2845,15 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p int ok = 1; switch_event_t *locate_params = NULL; const char *email_addr = NULL; - char *x; - + switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(locate_params); - if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"), - &x_domain_root, &x_domain, &x_user, NULL, locate_params) == SWITCH_STATUS_SUCCESS) { + if (switch_xml_locate_user_merged("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"), + &x_user, locate_params) == SWITCH_STATUS_SUCCESS) { id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id")); - x = switch_xml_toxml(x_user, SWITCH_FALSE); - x_user = switch_xml_parse_str_dynamic(x, SWITCH_FALSE); - x_domain = NULL; - switch_xml_free(x_domain_root); - x_domain_root = NULL; - if ((x_params = switch_xml_child(x_user, "params"))) { for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { const char *var = switch_xml_attr_soft(x_param, "name"); diff --git a/src/switch_xml.c b/src/switch_xml.c index 234eaf0181..3c8bf76833 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1781,7 +1781,8 @@ static void do_merge(switch_xml_t in, switch_xml_t src, const char *container, c if (go) { iitag = switch_xml_add_child_d(itag, tag_name, 0); - switch_xml_set_attr_d(iitag, var, val); + switch_xml_set_attr_d(iitag, "name", var); + switch_xml_set_attr_d(iitag, "value", val); } } } @@ -1808,6 +1809,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, c x_user_dup = switch_xml_dup(x_user); switch_xml_merge_user(x_user_dup, domain, group); *user = x_user_dup; + switch_xml_free(xml); } return status;