From 5d45679b63debe9c4a203aa0f952ae28199873fd Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Mon, 16 Mar 2009 16:31:23 +0000 Subject: [PATCH] allow profile named "default" to be the default git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12622 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_lcr/mod_lcr.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index f68f9f0684..e20eedea1f 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -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; }