Index: res/res_musiconhold.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v retrieving revision 1.67 diff -u -r1.67 res_musiconhold.c --- res/res_musiconhold.c 22 Aug 2005 19:29:29 -0000 1.67 +++ res/res_musiconhold.c 25 Aug 2005 13:08:00 -0000 @@ -471,7 +471,7 @@ /* Spawn mp3 player if it's not there */ if (class->srcfd < 0) { if ((class->srcfd = spawn_mp3(class)) < 0) { - ast_log(LOG_WARNING, "unable to spawn mp3player\n"); + ast_log(LOG_WARNING, "Unable to spawn mp3player\n"); /* Try again later */ sleep(500); } @@ -1135,17 +1135,19 @@ static struct ast_cli_entry cli_moh_files_show = { { "moh", "files", "show"}, cli_files_show, "List MOH file-based classes", "Lists all loaded file-based MOH classes and their files", NULL}; -static void init_classes(void) +static int init_classes(void) { struct mohclass *moh; - load_moh_classes(); + if (!load_moh_classes()) /* Load classes from config */ + return 0; /* Return if nothing is found */ moh = mohclasses; while (moh) { if (moh->total_files) moh_scan_files(moh); moh = moh->next; } + return 1; } int load_module(void) @@ -1167,7 +1169,10 @@ if (!res) res = ast_register_application(app4, moh4_exec, synopsis4, descrip4); - init_classes(); + if (!init_classes()) { /* No music classes configured, so skip it */ + ast_log(LOG_WARNING, "No music on hold classes configured, disabling music on hold."); + ast_uninstall_music_functions(); + } return 0; }