[asterisk-commits] file: branch file/bridging r110546 - /team/file/bridging/apps/app_confbridge.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 21 13:06:57 CDT 2008


Author: file
Date: Fri Mar 21 13:06:57 2008
New Revision: 110546

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110546
Log:
Make the volume controls in the IVR work using the just merged ast_audiohook_volume_* API calls.

Modified:
    team/file/bridging/apps/app_confbridge.c

Modified: team/file/bridging/apps/app_confbridge.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/apps/app_confbridge.c?view=diff&rev=110546&r1=110545&r2=110546
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Fri Mar 21 13:06:57 2008
@@ -46,6 +46,7 @@
 #include "asterisk/bridging.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/say.h"
+#include "asterisk/audiohook.h"
 
 static char *app = "ConfBridge";
 static char *synopsis = 
@@ -519,14 +520,18 @@
 		}
 	} else if (digit == '4') {
 		/* 4 - Decrease listening volume */
+		ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_WRITE, -1);
 	} else if (digit == '6') {
 		/* 6 - Increase listening volume */
+		ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_WRITE, 1);
 	} else if (digit == '7') {
 		/* 7 - Decrease talking volume */
+		ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_READ, -1);
 	} else if (digit == '8') {
 		/* 8 - Exit the IVR */
 	} else if (digit == '9') {
 		/* 9 - Increase talking volume */
+		ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_READ, 1);
 	} else {
 		/* No valid option was selected */
 		res = ast_stream_and_wait(bridge_channel->chan, "conf-errormenu", "");
@@ -548,7 +553,7 @@
 /*! \brief The ConfBridge application */
 static int confbridge_exec(struct ast_channel *chan, void *data)
 {
-	int res = 0;
+	int res = 0, volume_adjustments[2];
 	char *parse;
 	struct conference_bridge *conference_bridge = NULL;
 	struct conference_bridge_user conference_bridge_user = {
@@ -580,6 +585,10 @@
 		return -1;
 	}
 
+	/* Keep a copy of volume adjustments so we can restore them later if need be */
+	volume_adjustments[0] = ast_audiohook_volume_get(chan, AST_AUDIOHOOK_DIRECTION_READ);
+	volume_adjustments[1] = ast_audiohook_volume_get(chan, AST_AUDIOHOOK_DIRECTION_WRITE);
+
 	/* Always initialize the features structure, we are in most cases always going to need it. */
 	ast_bridge_features_init(&conference_bridge_user.features);
 
@@ -621,6 +630,14 @@
 		res = ast_stream_and_wait(chan, "conf-kicked", "");
 	}
 
+	/* Restore volume adjustments to previous values in case they were changed */
+	if (volume_adjustments[0]) {
+		ast_audiohook_volume_set(chan, AST_AUDIOHOOK_DIRECTION_READ, volume_adjustments[0]);
+	}
+	if (volume_adjustments[1]) {
+		ast_audiohook_volume_set(chan, AST_AUDIOHOOK_DIRECTION_WRITE, volume_adjustments[1]);
+	}
+
 	return res;
 }
 




More information about the asterisk-commits mailing list