]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix vm to inherit params from domain/group
authorBrian West <brian@freeswitch.org>
Mon, 15 Feb 2010 17:40:13 +0000 (17:40 +0000)
committerBrian West <brian@freeswitch.org>
Mon, 15 Feb 2010 17:40:13 +0000 (17:40 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16644 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_voicemail/mod_voicemail.c
src/switch_xml.c

index a894b8ec7f56ea8681d9f3c758842ea93c8f83da..e46ca39a577ed7e45b896d5eae4e801375c09461 100644 (file)
@@ -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");
index 234eaf01812b113829003b2b0999aeb6e2515c8f..3c8bf76833acbd8c6475f7b09796570150fa1a37 100644 (file)
@@ -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;