[asterisk-commits] jrose: branch jrose/bridge_projects r386455 - in /team/jrose/bridge_projects:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 24 15:22:34 CDT 2013


Author: jrose
Date: Wed Apr 24 15:22:30 2013
New Revision: 386455

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386455
Log:
resolve conflict and set automerge back on.

Modified:
    team/jrose/bridge_projects/   (props changed)
    team/jrose/bridge_projects/include/asterisk/bridging.h
    team/jrose/bridge_projects/main/bridging.c
    team/jrose/bridge_projects/res/parking/parking_bridge.c

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_projects-integrated (original)
+++ bridge_projects-integrated Wed Apr 24 15:22:30 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-386411
+/team/group/bridge_construction:1-386442

Modified: team/jrose/bridge_projects/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging.h?view=diff&rev=386455&r1=386454&r2=386455
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging.h Wed Apr 24 15:22:30 2013
@@ -298,19 +298,6 @@
 typedef void (*ast_bridge_dissolving_fn)(struct ast_bridge *self);
 
 /*!
- * \brief Can this channel be pushed into the bridge.
- *
- * \param self Bridge to operate upon.
- * \param bridge_channel Bridge channel wanting to push.
- * \param swap Bridge channel to swap places with if not NULL.
- *
- * \note On entry, self is already locked.
- *
- * \retval TRUE if can push this channel into the bridge.
- */
-typedef int (*ast_bridge_can_push_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
-
-/*!
  * \brief Push this channel into the bridge.
  *
  * \param self Bridge to operate upon.
@@ -325,8 +312,8 @@
  *
  * \note On entry, self is already locked.
  *
- * \retval 0 on success
- * \retval -1 on failure
+ * \retval 0 on success.
+ * \retval -1 on failure.  The channel did not get pushed.
  */
 typedef int (*ast_bridge_push_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
 
@@ -376,8 +363,6 @@
 	ast_bridge_destructor_fn destroy;
 	/*! The bridge is being dissolved.  Remove any references to the bridge. */
 	ast_bridge_dissolving_fn dissolving;
-	/*! TRUE if can push the bridge channel into the bridge. */
-	ast_bridge_can_push_channel_fn can_push;
 	/*! Push the bridge channel into the bridge. */
 	ast_bridge_push_channel_fn push;
 	/*! Pull the bridge channel from the bridge. */

Modified: team/jrose/bridge_projects/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/bridging.c?view=diff&rev=386455&r1=386454&r2=386455
==============================================================================
--- team/jrose/bridge_projects/main/bridging.c (original)
+++ team/jrose/bridge_projects/main/bridging.c Wed Apr 24 15:22:30 2013
@@ -540,36 +540,18 @@
  *
  * \note On entry, bridge_channel->bridge is already locked.
  *
- * \return Nothing
- */
-static void bridge_channel_push(struct ast_bridge_channel *bridge_channel)
+ * \retval 0 on success.
+ * \retval -1 on failure.  The channel did not get pushed.
+ */
+static int bridge_channel_push(struct ast_bridge_channel *bridge_channel)
 {
 	struct ast_bridge *bridge = bridge_channel->bridge;
 	struct ast_bridge_channel *swap;
-	int chan_leaving;
 
 	ast_assert(!bridge_channel->in_bridge);
 
 	swap = find_bridge_channel(bridge, bridge_channel->swap);
 	bridge_channel->swap = NULL;
-
-	chan_leaving = bridge->dissolved
-		|| !bridge->v_table->can_push(bridge, bridge_channel, swap);
-
-	ast_bridge_channel_lock(bridge_channel);
-	if (chan_leaving) {
-		/*
-		 * Force out channel being pushed into a dissolved bridge or it
-		 * is not allowed into the bridge.
-		 */
-		ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-	}
-	chan_leaving = bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT;
-	ast_bridge_channel_unlock(bridge_channel);
-	if (chan_leaving) {
-		/* Don't push a channel in the process of leaving. */
-		return;
-	}
 
 	if (swap) {
 		ast_debug(1, "Bridge %s: pushing %p(%s) by swapping with %p(%s)\n",
@@ -581,12 +563,13 @@
 	}
 
 	/* Add channel to the bridge */
-	if (ast_bridge_channel_establish_roles(bridge_channel) || bridge->v_table->push(bridge, bridge_channel, swap)) {
-		/* A bridge channel can not be pushed if its roles can't be copied properly. */
-		ast_log(LOG_ERROR, "Bridge %s: failed to push channel %s into bridge\n",
-			bridge->uniqueid, ast_channel_name(bridge_channel->chan));
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-		return;
+	if (ast_bridge_channel_establish_roles(bridge_channel)
+		|| bridge->dissolved
+		|| bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT
+		|| bridge->v_table->push(bridge, bridge_channel, swap)) {
+		ast_debug(1, "Bridge %s: pushing %p(%s) into bridge failed\n",
+			bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan));
+		return -1;
 	}
 
 	bridge_channel->in_bridge = 1;
@@ -603,6 +586,7 @@
 
 	bridge->reconfigured = 1;
 	ast_bridge_publish_enter(bridge, bridge_channel->chan);
+	return 0;
 }
 
 /*! \brief Internal function to handle DTMF from a channel */
@@ -1275,7 +1259,6 @@
 		|| !v_table->name
 		|| !v_table->destroy
 		|| !v_table->dissolving
-		|| !v_table->can_push
 		|| !v_table->push
 		|| !v_table->pull
 		|| !v_table->notify_masquerade) {
@@ -1372,25 +1355,6 @@
 
 /*!
  * \internal
- * \brief ast_bridge base can_push method.
- * \since 12.0.0
- *
- * \param self Bridge to operate upon.
- * \param bridge_channel Bridge channel wanting to push.
- * \param swap Bridge channel to swap places with if not NULL.
- *
- * \note On entry, self is already locked.
- * \note Stub because of nothing to do.
- *
- * \retval TRUE if can push this channel into the bridge.
- */
-static int bridge_base_can_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
-{
-	return 1;
-}
-
-/*!
- * \internal
  * \brief ast_bridge base push method.
  * \since 12.0.0
  *
@@ -1447,7 +1411,6 @@
 	.name = "base",
 	.destroy = bridge_base_destroy,
 	.dissolving = bridge_base_dissolving,
-	.can_push = bridge_base_can_push,
 	.push = bridge_base_push,
 	.pull = bridge_base_pull,
 	.notify_masquerade = bridge_base_notify_masquerade,
@@ -2391,7 +2354,9 @@
 		bridge_channel->bridge->callid = ast_read_threadstorage_callid();
 	}
 
-	bridge_channel_push(bridge_channel);
+	if (bridge_channel_push(bridge_channel)) {
+		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	}
 	bridge_reconfigured(bridge_channel->bridge);
 
 	if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
@@ -3216,7 +3181,9 @@
 		ast_bridge_channel_unlock(bridge_channel);
 		ao2_ref(src_bridge, -1);
 
-		bridge_channel_push(bridge_channel);
+		if (bridge_channel_push(bridge_channel)) {
+			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+		}
 	}
 	bridge_reconfigured(dst_bridge);
 	bridge_reconfigured(src_bridge);

Modified: team/jrose/bridge_projects/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge.c?view=diff&rev=386455&r1=386454&r2=386455
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge.c Wed Apr 24 15:22:30 2013
@@ -65,25 +65,6 @@
 
 	/* Disassociate the bridge from the parking lot as well. */
 	self->lot = NULL;
-}
-
-/*!
- * \internal
- * \brief ast_bridge parking can_push method.
- * \since 12.0.0
- *
- * \param self Bridge to operate upon
- * \param bridge_channel Bridge channel wanting to push.
- * \param swap Bridge channel to swap places with if not NULL.
- *
- * \note On entry, self is already locked.
- * \note XXX Stub... and it might go unused.
- *
- * \retval TRUE if can push this channel into the bridge.
- */
-static int bridge_parking_can_push(struct ast_bridge_parking *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
-{
-	return 1;
 }
 
 /*!
@@ -244,7 +225,6 @@
 	.name = "parking",
 	.destroy = (ast_bridge_destructor_fn) bridge_parking_destroy,
 	.dissolving = (ast_bridge_dissolving_fn) bridge_parking_dissolving,
-	.can_push = (ast_bridge_can_push_channel_fn) bridge_parking_can_push,
 	.push = (ast_bridge_push_channel_fn) bridge_parking_push,
 	.pull = (ast_bridge_pull_channel_fn) bridge_parking_pull,
 	.notify_masquerade = (ast_bridge_notify_masquerade_fn) bridge_parking_notify_masquerade,




More information about the asterisk-commits mailing list