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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 15:26:02 CST 2013


Author: rmudgett
Date: Thu Feb 14 15:25:59 2013
New Revision: 381507

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381507
Log:
* Add missing call to ast_bridge_features_destroy() in
ast_bridge_impart().

* Moved debug messages around to reduce bridge locking time in
bridge_thread().

* Increased debug level on spamming message in
bridge_channel_join_multithreaded().

* Comment updates.

Modified:
    team/rmudgett/bridge_phase/include/asterisk/bridging.h
    team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h
    team/rmudgett/bridge_phase/main/bridging.c
    team/rmudgett/bridge_phase/main/pbx.c

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=381507&r1=381506&r2=381507
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging.h Thu Feb 14 15:25:59 2013
@@ -230,11 +230,11 @@
 	 * for bridge technologies that mix audio. When set to 0, the bridge tech must choose a
 	 * default interval for itself. */
 	unsigned int internal_mixing_interval;
-	/*! Bit to indicate that the bridge thread is waiting on channels in the bridge array */
+	/*! TRUE if the bridge thread is waiting on channels in the bridge array */
 	unsigned int waiting:1;
-	/*! Bit to indicate the bridge thread should stop */
+	/*! TRUE if the bridge thread should stop */
 	unsigned int stop:1;
-	/*! Bit to indicate the bridge thread should refresh itself */
+	/*! TRUE if the bridge thread should refresh itself */
 	unsigned int refresh:1;
 	/*! Bridge flags to tweak behavior */
 	struct ast_flags feature_flags;

Modified: team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h?view=diff&rev=381507&r1=381506&r2=381507
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h Thu Feb 14 15:25:59 2013
@@ -73,7 +73,7 @@
 	int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*! Formats that the bridge technology supports */
 	struct ast_format_cap *format_capabilities;
-	/*! Bit to indicate whether the bridge technology is currently suspended or not */
+	/*! TRUE if the bridge technology is currently suspended. */
 	unsigned int suspended:1;
 	/*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
 	struct ast_module *mod;

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=381507&r1=381506&r2=381507
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Thu Feb 14 15:25:59 2013
@@ -135,6 +135,7 @@
 /*! \note This function assumes the bridge_channel is locked. */
 static void ast_bridge_change_state_nolock(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state)
 {
+/* BUGBUG need cause code for the bridge_channel leaving the bridge. */
 	ast_debug(1, "BUGBUG Setting bridge channel %p state from:%d to:%d\n",
 		bridge_channel, bridge_channel->state, new_state);
 
@@ -307,6 +308,7 @@
 {
 	struct ast_bridge_channel *bridge_channel;
 
+/* BUGBUG need a cause code on the bridge for the later ejected channels. */
 	AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
 		ao2_lock(bridge_channel);
 		switch (bridge_channel->state) {
@@ -320,7 +322,18 @@
 	}
 }
 
-/*! \brief Internal function to see whether a bridge should dissolve, and if so do it */
+/*!
+ * \internal
+ * \brief Check if a bridge should dissolve and then do it.
+ * \since 12.0.0
+ *
+ * \param bridge Bridge to check.
+ * \param bridge_channel Channel causing the check.
+ *
+ * \note On entry, bridge is already locked.
+ *
+ * \return Nothing
+ */
 static void bridge_check_dissolve(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	if (!ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_DISSOLVE_HANGUP)
@@ -554,13 +567,13 @@
 	struct ast_bridge *bridge = data;
 	int res = 0;
 
+	ast_debug(1, "Started bridge thread for %p\n", bridge);
+
 	ao2_lock(bridge);
 
 	if (bridge->callid) {
 		ast_callid_threadassoc_add(bridge->callid);
 	}
-
-	ast_debug(1, "Started bridge thread for %p\n", bridge);
 
 	/* Loop around until we are told to stop */
 	while (!bridge->stop) {
@@ -572,10 +585,6 @@
 
 		/* In case the refresh bit was set simply set it back to off */
 		bridge->refresh = 0;
-
-		ast_debug(1, "Launching bridge thread function %p for bridge %p\n",
-			bridge->technology->thread ? bridge->technology->thread : generic_thread_loop,
-			bridge);
 
 		/*
 		 * Execute the appropriate thread function.  If the technology
@@ -595,10 +604,9 @@
 		}
 	}
 
+	ao2_unlock(bridge);
+
 	ast_debug(1, "Ending bridge thread for %p\n", bridge);
-
-	ao2_unlock(bridge);
-	ao2_ref(bridge, -1);
 
 	return NULL;
 }
@@ -994,7 +1002,7 @@
 		ao2_unlock(bridge_channel);
 		ao2_lock(bridge_channel->bridge);
 	} else if (bridge_channel->suspended) {
-		ast_debug(10, "Going into a multithreaded signal wait for bridge channel %p of bridge %p\n",
+		ast_debug(1, "Going into a multithreaded signal wait for bridge channel %p of bridge %p\n",
 			bridge_channel, bridge_channel->bridge);
 		ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
 		ao2_unlock(bridge_channel);
@@ -1017,7 +1025,8 @@
 	ao2_unlock(bridge_channel->bridge);
 	ao2_lock(bridge_channel);
 	if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
-		ast_debug(1, "Going into a single threaded signal wait for bridge channel %p of bridge %p\n", bridge_channel, bridge_channel->bridge);
+		ast_debug(1, "Going into a single threaded signal wait for bridge channel %p of bridge %p\n",
+			bridge_channel, bridge_channel->bridge);
 		ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
 	}
 	ao2_unlock(bridge_channel);
@@ -1824,6 +1833,7 @@
 	ao2_ref(bridge_channel, -1);
 
 join_exit:;
+/* BUGBUG this is going to cause problems for DTMF atxfer attended bridge between B & C.  Maybe an ast_bridge_join_internal() that does not do the after bridge goto for this case. */
 	if (!(ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO)
 		&& !ast_after_bridge_goto_setup(chan)) {
 		/* Claim the after bridge goto is an async goto destination. */
@@ -1931,6 +1941,7 @@
 		/* cleanup */
 		bridge_channel->chan = NULL;
 		bridge_channel->swap = NULL;
+		ast_bridge_features_destroy(bridge_channel->features);
 		bridge_channel->features = NULL;
 
 		ao2_ref(bridge_channel, -1);

Modified: team/rmudgett/bridge_phase/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/pbx.c?view=diff&rev=381507&r1=381506&r2=381507
==============================================================================
--- team/rmudgett/bridge_phase/main/pbx.c (original)
+++ team/rmudgett/bridge_phase/main/pbx.c Thu Feb 14 15:25:59 2013
@@ -9528,6 +9528,7 @@
 		struct ast_format writeformat;
 	} tmpvars = { 0, };
 
+/* BUGBUG need to add bridge check code to also do an ast_explicit_goto() as a blind transfer. */
 	ast_channel_lock(chan);
 	if (ast_channel_pbx(chan)) { /* This channel is currently in the PBX */
 		ast_explicit_goto(chan, context, exten, priority + 1);




More information about the asterisk-commits mailing list