[Asterisk-cvs] asterisk channel.c,1.149,1.150

markster at lists.digium.com markster at lists.digium.com
Thu Dec 9 14:57:30 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv10667

Modified Files:
	channel.c 
Log Message:
Make music on hold truly optional (bug #2998)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- channel.c	7 Dec 2004 20:38:43 -0000	1.149
+++ channel.c	9 Dec 2004 19:55:01 -0000	1.150
@@ -24,6 +24,7 @@
 #include <asterisk/sched.h>
 #include <asterisk/options.h>
 #include <asterisk/channel.h>
+#include <asterisk/musiconhold.h>
 #include <asterisk/channel_pvt.h>
 #include <asterisk/logger.h>
 #include <asterisk/say.h>
@@ -2959,3 +2960,40 @@
 	}
 	return group;
 }
+
+
+static int (*ast_moh_start_ptr)(struct ast_channel *, char *) = NULL;
+static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL;
+
+
+void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
+								void (*stop_ptr)(struct ast_channel *)) 
+{
+	ast_moh_start_ptr = start_ptr;
+	ast_moh_stop_ptr = stop_ptr;
+}
+
+void ast_uninstall_music_functions(void) 
+{
+	ast_moh_start_ptr = NULL;
+	ast_moh_stop_ptr = NULL;
+}
+
+/*! Turn on/off music on hold on a given channel */
+
+int ast_moh_start(struct ast_channel *chan, char *mclass) 
+{
+	if(ast_moh_start_ptr)
+		return ast_moh_start_ptr(chan, mclass);
+
+	if (option_verbose > 2)
+		ast_verbose(VERBOSE_PREFIX_3 "Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : "default");
+	
+	return 0;
+}
+
+void ast_moh_stop(struct ast_channel *chan) 
+{
+	if(ast_moh_stop_ptr)
+		ast_moh_stop_ptr(chan);
+}




More information about the svn-commits mailing list