[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r381514 - in /team/rmudgett/bridge_pha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 16:30:50 CST 2013


Author: rmudgett
Date: Thu Feb 14 16:30:46 2013
New Revision: 381514

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381514
Log:
Remove join_on_empty parameter to ast_bridge_join() and replace it with the bridge dissolved flag.

The dissolved bridge flag now bounces out any channels that attempt to 
join a bridge after it has been dissolved.  

Modified:
    team/rmudgett/bridge_phase/apps/app_confbridge.c
    team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c
    team/rmudgett/bridge_phase/include/asterisk/bridging.h
    team/rmudgett/bridge_phase/main/bridging.c
    team/rmudgett/bridge_phase/main/features.c

Modified: team/rmudgett/bridge_phase/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_confbridge.c?view=diff&rev=381514&r1=381513&r2=381514
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_confbridge.c (original)
+++ team/rmudgett/bridge_phase/apps/app_confbridge.c Thu Feb 14 16:30:46 2013
@@ -627,7 +627,7 @@
 		chan = ast_channel_ref(conference_bridge->record_chan);
 		ast_answer(chan);
 		pbx_exec(chan, mixmonapp, ast_str_buffer(filename));
-		ast_bridge_join(conference_bridge->bridge, chan, NULL, NULL, NULL, 1, 0);
+		ast_bridge_join(conference_bridge->bridge, chan, NULL, NULL, NULL, 0);
 
 		ast_hangup(chan); /* This will eat this thread's reference to the channel as well */
 		/* STOP has been called. Wait for either a START or an EXIT */
@@ -1752,7 +1752,6 @@
 		NULL,
 		&conference_bridge_user.features,
 		&conference_bridge_user.tech_args,
-		1,
 		0);
 	send_leave_event(conference_bridge_user.chan, conference_bridge->name);
 

Modified: team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c?view=diff&rev=381514&r1=381513&r2=381514
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c Thu Feb 14 16:30:46 2013
@@ -279,7 +279,7 @@
 		attended_threeway_transfer, NULL, NULL);
 
 	/* But for the caller we want to join the bridge in a blocking fashion so we don't spin around in this function doing nothing while waiting */
-	attended_bridge_result = ast_bridge_join(attended_bridge, bridge_channel->chan, NULL, &caller_features, NULL, 0, 0);
+	attended_bridge_result = ast_bridge_join(attended_bridge, bridge_channel->chan, NULL, &caller_features, NULL, 0);
 
 	/* Wait for peer thread to exit bridge and die. */
 	if (!ast_autoservice_start(bridge_channel->chan)) {

Modified: team/rmudgett/bridge_phase/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/bridging.h?view=diff&rev=381514&r1=381513&r2=381514
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging.h Thu Feb 14 16:30:46 2013
@@ -236,6 +236,8 @@
 	unsigned int stop:1;
 	/*! TRUE if the bridge thread should refresh itself */
 	unsigned int refresh:1;
+	/*! TRUE if the bridge has been dissolved.  Any channel that now tries to join is immediately ejected. */
+	unsigned int dissolved:1;
 	/*! Bridge flags to tweak behavior */
 	struct ast_flags feature_flags;
 	/*! Bridge technology that is handling the bridge */
@@ -352,7 +354,6 @@
  * \param swap Channel to swap out if swapping
  * \param features Bridge features structure
  * \param tech_args Optional Bridging tech optimization parameters for this channel.
- * \param join_on_empty TRUE to join the bridge even if the bridge is empty.
  * \param pass_reference TRUE if the bridge reference is being passed by the caller.
  *
  * \retval state that channel exited the bridge with
@@ -360,7 +361,7 @@
  * Example usage:
  *
  * \code
- * ast_bridge_join(bridge, chan, NULL, NULL, NULL, 0, 0);
+ * ast_bridge_join(bridge, chan, NULL, NULL, NULL, 0);
  * \endcode
  *
  * This adds a channel pointed to by the chan pointer to the bridge pointed to by
@@ -379,7 +380,6 @@
 	struct ast_channel *swap,
 	struct ast_bridge_features *features,
 	struct ast_bridge_tech_optimizations *tech_args,
-	int join_on_empty,
 	int pass_reference);
 
 /*!

Modified: team/rmudgett/bridge_phase/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/bridging.c?view=diff&rev=381514&r1=381513&r2=381514
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Thu Feb 14 16:30:46 2013
@@ -310,6 +310,8 @@
 static void bridge_force_out_all(struct ast_bridge *bridge)
 {
 	struct ast_bridge_channel *bridge_channel;
+
+	bridge->dissolved = 1;
 
 /* BUGBUG need a cause code on the bridge for the later ejected channels. */
 	AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
@@ -1355,6 +1357,19 @@
 		}
 	}
 
+	if (bridge_channel->bridge->dissolved) {
+		/* Force out channel trying to join a dissolved bridge. */
+		ao2_lock(bridge_channel);
+		switch (bridge_channel->state) {
+		case AST_BRIDGE_CHANNEL_STATE_WAIT:
+			ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+			break;
+		default:
+			break;
+		}
+		ao2_unlock(bridge_channel);
+	}
+
 	/* Actually execute the respective threading model, and keep our bridge thread alive */
 	while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
 		/* Update bridge pointer on channel */
@@ -1801,7 +1816,6 @@
 	struct ast_channel *swap,
 	struct ast_bridge_features *features,
 	struct ast_bridge_tech_optimizations *tech_args,
-	int join_on_empty,
 	int pass_reference)
 {
 	struct ast_bridge_channel *bridge_channel;
@@ -1824,7 +1838,6 @@
 	bridge_channel->swap = swap;
 	bridge_channel->features = features;
 
-/* BUGBUG need to deal with join_on_empty */
 	bridge_channel_join(bridge_channel);
 	state = bridge_channel->state;
 

Modified: team/rmudgett/bridge_phase/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/features.c?view=diff&rev=381514&r1=381513&r2=381514
==============================================================================
--- team/rmudgett/bridge_phase/main/features.c (original)
+++ team/rmudgett/bridge_phase/main/features.c Thu Feb 14 16:30:46 2013
@@ -4535,7 +4535,7 @@
 	}
 
 	/* Join bridge */
-	ast_bridge_join(bridge, chan, NULL, &chan_features, NULL, 0, 1);
+	ast_bridge_join(bridge, chan, NULL, &chan_features, NULL, 1);
 
 	/*
 	 * If the bridge was broken for a hangup that isn't real, then




More information about the asterisk-commits mailing list