aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-09 21:00:17 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-09 21:00:17 +0000
commit8c9d9049a12f83a68541501d937c0db6fbedda92 (patch)
treeed1dbccbdde2c73b03bc0722f714053bae09eb2a
parent317142ea9fb6ad0430de62b4e97653d24efd1214 (diff)
When the specified class isn't found, properly fall back to the channel's music
class or the default. (issue #10123, reported by blitzrage, patches from juggie, qwell, and me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@74165 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--res/res_musiconhold.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 7649d6f5b..f091793c1 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -636,6 +636,7 @@ static struct mohclass *get_mohbyname(char *name)
return moh;
moh = moh->next;
}
+ ast_log(LOG_WARNING, "Music on Hold class '%s' not found\n", name);
return NULL;
}
@@ -908,20 +909,19 @@ static void local_ast_moh_cleanup(struct ast_channel *chan)
static int local_ast_moh_start(struct ast_channel *chan, char *class)
{
- struct mohclass *mohclass;
+ struct mohclass *mohclass = NULL;
- if (ast_strlen_zero(class))
- class = chan->musicclass;
- if (ast_strlen_zero(class))
- class = "default";
ast_mutex_lock(&moh_lock);
- mohclass = get_mohbyname(class);
+ if (!ast_strlen_zero(class))
+ mohclass = get_mohbyname(class);
+ if (!mohclass && !ast_strlen_zero(chan->musicclass))
+ mohclass = get_mohbyname(chan->musicclass);
+ if (!mohclass)
+ mohclass = get_mohbyname("default");
ast_mutex_unlock(&moh_lock);
- if (!mohclass) {
- ast_log(LOG_WARNING, "No class: %s\n", (char *)class);
+ if (!mohclass)
return -1;
- }
ast_set_flag(chan, AST_FLAG_MOH);
if (mohclass->total_files) {