Only print out a warning for situations where it is actually helpful. (issue #10187 reported by denke)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@74814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2
Joshua Colp 18 years ago
parent 2c757b4ab7
commit 577c0ebedd

@ -627,7 +627,7 @@ static int moh4_exec(struct ast_channel *chan, void *data)
return 0; return 0;
} }
static struct mohclass *get_mohbyname(char *name) static struct mohclass *get_mohbyname(char *name, int warn)
{ {
struct mohclass *moh; struct mohclass *moh;
moh = mohclasses; moh = mohclasses;
@ -636,6 +636,7 @@ static struct mohclass *get_mohbyname(char *name)
return moh; return moh;
moh = moh->next; moh = moh->next;
} }
if (warn)
ast_log(LOG_WARNING, "Music on Hold class '%s' not found\n", name); ast_log(LOG_WARNING, "Music on Hold class '%s' not found\n", name);
return NULL; return NULL;
} }
@ -833,7 +834,7 @@ static int moh_register(struct mohclass *moh, int reload)
int x; int x;
#endif #endif
ast_mutex_lock(&moh_lock); ast_mutex_lock(&moh_lock);
if (get_mohbyname(moh->name)) { if (get_mohbyname(moh->name, 0)) {
if (reload) { if (reload) {
ast_log(LOG_DEBUG, "Music on Hold class '%s' left alone from initial load.\n", moh->name); ast_log(LOG_DEBUG, "Music on Hold class '%s' left alone from initial load.\n", moh->name);
} else { } else {
@ -913,11 +914,11 @@ static int local_ast_moh_start(struct ast_channel *chan, char *class)
ast_mutex_lock(&moh_lock); ast_mutex_lock(&moh_lock);
if (!ast_strlen_zero(class)) if (!ast_strlen_zero(class))
mohclass = get_mohbyname(class); mohclass = get_mohbyname(class, 1);
if (!mohclass && !ast_strlen_zero(chan->musicclass)) if (!mohclass && !ast_strlen_zero(chan->musicclass))
mohclass = get_mohbyname(chan->musicclass); mohclass = get_mohbyname(chan->musicclass, 1);
if (!mohclass) if (!mohclass)
mohclass = get_mohbyname("default"); mohclass = get_mohbyname("default", 1);
ast_mutex_unlock(&moh_lock); ast_mutex_unlock(&moh_lock);
if (!mohclass) if (!mohclass)
@ -1045,7 +1046,7 @@ static int load_moh_classes(int reload)
args = strchr(data, ','); args = strchr(data, ',');
if (args) if (args)
*args++ = '\0'; *args++ = '\0';
if (!(get_mohbyname(var->name))) { if (!(get_mohbyname(var->name, 0))) {
class = moh_class_malloc(); class = moh_class_malloc();
if (!class) { if (!class) {
ast_log(LOG_WARNING, "Out of memory!\n"); ast_log(LOG_WARNING, "Out of memory!\n");
@ -1070,7 +1071,7 @@ static int load_moh_classes(int reload)
ast_log(LOG_WARNING, "The old musiconhold.conf syntax has been deprecated! Please refer to the sample configuration for information on the new syntax.\n"); ast_log(LOG_WARNING, "The old musiconhold.conf syntax has been deprecated! Please refer to the sample configuration for information on the new syntax.\n");
dep_warning = 1; dep_warning = 1;
} }
if (!(get_mohbyname(var->name))) { if (!(get_mohbyname(var->name, 0))) {
args = strchr(var->value, ','); args = strchr(var->value, ',');
if (args) if (args)
*args++ = '\0'; *args++ = '\0';

Loading…
Cancel
Save