[Asterisk-cvs] asterisk channel.c,1.153,1.154 file.c,1.53,1.54

markster at lists.digium.com markster at lists.digium.com
Thu Dec 23 20:44:32 CST 2004


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

Modified Files:
	channel.c file.c 
Log Message:
Merge anthm's native MOH patch (bug #2639) he promises me he'll rid it of ast_flag_moh...


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- channel.c	23 Dec 2004 15:11:46 -0000	1.153
+++ channel.c	24 Dec 2004 01:40:07 -0000	1.154
@@ -613,6 +613,10 @@
 		chan->monitor->stop( chan, 0 );
 	}
 
+	/* If there is native format music-on-hold state, free it */
+	if(chan->music_state)
+		ast_moh_cleanup(chan);
+
 	/* Free translatosr */
 	if (chan->pvt->readtrans)
 		ast_translator_free_path(chan->pvt->readtrans);
@@ -2960,22 +2964,26 @@
 	return group;
 }
 
-
 static int (*ast_moh_start_ptr)(struct ast_channel *, char *) = NULL;
 static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL;
+static void (*ast_moh_cleanup_ptr)(struct ast_channel *) = NULL;
 
 
 void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
-								void (*stop_ptr)(struct ast_channel *)) 
+								 void (*stop_ptr)(struct ast_channel *),
+								 void (*cleanup_ptr)(struct ast_channel *)
+								 ) 
 {
 	ast_moh_start_ptr = start_ptr;
 	ast_moh_stop_ptr = stop_ptr;
+	ast_moh_cleanup_ptr = cleanup_ptr;
 }
 
 void ast_uninstall_music_functions(void) 
 {
 	ast_moh_start_ptr = NULL;
 	ast_moh_stop_ptr = NULL;
+	ast_moh_cleanup_ptr = NULL;
 }
 
 /*! Turn on/off music on hold on a given channel */
@@ -2996,3 +3004,10 @@
 	if(ast_moh_stop_ptr)
 		ast_moh_stop_ptr(chan);
 }
+
+void ast_moh_cleanup(struct ast_channel *chan) 
+{
+	if(ast_moh_cleanup_ptr)
+        ast_moh_cleanup_ptr(chan);
+}
+

Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- file.c	14 Nov 2004 22:38:34 -0000	1.53
+++ file.c	24 Dec 2004 01:40:07 -0000	1.54
@@ -431,9 +431,13 @@
 		res = ret ? ret : -1;
 	return res;
 }
-
 struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
 {
+	return ast_openstream_full(chan, filename, preflang, 0);
+}
+
+struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char *filename, const char *preflang, int asis)
+{
 	/* This is a fairly complex routine.  Essentially we should do 
 	   the following:
 	   
@@ -452,10 +456,13 @@
 	char filename3[256]="";
 	char *endpart;
 	int res;
-	ast_stopstream(chan);
-	/* do this first, otherwise we detect the wrong writeformat */
-	if (chan->generator)
-		ast_deactivate_generator(chan);
+
+	if (!asis) {
+		/* do this first, otherwise we detect the wrong writeformat */
+		ast_stopstream(chan);
+		if (chan->generator)
+			ast_deactivate_generator(chan);
+	}
 	if (preflang && !ast_strlen_zero(preflang)) {
 		strncpy(filename3, filename, sizeof(filename3) - 1);
 		endpart = strrchr(filename3, '/');




More information about the svn-commits mailing list