[svn-commits] file: branch file/bridging r107286 - in /team/file/bridging: apps/ include/as...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 10 18:18:04 CDT 2008


Author: file
Date: Mon Mar 10 18:18:03 2008
New Revision: 107286

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107286
Log:
Move muting to the features structure.

Modified:
    team/file/bridging/apps/app_confbridge.c
    team/file/bridging/include/asterisk/bridging.h
    team/file/bridging/main/bridging.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=107286&r1=107285&r2=107286
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Mon Mar 10 18:18:03 2008
@@ -86,7 +86,7 @@
 	struct conference_bridge *conference_bridge; /*!< Conference bridge they are participating in */
 	struct ast_channel *chan;                    /*!< Asterisk channel participating */
 	struct ast_flags flags;                      /*!< Flags passed in when the application was called */
-	unsigned int muted:1;                        /*!< Is this user muted or not */
+	struct ast_bridge_features features;         /*!< Bridge features structure */
 	unsigned int kicked:1;                       /*!< User has been kicked from the conference */
 	AST_LIST_ENTRY(conference_bridge_user) list; /*!< Linked list information */
 };
@@ -253,8 +253,8 @@
 
 	if (digit == '1') {
 		/* 1 - Mute or unmute yourself */
-		conference_bridge_user->muted = bridge_channel->muted = (!bridge_channel->muted ? 1 : 0);
-		if (!(res = ast_streamfile(bridge_channel->chan, (bridge_channel->muted ? "conf-muted" : "conf-unmuted"), bridge_channel->chan->language))) {
+		conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
+		if (!(res = ast_streamfile(bridge_channel->chan, (conference_bridge_user->features.mute ? "conf-muted" : "conf-unmuted"), bridge_channel->chan->language))) {
 			ast_waitstream(bridge_channel->chan, "");
 		}
 	} else if (isadmin && digit == '2') {
@@ -304,7 +304,6 @@
 	int res = 0;
 	char *parse;
 	struct conference_bridge *conference_bridge = NULL;
-	struct ast_bridge_features features;
 	struct conference_bridge_user conference_bridge_user = {
 		.chan = chan,
 	};
@@ -333,21 +332,21 @@
 	}
 
 	/* Always initialize the features structure, we are in most cases always going to need it. */
-	ast_bridge_features_init(&features);
+	ast_bridge_features_init(&conference_bridge_user.features);
 
 	/* If the menu option is enabled provide a user or admin menu as a custom feature hook */
 	if (ast_test_flag(&conference_bridge_user.flags, OPTION_MENU)) {
-		ast_bridge_features_hook(&features, "#", menu_callback, &conference_bridge_user);
+		ast_bridge_features_hook(&conference_bridge_user.features, "#", menu_callback, &conference_bridge_user);
 	}
 
 	/* Join our conference bridge for real */
-	ast_bridge_join(conference_bridge->bridge, chan, NULL, &features);
+	ast_bridge_join(conference_bridge->bridge, chan, NULL, &conference_bridge_user.features);
 
 	/* Easy as pie, depart this channel from the conference bridge */
 	leave_conference_bridge(conference_bridge, &conference_bridge_user);
 
 	/* Can't forget to clean up the features structure, or else we risk a memory leak */
-	ast_bridge_features_cleanup(&features);
+	ast_bridge_features_cleanup(&conference_bridge_user.features);
 
 	/* If the user was kicked from the conference play back the audio prompt for it */
 	if (conference_bridge_user.kicked) {

Modified: team/file/bridging/include/asterisk/bridging.h
URL: http://svn.digium.com/view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=107286&r1=107285&r2=107286
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Mon Mar 10 18:18:03 2008
@@ -113,7 +113,8 @@
 struct ast_bridge_features {
 	AST_LIST_HEAD_NOLOCK(, ast_bridge_features_hook) hooks;                   /*! Attached hooks */
 	struct ast_flags feature_flags;                                           /*! Feature flags */
-	unsigned int usable:1;                                                             /*! Whether this should be considered usable or not */
+	unsigned int usable:1;                                                    /*! Whether this should be considered usable or not */
+	unsigned int mute:1;                                                      /*! Whether to mute audio or not */
 };
 
 struct ast_bridge_channel {
@@ -125,7 +126,6 @@
 	pthread_t thread;                        /*! Thread handling the bridged channel */
 	int fds[4];                              /*! Additional file descriptors to look at */
 	unsigned int suspended:1;                /*! Is this bridged channel suspended from the bridge or not? */
-	unsigned int muted:1;                    /*! Is this bridged channel muted or not? */
 	struct ast_bridge_features *features;    /*! Enabled features information */
 	char dtmf_stream_q[8];                   /*! DTMF stream queue */
 	AST_LIST_ENTRY(ast_bridge_channel) list; /*! Linked list information */

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=107286&r1=107285&r2=107286
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Mon Mar 10 18:18:03 2008
@@ -180,7 +180,7 @@
 
 	/* If a bridge channel with actual channel is present read a frame and handle it */
 	if (chan && bridge_channel) {
-		struct ast_frame *frame = (bridge_channel->muted ? ast_read_noaudio(chan) : ast_read(chan));
+		struct ast_frame *frame = (((bridge->features.mute) || (bridge_channel->features && bridge_channel->features->mute)) ? ast_read_noaudio(chan) : ast_read(chan));
 
 		/* This is pretty simple... see if they hung up */
 		if (!frame || (frame->frametype == AST_FRAME_CONTROL && frame->subclass == AST_CONTROL_HANGUP)) {




More information about the svn-commits mailing list