summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2011-11-12 00:36:37 +0000
committerTerry Wilson <twilson@digium.com>2011-11-12 00:36:37 +0000
commitbd486fcf412d422cf26e3ce8da936d624c0e9829 (patch)
treea158c6c6bf00687fbd3fd51e58cd53e84afa2e1d /res/res_musiconhold.c
parent735e48f92f88d13bd877025ff51fffc9d339ddab (diff)
Don't forget to rescan MOH files for cached realtime classes
Realtime MOH class caching was implemented because without it, you would build a completely new MOH class and would start the music over at the beginning each time hold was pressed in a conversation. Unfortunately, this broke re-scanning for file changes for realtime MOH classes. This patch corrects that issue. (closes issue ASTERISK-18039) Review: https://reviewboard.asterisk.org/r/1579/ ........ Merged revisions 344899 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 344900 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 77beb55fa..a857b9ab7 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1522,6 +1522,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
}
} else {
ast_variables_destroy(var);
+ var = NULL;
}
}
@@ -1529,6 +1530,14 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
return -1;
}
+ /* If we are using a cached realtime class with files, re-scan the files */
+ if (!var && ast_test_flag(global_flags, MOH_CACHERTCLASSES) && mohclass->realtime && !strcasecmp(mohclass->mode, "files")) {
+ if (!moh_scan_files(mohclass)) {
+ mohclass = mohclass_unref(mohclass, "unreffing potential mohclass (moh_scan_files failed)");
+ return -1;
+ }
+ }
+
ast_manager_event(chan, EVENT_FLAG_CALL, "MusicOnHold",
"State: Start\r\n"
"Channel: %s\r\n"