If there is realtime configuration, it does not get re-read on reload unless the...
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 23 Jun 2010 21:53:49 +0000 (21:53 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 23 Jun 2010 21:53:49 +0000 (21:53 +0000)
(closes issue #16982)
 Reported by: dmitri
 Patches:
       res_musiconhold.patch uploaded by dmitri (license 1001)
 Tested by: atis

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272332 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_musiconhold.c

index dd031e3..d10baa2 100644 (file)
@@ -1605,6 +1605,10 @@ static int load_moh_classes(int reload)
        cfg = ast_config_load("musiconhold.conf", config_flags);
 
        if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
+               if (ast_check_realtime("musiconhold") && reload) {
+                       ao2_t_callback(mohclasses, OBJ_NODATA, moh_class_mark, NULL, "Mark deleted classes");
+                       ao2_t_callback(mohclasses, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, moh_classes_delete_marked, NULL, "Purge marked classes");
+               }
                return 0;
        }
 
@@ -1827,7 +1831,7 @@ static int load_module(void)
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       if (!load_moh_classes(0)) {     /* No music classes configured, so skip it */
+       if (!load_moh_classes(0) && ast_check_realtime("musiconhold") == 0) {   /* No music classes configured, so skip it */
                ast_log(LOG_WARNING, "No music on hold classes configured, "
                                "disabling music on hold.\n");
        } else {