Index: res/res_musiconhold.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v retrieving revision 1.52 diff -u -r1.52 res_musiconhold.c --- res/res_musiconhold.c 25 Jan 2005 06:10:20 -0000 1.52 +++ res/res_musiconhold.c 2 Mar 2005 18:12:07 -0000 @@ -53,10 +53,14 @@ static char *app0 = "MusicOnHold"; static char *app1 = "WaitMusicOnHold"; static char *app2 = "SetMusicOnHold"; +static char *app3 = "StartMusicOnHold"; +static char *app4 = "StopMusicOnHold"; static char *synopsis0 = "Play Music On Hold indefinitely"; static char *synopsis1 = "Wait, playing Music On Hold"; static char *synopsis2 = "Set default Music On Hold class"; +static char *synopsis3 = "Play Music On Hold"; +static char *synopsis4 = "Stop Playing Music On Hold"; static char *descrip0 = "MusicOnHold(class): " "Plays hold music specified by class. If omitted, the default\n" @@ -75,6 +79,12 @@ "music on hold is activated, this class will be used to select which\n" "music is played.\n"; +static char *descrip3 = "StartMusicOnHold: " +"Starts playing music on hold, uses default music class for channel.\n"; + +static char *descrip4 = "StopMusicOnHold: " +"Stops playing music on hold.\n"; + static int respawn_time = 20; struct moh_files_state { @@ -548,6 +558,23 @@ return 0; } +static int moh3_exec(struct ast_channel *chan, void *data) +{ + if (ast_moh_start(chan, NULL)) { + ast_log(LOG_WARNING, "Unable to start music on hold on channel %s\n", chan->name); + return -1; + } + + return 0; +} + +static int moh4_exec(struct ast_channel *chan, void *data) +{ + ast_moh_stop(chan); + + return 0; +} + static struct mohclass *get_mohbyname(char *name) { struct mohclass *moh; @@ -1008,6 +1035,10 @@ res = ast_register_application(app1, moh1_exec, synopsis1, descrip1); if (!res) res = ast_register_application(app2, moh2_exec, synopsis2, descrip2); + if (!res) + res = ast_register_application(app3, moh3_exec, synopsis3, descrip3); + if (!res) + res = ast_register_application(app4, moh4_exec, synopsis4, descrip4); init_classes();