[asterisk-commits] jrose: branch jrose/volume-branch r309855 - /team/jrose/volume-branch/funcs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 7 15:12:03 CST 2011


Author: jrose
Date: Mon Mar  7 15:12:02 2011
New Revision: 309855

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309855
Log:
updated based on code review - March 7

Modified:
    team/jrose/volume-branch/funcs/func_volume.c

Modified: team/jrose/volume-branch/funcs/func_volume.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/volume-branch/funcs/func_volume.c?view=diff&rev=309855&r1=309854&r2=309855
==============================================================================
--- team/jrose/volume-branch/funcs/func_volume.c (original)
+++ team/jrose/volume-branch/funcs/func_volume.c Mon Mar  7 15:12:02 2011
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2011, Digium, Inc.
  *
- * Joshua Colp <jcolp at digium.com>
+ * Joshua Colp <jcolp at digium.com> 
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -20,7 +20,7 @@
  *
  * \brief Technology independent volume control
  *
- * \author Joshua Colp <jcolp at digium.com>
+ * \author Joshua Colp <jcolp at digium.com> 
  *
  * \ingroup functions
  *
@@ -46,7 +46,7 @@
 			<parameter name="direction" required="true">
 				<para>Must be <literal>TX</literal> or <literal>RX</literal>.</para>
 			</parameter>
-			<parameter name="options" >
+			<parameter name="options">
 				<optionlist>
 					<option name="p">
 						<para>Enable DTMF volume control</para>
@@ -74,14 +74,12 @@
 };
 
 enum volume_flags {
-    VOLUMEFLAG_CHANGE = (1 << 1),
+	VOLUMEFLAG_CHANGE = (1 << 1),
 };
 
 AST_APP_OPTIONS(volume_opts, {
 	AST_APP_OPTION('p', VOLUMEFLAG_CHANGE),
-
 });
-
 
 static void destroy_callback(void *data)
 {
@@ -121,9 +119,8 @@
 	if (ast_test_flag(vi, VOLUMEFLAG_CHANGE)) {
 		if (frame->frametype == AST_FRAME_DTMF) {
 			/* Only use DTMF coming from the source... not going to it */
-			if (direction != AST_AUDIOHOOK_DIRECTION_READ) { 
+			if (direction != AST_AUDIOHOOK_DIRECTION_READ)
 				return 0; 
-			}
 			if (frame->subclass.integer == '*') {
 				vi->tx_gain += 1;
 				vi->rx_gain += 1;
@@ -159,8 +156,6 @@
 	);
 	
 	AST_STANDARD_APP_ARGS(args, data);
-	
-	ast_verb(2, "direction: %s\n  == options: %s\n", args.direction, args.options);
 
 	if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) {
 		/* Allocate a new datastore to hold the reference to this volume and audiohook information */
@@ -179,11 +174,15 @@
 	}
 
 	/* Adjust gain on volume information structure */
-	if (!strcasecmp(args.direction, "tx")) {
+	if (!args.direction) {
+		ast_log(LOG_ERROR, "Direction must be specified for VOLUME function\n");
+		return 0;
+	}
+	
+	if (!strcasecmp(args.direction, "tx")) 
 		vi->tx_gain = atoi(value); 
-	} else if (!strcasecmp(args.direction, "rx")) {
+	else if (!strcasecmp(args.direction, "rx")) 
 		vi->rx_gain = atoi(value);
-	}
 
 	if (is_new) {
 		datastore->data = vi;
@@ -197,8 +196,7 @@
 		struct ast_flags flags = { 0 };
 		ast_app_parse_options(volume_opts, &flags, &data, args.options);
 		vi->flags = flags.flags;
-	}
-	else { 
+	} else { 
 		vi->flags = 0; 
 	}
 




More information about the asterisk-commits mailing list