[svn-commits] jrose: branch jrose/volume-branch r309344 - /team/jrose/volume-branch/funcs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 3 12:52:32 CST 2011


Author: jrose
Date: Thu Mar  3 12:52:29 2011
New Revision: 309344

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309344
Log:
Two code reviews later

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=309344&r1=309343&r2=309344
==============================================================================
--- team/jrose/volume-branch/funcs/func_volume.c (original)
+++ team/jrose/volume-branch/funcs/func_volume.c Thu Mar  3 12:52:29 2011
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 2007, Digium, Inc.
+ * Copyright (C) 2011, Digium, Inc.
  *
  * Joshua Colp <jcolp at digium.com>
  *
@@ -46,6 +46,13 @@
 			<parameter name="direction" required="true">
 				<para>Must be <literal>TX</literal> or <literal>RX</literal>.</para>
 			</parameter>
+			<parameter name="options" >
+				<optionlist>
+					<option name="p">
+						<para>Enable DTMF volume control</para>
+					</option>
+				</optionlist>
+			</parameter>
 		</syntax>
 		<description>
 			<para>The VOLUME function can be used to increase or decrease the <literal>tx</literal> or
@@ -53,6 +60,8 @@
 			<para>For example:</para>
 			<para>Set(VOLUME(TX)=3)</para>
 			<para>Set(VOLUME(RX)=2)</para>
+			<para>Set(VOLUME(TX,p)=3)</para>
+			<para>Set(VOLUME(RX,p)=3></para>
 		</description>
 	</function>
  ***/
@@ -97,7 +106,6 @@
 	struct volume_information *vi = NULL;
 	int *gain = NULL;
 
-
 	/* If the audiohook is stopping it means the channel is shutting down.... but we let the datastore destroy take care of it */
 	if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE)
 		return 0;
@@ -112,14 +120,16 @@
 
 	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) { return 0; } 
-		if (frame->subclass.integer == '*') {
-			vi->tx_gain += 1;
-			vi->rx_gain += 1;
-		} else if (frame->subclass.integer == '#') {
-			vi->tx_gain -= 1;
-			vi->rx_gain -= 1;
+			/* Only use DTMF coming from the source... not going to it */
+			if (direction != AST_AUDIOHOOK_DIRECTION_READ) { 
+				return 0; 
+			}
+			if (frame->subclass.integer == '*') {
+				vi->tx_gain += 1;
+				vi->rx_gain += 1;
+			} else if (frame->subclass.integer == '#') {
+				vi->tx_gain -= 1;
+				vi->rx_gain -= 1;
 			}
 		}
 	}
@@ -131,7 +141,7 @@
 		/* Apply gain to frame... easy as pi */
 		ast_frame_adjust_volume(frame, *gain);
 	}
-	
+
 	return 0;
 }
 
@@ -183,12 +193,14 @@
 
 	/* Add Option data to struct */
 	
-	if (!ast_strlen_zero(args.direction)) {
+	if (!ast_strlen_zero(args.options)) {
 		struct ast_flags flags = { 0 };
 		ast_app_parse_options(volume_opts, &flags, &data, args.options);
 		vi->flags = flags.flags;
 	}
-	else { vi->flags = 0; }
+	else { 
+		vi->flags = 0; 
+	}
 
 	return 0;
 }




More information about the svn-commits mailing list