summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
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"