]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow profile named "default" to be the default
authorRupa Schomaker <rupa@rupa.com>
Mon, 16 Mar 2009 16:31:23 +0000 (16:31 +0000)
committerRupa Schomaker <rupa@rupa.com>
Mon, 16 Mar 2009 16:31:23 +0000 (16:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12622 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_lcr/mod_lcr.c

index f68f9f0684d0de02778a3b7caa5cde877a9260ac..e20eedea1fb6041cd62835e879658c9a30fadd78 100644 (file)
@@ -631,14 +631,6 @@ static switch_status_t lcr_load_config()
                }
        }
        
-       /* define default profile  */
-       profile = switch_core_alloc(globals.pool, sizeof(*profile));
-       memset(profile, 0, sizeof(profile_t));
-       profile->name = "global_default";
-       profile->order_by = ", rate";
-       profile->pre_order = "";
-       globals.default_profile = profile;
-       
        switch_core_hash_init(&globals.profile_hash, globals.pool);
        if ((x_profiles = switch_xml_child(cfg, "profiles"))) {
                for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) {
@@ -750,6 +742,11 @@ static switch_status_t lcr_load_config()
                                
                                switch_core_hash_insert(globals.profile_hash, profile->name, profile);
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loaded lcr profile %s.\n", profile->name);
+                               
+                               if (!strcasecmp(profile->name, "default")) {
+                                       globals.default_profile = profile;
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting user defined default profile: %s.\n", profile->name);
+                               }
                        }
                        switch_safe_free(order_by.data);
                        switch_safe_free(pre_order.data);
@@ -758,7 +755,18 @@ static switch_status_t lcr_load_config()
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No lcr profiles defined.\n");
        }
        
- done:
+       /* define default profile  */
+       if (!globals.default_profile) {
+               profile = switch_core_alloc(globals.pool, sizeof(*profile));
+               memset(profile, 0, sizeof(profile_t));
+               profile->name = "global_default";
+               profile->order_by = ", rate";
+               profile->pre_order = "";
+               globals.default_profile = profile;
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting system defined default profile.");
+       }
+
+       done:
        switch_xml_free(xml);
        return status;
 }