[asterisk-commits] file: trunk r87850 - /trunk/apps/app_mixmonitor.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 31 12:56:21 CDT 2007


Author: file
Date: Wed Oct 31 12:56:21 2007
New Revision: 87850

URL: http://svn.digium.com/view/asterisk?view=rev&rev=87850
Log:
Restore operation of the option that only writes when the channel is bridged.

Modified:
    trunk/apps/app_mixmonitor.c

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=87850&r1=87849&r2=87850
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Wed Oct 31 12:56:21 2007
@@ -98,6 +98,7 @@
 	char *post_process;
 	char *name;
 	unsigned int flags;
+	struct ast_channel *chan;
 };
 
 enum {
@@ -165,25 +166,27 @@
 		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
 			continue;
 
-		/* Initialize the file if not already done so */
-		if (!fs && !errflag) {
-			oflags = O_CREAT | O_WRONLY;
-			oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
-
-			if ((ext = strrchr(mixmonitor->filename, '.')))
-				*(ext++) = '\0';
-			else
-				ext = "raw";
-
-			if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
-				ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
-				errflag = 1;
+		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || ast_bridged_channel(mixmonitor->chan)) {
+			/* Initialize the file if not already done so */
+			if (!fs && !errflag) {
+				oflags = O_CREAT | O_WRONLY;
+				oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
+				
+				if ((ext = strrchr(mixmonitor->filename, '.')))
+					*(ext++) = '\0';
+				else
+					ext = "raw";
+				
+				if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
+					ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
+					errflag = 1;
+				}
 			}
+			
+			/* Write out frame */
+			if (fs)
+				ast_writestream(fs, fr);
 		}
-
-		/* Write out frame */
-		if (fs)
-			ast_writestream(fs, fr);
 
 		/* All done! free it. */
 		ast_frame_free(fr, 0);
@@ -245,6 +248,7 @@
 
 	/* Copy over flags and channel name */
 	mixmonitor->flags = flags;
+	mixmonitor->chan = chan;
 	mixmonitor->name = (char *) mixmonitor + sizeof(*mixmonitor);
 	strcpy(mixmonitor->name, chan->name);
 	if (!ast_strlen_zero(postprocess2)) {




More information about the asterisk-commits mailing list