]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes issue where moh files were no longer rescanned during a reload.
authorJason Parker <jparker@digium.com>
Wed, 8 Sep 2010 20:31:43 +0000 (20:31 +0000)
committerJason Parker <jparker@digium.com>
Wed, 8 Sep 2010 20:31:43 +0000 (20:31 +0000)
(closes issue #16744)
Reported by: pj
Patches:
      16744-reload.diff uploaded by qwell (license 4)
Tested by: qwell

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

res/res_musiconhold.c

index 1f86b88e3779674321451a66890947808e1ee007..d05557732605ab3b1770a484eea22d958671fa3a 100644 (file)
@@ -1081,6 +1081,19 @@ static int init_files_class(struct mohclass *class)
        return 0;
 }
 
+static void moh_rescan_files(void) {
+       struct ao2_iterator i;
+       struct mohclass *c;
+
+       i = ao2_iterator_init(mohclasses, 0);
+
+       while ( (c = ao2_iterator_next(&i)) ) {
+               moh_scan_files(c);
+               ao2_ref(c, -1);
+       }
+
+       ao2_iterator_destroy(&i);
+}
 
 static int moh_diff(struct mohclass *old, struct mohclass *new)
 {
@@ -1584,6 +1597,9 @@ static int load_moh_classes(int 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");
                }
+               if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
+                       moh_rescan_files();
+               }
                return 0;
        }