提交 80e897b3 authored 作者: Rupa Schomaker's avatar Rupa Schomaker

oops, fix test for invalid profile


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12689 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a35aca24
...@@ -530,13 +530,13 @@ switch_status_t lcr_do_lookup(callback_t *cb_struct, char *digits) ...@@ -530,13 +530,13 @@ switch_status_t lcr_do_lookup(callback_t *cb_struct, char *digits)
digits_copy = string_digitsonly(cb_struct->pool, digits); digits_copy = string_digitsonly(cb_struct->pool, digits);
if (switch_strlen_zero(digits_copy)) { if (switch_strlen_zero(digits_copy)) {
return SWITCH_FALSE; return SWITCH_STATUS_GENERR;
} }
/* allocate the dedup hash */ /* allocate the dedup hash */
if (switch_core_hash_init(&cb_struct->dedup_hash, cb_struct->pool) != SWITCH_STATUS_SUCCESS) { if (switch_core_hash_init(&cb_struct->dedup_hash, cb_struct->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing the dedup hash\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing the dedup hash\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_GENERR;
} }
digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list); digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list);
...@@ -586,7 +586,7 @@ switch_status_t lcr_do_lookup(callback_t *cb_struct, char *digits) ...@@ -586,7 +586,7 @@ switch_status_t lcr_do_lookup(callback_t *cb_struct, char *digits)
} }
} }
switch_status_t test_profile(char *lcr_profile) switch_bool_t test_profile(char *lcr_profile)
{ {
callback_t routes = { 0 }; callback_t routes = { 0 };
switch_memory_pool_t *pool = NULL; switch_memory_pool_t *pool = NULL;
...@@ -603,7 +603,8 @@ switch_status_t test_profile(char *lcr_profile) ...@@ -603,7 +603,8 @@ switch_status_t test_profile(char *lcr_profile)
} }
routes.lookup_number = "15555551212"; routes.lookup_number = "15555551212";
return lcr_do_lookup(&routes, routes.lookup_number); return (lcr_do_lookup(&routes, routes.lookup_number) == SWITCH_STATUS_SUCCESS) ?
SWITCH_TRUE : SWITCH_FALSE;
} }
static switch_status_t lcr_load_config() static switch_status_t lcr_load_config()
...@@ -805,12 +806,13 @@ static switch_status_t lcr_load_config() ...@@ -805,12 +806,13 @@ static switch_status_t lcr_load_config()
switch_core_hash_insert(globals.profile_hash, profile->name, profile); 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); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loaded lcr profile %s.\n", profile->name);
/* test the profile */ /* test the profile */
if (test_profile(profile->name) != SWITCH_TRUE) { if (test_profile(profile->name) == SWITCH_TRUE) {
if (!strcasecmp(profile->name, "default")) { if (!strcasecmp(profile->name, "default")) {
globals.default_profile = profile; globals.default_profile = profile;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting user defined default profile: %s.\n", profile->name); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting user defined default profile: %s.\n", profile->name);
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Removing INAVLID Profile %s.\n", profile->name);
switch_core_hash_delete(globals.profile_hash, profile->name); switch_core_hash_delete(globals.profile_hash, profile->name);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论