[Asterisk-cvs] asterisk/res res_musiconhold.c,1.52,1.53
markster at lists.digium.com
markster at lists.digium.com
Wed Mar 2 23:05:49 CST 2005
Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv9992/res
Modified Files:
res_musiconhold.c
Log Message:
Add "StartMusicOnHold and "StopMusicOnHold" apps (bug #3703)
Index: res_musiconhold.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- res_musiconhold.c 25 Jan 2005 06:10:20 -0000 1.52
+++ res_musiconhold.c 3 Mar 2005 05:03:06 -0000 1.53
@@ -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,14 @@
"music on hold is activated, this class will be used to select which\n"
"music is played.\n";
+static char *descrip3 = "StartMusicOnHold(class): "
+"Starts playing music on hold, uses default music class for channel.\n"
+"Starts playing music specified by class. If omitted, the default\n"
+"music source for the channel will be used. Always returns 0.\n";
+
+static char *descrip4 = "StopMusicOnHold: "
+"Stops playing music on hold.\n";
+
static int respawn_time = 20;
struct moh_files_state {
@@ -191,7 +203,8 @@
}
-static struct ast_frame *moh_files_readframe(struct ast_channel *chan) {
+static struct ast_frame *moh_files_readframe(struct ast_channel *chan)
+{
struct ast_frame *f = NULL;
if (!(chan->stream && (f = ast_readframe(chan->stream)))) {
@@ -548,6 +561,24 @@
return 0;
}
+static int moh3_exec(struct ast_channel *chan, void *data)
+{
+ char *class = NULL;
+ if (data && strlen(data))
+ class = data;
+ if (ast_moh_start(chan, class))
+ ast_log(LOG_NOTICE, "Unable to start music on hold class '%s' on channel %s\n", class ? class : "default", chan->name);
+
+ 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 +1039,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();
More information about the svn-commits
mailing list