[asterisk-commits] jrose: branch jrose/mix-monitor-branch r309082 - in /team/jrose/mix-monitor-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 1 09:35:50 CST 2011


Author: jrose
Date: Tue Mar  1 09:35:44 2011
New Revision: 309082

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309082
Log:
style revisions

Modified:
    team/jrose/mix-monitor-branch/   (props changed)
    team/jrose/mix-monitor-branch/apps/app_mixmonitor.c
    team/jrose/mix-monitor-branch/cel/cel_odbc.c   (props changed)
    team/jrose/mix-monitor-branch/configs/cel_odbc.conf.sample   (props changed)
    team/jrose/mix-monitor-branch/sounds/Makefile   (props changed)

Propchange: team/jrose/mix-monitor-branch/
------------------------------------------------------------------------------
    svn:mergeinfo = /team/jrose/mix-monitor-branch:309077-309081

Modified: team/jrose/mix-monitor-branch/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/mix-monitor-branch/apps/app_mixmonitor.c?view=diff&rev=309082&r1=309081&r2=309082
==============================================================================
--- team/jrose/mix-monitor-branch/apps/app_mixmonitor.c (original)
+++ team/jrose/mix-monitor-branch/apps/app_mixmonitor.c Tue Mar  1 09:35:44 2011
@@ -36,6 +36,7 @@
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/paths.h"		/* use ast_config_AST_MONITOR_DIR */
 #include "asterisk/file.h"
 #include "asterisk/audiohook.h"
@@ -46,6 +47,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/autochan.h"
 #include "asterisk/manager.h"
+
 /*** DOCUMENTATION
 	<application name="MixMonitor" language="en_US">
 		<synopsis>
@@ -145,7 +147,9 @@
 	</manager>
 
  ***/
+
 #define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
+
 	 static const char *const app = "MixMonitor";
 
 	 static const char *const stop_app = "StopMixMonitor";
@@ -157,9 +161,6 @@
 		 char *filename;
 		 char *filename_read;
 		 char *filename_write;
-
-
-
 		 char *post_process;
 		 char *name;
 		 unsigned int flags;
@@ -188,25 +189,23 @@
 		 OPT_ARG_ARRAY_SIZE,	/* Always last element of the enum */
 	 };
 
-AST_APP_OPTIONS(mixmonitor_opts,
-				{
-				AST_APP_OPTION('a', MUXFLAG_APPEND),
-				AST_APP_OPTION('b', MUXFLAG_BRIDGED),
-				AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
-				AST_APP_OPTION_ARG('V', MUXFLAG_WRITEVOLUME, OPT_ARG_WRITEVOLUME),
-				AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
-				AST_APP_OPTION_ARG('r', MUXFLAG_READ, OPT_ARG_READNAME),
-				AST_APP_OPTION_ARG('t', MUXFLAG_WRITE, OPT_ARG_WRITENAME),});
+AST_APP_OPTIONS(mixmonitor_opts, {
+        AST_APP_OPTION('a', MUXFLAG_APPEND),
+		AST_APP_OPTION('b', MUXFLAG_BRIDGED),
+		AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
+		AST_APP_OPTION_ARG('V', MUXFLAG_WRITEVOLUME, OPT_ARG_WRITEVOLUME),
+		AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
+		AST_APP_OPTION_ARG('r', MUXFLAG_READ, OPT_ARG_READNAME),
+		AST_APP_OPTION_ARG('t', MUXFLAG_WRITE, OPT_ARG_WRITENAME),
+});
 
 struct mixmonitor_ds {
 	unsigned int destruction_ok;
 	ast_cond_t destruction_condition;
 	ast_mutex_t lock;
-
 	/* The filestream is held in the datastore so it can be stopped
 	 * immediately during stop_mixmonitor or channel destruction. */
 	int fs_quit;
-
 
 	struct ast_filestream *fs;
 	struct ast_filestream *fs_read;
@@ -235,7 +234,7 @@
 
 		mixmonitor_ds->fs_quit = 1;
 
-		ast_verb(2, "MixMonitor close filestream\n");
+		ast_verb(2, "MixMonitor close filestream(s)\n");
 	}
 }
 
@@ -279,8 +278,7 @@
 
 	ast_audiohook_attach(chan, audiohook);
 
-	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) &&
-		(peer = ast_bridged_channel(chan)))
+	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
 
 	return res;
@@ -327,13 +325,14 @@
 	ast_audiohook_lock(&mixmonitor->audiohook);
 
 	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING &&
-		   !mixmonitor->mixmonitor_ds->fs_quit) {
+!mixmonitor->mixmonitor_ds->fs_quit) {
 		struct ast_frame *fr = NULL;
 		struct ast_frame *fr_read = NULL;
 		struct ast_frame *fr_write = NULL;
 
 
-		/* here we need to use a modified version of the ast_audiohook_read_frame function designed to take our read and write frames as arguments. */
+		/* here we need to use a modified version of the ast_audiohook_read_frame function
+		 * designed to take our read and write frames as arguments. */
 		if (!(fr = ast_audiohook_read_frame_all(&mixmonitor->audiohook, SAMPLES_PER_FRAME,
                                                 AST_AUDIOHOOK_DIRECTION_BOTH, &format_slin,
                                                 &fr_read, &fr_write))) {
@@ -365,7 +364,7 @@
 					if ((ext = strrchr(mixmonitor->filename, '.')))
 						*(ext++) = '\0';
 					else
-						ext = "wav";
+						ext = "raw";
 
 					if (!
 						(*fs =
@@ -386,7 +385,7 @@
 					if ((ext = strrchr(mixmonitor->filename_read, '.')))
 						*(ext++) = '\0';
 					else
-						ext = "wav";
+						ext = "raw";
 
 					if (!
 						(*fs_read =
@@ -409,7 +408,7 @@
 					if ((ext = strrchr(mixmonitor->filename_write, '.')))
 						*(ext++) = '\0';
 					else
-						ext = "wav";
+						ext = "raw";
 
 					if (!
 						(*fs_write =
@@ -476,8 +475,7 @@
 	ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
 	mixmonitor_ds_close_fs(mixmonitor->mixmonitor_ds);
 	if (!mixmonitor->mixmonitor_ds->destruction_ok) {
-		ast_cond_wait(&mixmonitor->mixmonitor_ds->destruction_condition,
-					  &mixmonitor->mixmonitor_ds->lock);
+		ast_cond_wait(&mixmonitor->mixmonitor_ds->destruction_condition, &mixmonitor->mixmonitor_ds->lock);
 	}
 	ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
 
@@ -583,8 +581,7 @@
 		strcpy(mixmonitor->post_process, postprocess2);
 	}
 
-	mixmonitor->filename =
-		(char *) mixmonitor + sizeof(*mixmonitor) + strlen(chan->name) + 1;
+	mixmonitor->filename = (char *) mixmonitor + sizeof(*mixmonitor) + strlen(chan->name) + 1;
 	strcpy(mixmonitor->filename, filename);
 
 	mixmonitor->filename_write = ast_strdup(filename_write);
@@ -620,11 +617,12 @@
 	char *parse, *tmp, *slash;
 	AST_DECLARE_APP_ARGS(args,
 						 AST_APP_ARG(filename);
-						 AST_APP_ARG(options); AST_APP_ARG(post_process););
+						 AST_APP_ARG(options);
+						 AST_APP_ARG(post_process);
+    );
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING,
-				"MixMonitor requires an argument (filename or ,t(filename) and/or r(filename)\n");
+		ast_log(LOG_WARNING, "MixMonitor requires an argument (filename or ,t(filename) and/or r(filename)\n");
 		return -1;
 	}
 
@@ -639,13 +637,9 @@
 
 		if (ast_test_flag(&flags, MUXFLAG_READVOLUME)) {
 			if (ast_strlen_zero(opts[OPT_ARG_READVOLUME])) {
-				ast_log(LOG_WARNING,
-						"No volume level was provided for the heard volume ('v') option.\n");
-			} else if ((sscanf(opts[OPT_ARG_READVOLUME], "%2d", &x) != 1) || (x < -4) ||
-					   (x > 4)) {
-				ast_log(LOG_NOTICE,
-						"Heard volume must be a number between -4 and 4, not '%s'\n",
-						opts[OPT_ARG_READVOLUME]);
+				ast_log(LOG_WARNING, "No volume level was provided for the heard volume ('v') option.\n");
+			} else if ((sscanf(opts[OPT_ARG_READVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
+				ast_log(LOG_NOTICE, "Heard volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_READVOLUME]);
 			} else {
 				readvol = get_volfactor(x);
 			}
@@ -653,13 +647,9 @@
 
 		if (ast_test_flag(&flags, MUXFLAG_WRITEVOLUME)) {
 			if (ast_strlen_zero(opts[OPT_ARG_WRITEVOLUME])) {
-				ast_log(LOG_WARNING,
-						"No volume level was provided for the spoken volume ('V') option.\n");
-			} else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%2d", &x) != 1) || (x < -4) ||
-					   (x > 4)) {
-				ast_log(LOG_NOTICE,
-						"Spoken volume must be a number between -4 and 4, not '%s'\n",
-						opts[OPT_ARG_WRITEVOLUME]);
+				ast_log(LOG_WARNING, "No volume level was provided for the spoken volume ('V') option.\n");
+			} else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
+				ast_log(LOG_NOTICE, "Spoken volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_WRITEVOLUME]);
 			} else {
 				writevol = get_volfactor(x);
 			}
@@ -667,13 +657,10 @@
 
 		if (ast_test_flag(&flags, MUXFLAG_VOLUME)) {
 			if (ast_strlen_zero(opts[OPT_ARG_VOLUME])) {
-				ast_log(LOG_WARNING,
-						"No volume level was provided for the combined volume ('W') option.\n");
-			} else if ((sscanf(opts[OPT_ARG_VOLUME], "%2d", &x) != 1) || (x < -4) ||
-					   (x > 4)) {
+				ast_log(LOG_WARNING, "No volume level was provided for the combined volume ('W') option.\n");
+			} else if ((sscanf(opts[OPT_ARG_VOLUME], "%2d", &x) != 1) || (x < -4) || (x > 4)) {
 				ast_log(LOG_NOTICE,
-						"Combined volume must be a number between -4 and 4, not '%s'\n",
-						opts[OPT_ARG_VOLUME]);
+						"Combined volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_VOLUME]);
 			} else {
 				readvol = writevol = get_volfactor(x);
 			}
@@ -689,18 +676,12 @@
 			/* if not provided an absolute path, use the system-configured monitoring directory for the write file */
 			else if (opts[OPT_ARG_WRITENAME][0] != '/') {
 				char *build;
-				build =
-					alloca(strlen(ast_config_AST_MONITOR_DIR) +
-						   strlen(opts[OPT_ARG_WRITENAME]) + 3);
-				sprintf(build, "%s/%s", ast_config_AST_MONITOR_DIR,
-						opts[OPT_ARG_WRITENAME]);
-
-				opts[OPT_ARG_WRITENAME] = build;
-			}
-
+				build = alloca(strlen(ast_config_AST_MONITOR_DIR) + strlen(opts[OPT_ARG_WRITENAME]) + 3);
+                sprintf(build, "%s/%s", ast_config_AST_MONITOR_DIR, opts[OPT_ARG_WRITENAME]);
+                opts[OPT_ARG_WRITENAME] = build;
+			}
 
 			filename_write = opts[OPT_ARG_WRITENAME];
-
 			tmp = ast_strdupa(opts[OPT_ARG_WRITENAME]);
             if ((slash = strrchr(tmp, '/')))
                 *slash = '\0';
@@ -711,25 +692,18 @@
 
 		if (ast_test_flag(&flags, MUXFLAG_READ)) {
 			if (ast_strlen_zero(opts[OPT_ARG_READNAME])) {
-				ast_log(LOG_WARNING,
-						"No file name was provided for the receiving ('r') option.\n");
+				ast_log(LOG_WARNING, "No file name was provided for the receiving ('r') option.\n");
 			}
 			/* if not provided an absolute path, use the system-configured monitoring directory for the read file */
 			else if (opts[OPT_ARG_READNAME][0] != '/') {
 
 				char *build;
-				build =
-					alloca(strlen(ast_config_AST_MONITOR_DIR) +
-						   strlen(opts[OPT_ARG_READNAME]) + 3);
-
-				sprintf(build, "%s/%s", ast_config_AST_MONITOR_DIR,
-						opts[OPT_ARG_READNAME]);
-
+				build = alloca(strlen(ast_config_AST_MONITOR_DIR) + strlen(opts[OPT_ARG_READNAME]) + 3);
+				sprintf(build, "%s/%s", ast_config_AST_MONITOR_DIR,	opts[OPT_ARG_READNAME]);
 				opts[OPT_ARG_READNAME] = build;
 			}
 
 			filename_read = opts[OPT_ARG_READNAME];
-
 			tmp = ast_strdupa(opts[OPT_ARG_READNAME]);
             if ((slash = strrchr(tmp, '/')))
                 *slash = '\0';

Propchange: team/jrose/mix-monitor-branch/cel/cel_odbc.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 09:35:44 2011
@@ -1,1 +1,2 @@
 /be/branches/C.3/cel/cel_adaptive_odbc.c:256426
+/team/jrose/mix-monitor-branch/cel/cel_odbc.c:309077-309081

Propchange: team/jrose/mix-monitor-branch/configs/cel_odbc.conf.sample
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 09:35:44 2011
@@ -1,1 +1,2 @@
 /be/branches/C.3/configs/cel_adaptive_odbc.conf.sample:256426
+/team/jrose/mix-monitor-branch/configs/cel_odbc.conf.sample:309077-309081

Propchange: team/jrose/mix-monitor-branch/sounds/Makefile
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  1 09:35:44 2011
@@ -1,2 +1,3 @@
 /be/branches/C.3/sounds/Makefile:256426
+/team/jrose/mix-monitor-branch/sounds/Makefile:309077-309081
 /trunk/sounds/Makefile:270974




More information about the asterisk-commits mailing list