[asterisk-commits] rmudgett: branch group/bridge_construction r382271 - in /team/group/bridge_co...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 28 12:51:04 CST 2013


Author: rmudgett
Date: Thu Feb 28 12:51:00 2013
New Revision: 382271

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382271
Log:
Make bridging debug messages easier to follow.  Use channel names.

Modified:
    team/group/bridge_construction/bridges/bridge_multiplexed.c
    team/group/bridge_construction/bridges/bridge_softmix.c
    team/group/bridge_construction/main/bridging.c

Modified: team/group/bridge_construction/bridges/bridge_multiplexed.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/bridges/bridge_multiplexed.c?view=diff&rev=382271&r1=382270&r2=382271
==============================================================================
--- team/group/bridge_construction/bridges/bridge_multiplexed.c (original)
+++ team/group/bridge_construction/bridges/bridge_multiplexed.c Thu Feb 28 12:51:00 2013
@@ -109,7 +109,8 @@
 		/* If we failed we will have to create a new one from scratch */
 		muxed_thread = ao2_alloc(sizeof(*muxed_thread), destroy_multiplexed_thread);
 		if (!muxed_thread) {
-			ast_debug(1, "Failed to find or create a new multiplexed thread for bridge '%p'\n", bridge);
+			ast_debug(1, "Failed to find or create a new multiplexed thread for bridge %p\n",
+				bridge);
 			ao2_unlock(muxed_threads);
 			return -1;
 		}
@@ -117,7 +118,8 @@
 		muxed_thread->pipe[0] = muxed_thread->pipe[1] = -1;
 		/* Setup a pipe so we can poke the thread itself when needed */
 		if (pipe(muxed_thread->pipe)) {
-			ast_debug(1, "Failed to create a pipe for poking a multiplexed thread for bridge '%p'\n", bridge);
+			ast_debug(1, "Failed to create a pipe for poking a multiplexed thread for bridge %p\n",
+				bridge);
 			ao2_ref(muxed_thread, -1);
 			ao2_unlock(muxed_threads);
 			return -1;
@@ -126,14 +128,16 @@
 		/* Setup each pipe for non-blocking operation */
 		flags = fcntl(muxed_thread->pipe[0], F_GETFL);
 		if (fcntl(muxed_thread->pipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
-			ast_log(LOG_WARNING, "Failed to setup first nudge pipe for non-blocking operation on %p (%d: %s)\n", bridge, errno, strerror(errno));
+			ast_log(LOG_WARNING, "Failed to setup first nudge pipe for non-blocking operation on %p (%d: %s)\n",
+				bridge, errno, strerror(errno));
 			ao2_ref(muxed_thread, -1);
 			ao2_unlock(muxed_threads);
 			return -1;
 		}
 		flags = fcntl(muxed_thread->pipe[1], F_GETFL);
 		if (fcntl(muxed_thread->pipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
-			ast_log(LOG_WARNING, "Failed to setup second nudge pipe for non-blocking operation on %p (%d: %s)\n", bridge, errno, strerror(errno));
+			ast_log(LOG_WARNING, "Failed to setup second nudge pipe for non-blocking operation on %p (%d: %s)\n",
+				bridge, errno, strerror(errno));
 			ao2_ref(muxed_thread, -1);
 			ao2_unlock(muxed_threads);
 			return -1;
@@ -144,9 +148,11 @@
 
 		/* Finally link us into the container so others may find us */
 		ao2_link(muxed_threads, muxed_thread);
-		ast_debug(1, "Created multiplexed thread '%p' for bridge '%p'\n", muxed_thread, bridge);
+		ast_debug(1, "Created multiplexed thread %p for bridge %p\n",
+			muxed_thread, bridge);
 	} else {
-		ast_debug(1, "Found multiplexed thread '%p' for bridge '%p'\n", muxed_thread, bridge);
+		ast_debug(1, "Found multiplexed thread %p for bridge %p\n",
+			muxed_thread, bridge);
 	}
 
 	/* Increase the number of bridges using this multiplexed bridge */
@@ -179,7 +185,8 @@
 	}
 
 	if (write(muxed_thread->pipe[1], &nudge, sizeof(nudge)) != sizeof(nudge)) {
-		ast_log(LOG_ERROR, "We couldn't poke multiplexed thread '%p'... something is VERY wrong\n", muxed_thread);
+		ast_log(LOG_ERROR, "We couldn't poke multiplexed thread %p... something is VERY wrong\n",
+			muxed_thread);
 	}
 
 	while (muxed_thread->waiting) {
@@ -205,7 +212,7 @@
 		/* Other bridges are still using the multiplexed thread. */
 		ao2_unlock(muxed_threads);
 	} else {
-		ast_debug(1, "Unlinking multiplexed thread '%p' since nobody is using it anymore\n",
+		ast_debug(1, "Unlinking multiplexed thread %p since nobody is using it anymore\n",
 			muxed_thread);
 		ao2_unlink(muxed_threads, muxed_thread);
 		ao2_unlock(muxed_threads);
@@ -232,7 +239,7 @@
 	struct multiplexed_thread *muxed_thread = data;
 	int fds = muxed_thread->pipe[0];
 
-	ast_debug(1, "Starting actual thread for multiplexed thread '%p'\n", muxed_thread);
+	ast_debug(1, "Starting actual thread for multiplexed thread %p\n", muxed_thread);
 
 	ao2_lock(muxed_thread);
 
@@ -265,7 +272,8 @@
 
 			if (read(muxed_thread->pipe[0], &nudge, sizeof(nudge)) < 0) {
 				if (errno != EINTR && errno != EAGAIN) {
-					ast_log(LOG_WARNING, "read() failed for pipe on multiplexed thread '%p': %s\n", muxed_thread, strerror(errno));
+					ast_log(LOG_WARNING, "read() failed for pipe on multiplexed thread %p: %s\n",
+						muxed_thread, strerror(errno));
 				}
 			}
 		}
@@ -292,7 +300,7 @@
 
 	ao2_unlock(muxed_thread);
 
-	ast_debug(1, "Stopping actual thread for multiplexed thread '%p'\n", muxed_thread);
+	ast_debug(1, "Stopping actual thread for multiplexed thread %p\n", muxed_thread);
 	ao2_ref(muxed_thread, -1);
 
 	return NULL;
@@ -316,7 +324,7 @@
 		if (ast_pthread_create(&muxed_thread->thread, NULL, multiplexed_thread_function, muxed_thread)) {
 			muxed_thread->thread = AST_PTHREADT_NULL;/* For paranoia's sake. */
 			ao2_ref(muxed_thread, -1);
-			ast_log(LOG_WARNING, "Failed to create the common thread for multiplexed thread '%p', trying next time\n",
+			ast_log(LOG_WARNING, "Failed to create the common thread for multiplexed thread %p, trying next time\n",
 				muxed_thread);
 		}
 	}
@@ -401,7 +409,8 @@
 	struct ast_channel *c1 = AST_LIST_LAST(&bridge->channels)->chan;
 	struct multiplexed_thread *muxed_thread = bridge->bridge_pvt;
 
-	ast_debug(1, "Adding channel '%s' to multiplexed thread '%p' for monitoring\n", ast_channel_name(bridge_channel->chan), muxed_thread);
+	ast_debug(1, "Adding channel %p(%s) to multiplexed thread %p for monitoring\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), muxed_thread);
 
 	if (!bridge_channel->suspended) {
 		multiplexed_chan_add(muxed_thread, bridge_channel->chan);
@@ -426,7 +435,8 @@
 {
 	struct multiplexed_thread *muxed_thread = bridge->bridge_pvt;
 
-	ast_debug(1, "Removing channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), muxed_thread);
+	ast_debug(1, "Removing channel %p(%s) from multiplexed thread %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), muxed_thread);
 
 	if (!bridge_channel->suspended) {
 		multiplexed_chan_remove(muxed_thread, bridge_channel->chan);
@@ -438,7 +448,8 @@
 {
 	struct multiplexed_thread *muxed_thread = bridge->bridge_pvt;
 
-	ast_debug(1, "Suspending channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), muxed_thread);
+	ast_debug(1, "Suspending channel %p(%s) from multiplexed thread %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), muxed_thread);
 
 	multiplexed_chan_remove(muxed_thread, bridge_channel->chan);
 }
@@ -448,7 +459,8 @@
 {
 	struct multiplexed_thread *muxed_thread = bridge->bridge_pvt;
 
-	ast_debug(1, "Unsuspending channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), muxed_thread);
+	ast_debug(1, "Unsuspending channel %p(%s) from multiplexed thread %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), muxed_thread);
 
 	multiplexed_chan_add(muxed_thread, bridge_channel->chan);
 }

Modified: team/group/bridge_construction/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/bridges/bridge_softmix.c?view=diff&rev=382271&r1=382270&r2=382271
==============================================================================
--- team/group/bridge_construction/bridges/bridge_softmix.c (original)
+++ team/group/bridge_construction/bridges/bridge_softmix.c Thu Feb 28 12:51:00 2013
@@ -660,7 +660,8 @@
 		 * from the current rate we are using. */
 		if (softmix_data->internal_rate != stats->locked_rate) {
 			softmix_data->internal_rate = stats->locked_rate;
-			ast_debug(1, " Bridge is locked in at sample rate %d\n", softmix_data->internal_rate);
+			ast_debug(1, "Bridge is locked in at sample rate %d\n",
+				softmix_data->internal_rate);
 			return 1;
 		}
 	} else if (stats->num_above_internal_rate >= 2) {
@@ -699,13 +700,15 @@
 			}
 		}
 
-		ast_debug(1, " Bridge changed from %d To %d\n", softmix_data->internal_rate, best_rate);
+		ast_debug(1, "Bridge changed from %d To %d\n",
+			softmix_data->internal_rate, best_rate);
 		softmix_data->internal_rate = best_rate;
 		return 1;
 	} else if (!stats->num_at_internal_rate && !stats->num_above_internal_rate) {
 		/* In this case, the highest supported rate is actually lower than the internal rate */
 		softmix_data->internal_rate = stats->highest_supported_rate;
-		ast_debug(1, " Bridge changed from %d to %d\n", softmix_data->internal_rate, stats->highest_supported_rate);
+		ast_debug(1, "Bridge changed from %d to %d\n",
+			softmix_data->internal_rate, stats->highest_supported_rate);
 		return 1;
 	}
 	return 0;

Modified: team/group/bridge_construction/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/bridging.c?view=diff&rev=382271&r1=382270&r2=382271
==============================================================================
--- team/group/bridge_construction/main/bridging.c (original)
+++ team/group/bridge_construction/main/bridging.c Thu Feb 28 12:51:00 2013
@@ -84,7 +84,8 @@
 	if (ast_strlen_zero(technology->name)
 		|| !technology->capabilities
 		|| !technology->write) {
-		ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n", technology->name);
+		ast_log(LOG_WARNING, "Bridge technology %s failed registration sanity check.\n",
+			technology->name);
 		return -1;
 	}
 
@@ -93,7 +94,8 @@
 	/* Look for duplicate bridge technology already using this name, or already registered */
 	AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) {
 		if ((!strcasecmp(current->name, technology->name)) || (current == technology)) {
-			ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n", technology->name);
+			ast_log(LOG_WARNING, "A bridge technology of %s already claims to exist in our world.\n",
+				technology->name);
 			AST_RWLIST_UNLOCK(&bridge_technologies);
 			return -1;
 		}
@@ -151,8 +153,9 @@
 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);
+	ast_debug(1, "Setting bridge channel %p(%s) state from:%d to:%d\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), bridge_channel->state,
+		new_state);
 
 	/* Change the state on the bridge channel */
 	bridge_channel->state = new_state;
@@ -176,7 +179,7 @@
 		return -1;
 	}
 
-	ast_debug(1, "BUGBUG Queueing action type:%d sub:%d on bridge %p\n",
+	ast_debug(1, "Queueing action type:%d sub:%d on bridge %p\n",
 		action->frametype, action->subclass.integer, bridge);
 
 	ao2_lock(bridge);
@@ -196,8 +199,9 @@
 		return -1;
 	}
 
-	ast_debug(1, "BUGBUG Queueing action type:%d sub:%d on bridge channel %p\n",
-		action->frametype, action->subclass.integer, bridge_channel);
+	ast_debug(1, "Queueing action type:%d sub:%d on bridge channel %p(%s)\n",
+		action->frametype, action->subclass.integer, bridge_channel,
+		ast_channel_name(bridge_channel->chan));
 
 	ao2_lock(bridge_channel);
 	AST_LIST_INSERT_TAIL(&bridge_channel->action_queue, dup, frame_list);
@@ -358,12 +362,14 @@
 	bridge_channel->in_bridge = 0;
 	ao2_unlock(bridge_channel);
 
-	ast_debug(1, "Pulling bridge channel %p from bridge %p\n", bridge_channel, bridge);
+	ast_debug(1, "Pulling bridge channel %p(%s) from bridge %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), bridge);
 
 	if (!bridge_channel->just_joined) {
 		/* Tell the bridge technology we are leaving so they tear us down */
-		ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p\n",
-			bridge->technology->name, bridge_channel, bridge);
+		ast_debug(1, "Giving bridge technology %s notification that %p(%s) is leaving bridge %p\n",
+			bridge->technology->name, bridge_channel,
+			ast_channel_name(bridge_channel->chan), bridge);
 		if (bridge->technology->leave) {
 			bridge->technology->leave(bridge, bridge_channel);
 		}
@@ -428,8 +434,9 @@
 
 		bridge_channel2 = find_bridge_channel(bridge, swap);
 		if (bridge_channel2) {
-			ast_debug(1, "Swapping bridge channel %p out from bridge %p so bridge channel %p can slip in\n",
-				bridge_channel2, bridge, bridge_channel);
+			ast_debug(1, "Swapping bridge channel %p(%s) out from bridge %p so bridge channel %p(%s) can slip in\n",
+				bridge_channel2, ast_channel_name(bridge_channel2->chan), bridge,
+				bridge_channel, ast_channel_name(bridge_channel->chan));
 			ao2_lock(bridge_channel2);
 			switch (bridge_channel2->state) {
 			case AST_BRIDGE_CHANNEL_STATE_WAIT:
@@ -444,7 +451,8 @@
 		}
 	}
 
-	ast_debug(1, "Pushing bridge channel %p into bridge %p\n", bridge_channel, bridge);
+	ast_debug(1, "Pushing bridge channel %p(%s) into bridge %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), bridge);
 
 	/* Add channel to the bridge */
 	AST_LIST_INSERT_TAIL(&bridge->channels, bridge_channel, entry);
@@ -651,8 +659,9 @@
 			}
 			ao2_unlock(bridge_channel);
 		} else if (frame->frametype == AST_FRAME_CONTROL && bridge_drop_control_frame(frame->subclass.integer)) {
-			ast_debug(1, "Dropping control frame %d from bridge channel %p\n",
-				frame->subclass.integer, bridge_channel);
+			ast_debug(1, "Dropping control frame %d from bridge channel %p(%s)\n",
+				frame->subclass.integer, bridge_channel,
+				ast_channel_name(bridge_channel->chan));
 		} else if (frame->frametype == AST_FRAME_DTMF_BEGIN || frame->frametype == AST_FRAME_DTMF_END) {
 			int dtmf_passthrough = bridge_channel->features ?
 				bridge_channel->features->dtmf_passthrough :
@@ -763,12 +772,14 @@
 		bridge_make_compatible(bridge, bridge_channel);
 
 		/* Tell the bridge technology we are joining so they set us up */
-		ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n",
-			bridge->technology->name, bridge_channel, bridge);
+		ast_debug(1, "Giving bridge technology %s notification that %p(%s) is joining bridge %p\n",
+			bridge->technology->name, bridge_channel,
+			ast_channel_name(bridge_channel->chan), bridge);
 		if (bridge->technology->join
 			&& bridge->technology->join(bridge, bridge_channel)) {
-			ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n",
-				bridge->technology->name, bridge_channel, bridge);
+			ast_debug(1, "Bridge technology %s failed to join %p(%s) to bridge %p\n",
+				bridge->technology->name, bridge_channel,
+				ast_channel_name(bridge_channel->chan), bridge);
 		}
 
 		/*
@@ -1046,6 +1057,7 @@
 static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct ast_format formats[2];
+
 	ast_format_copy(&formats[0], ast_channel_readformat(bridge_channel->chan));
 	ast_format_copy(&formats[1], ast_channel_writeformat(bridge_channel->chan));
 
@@ -1057,18 +1069,22 @@
 		/* Read format is a no go... */
 		if (option_debug) {
 			char codec_buf[512];
-			ast_debug(1, "Bridge technology %s wants to read any of formats %s but channel has %s\n", bridge->technology->name,
+			ast_debug(1, "Bridge technology %s wants to read any of formats %s but channel has %s\n",
+				bridge->technology->name,
 				ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
 				ast_getformatname(&formats[0]));
 		}
 		/* Switch read format to the best one chosen */
 		if (ast_set_read_format(bridge_channel->chan, &best_format)) {
-			ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n", ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
+			ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n",
+				ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
 			return -1;
 		}
-		ast_debug(1, "Bridge %p put channel %s into read format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
+		ast_debug(1, "Bridge %p put channel %s into read format %s\n",
+			bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
 	} else {
-		ast_debug(1, "Bridge %p is happy that channel %s already has read format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[0]));
+		ast_debug(1, "Bridge %p is happy that channel %s already has read format %s\n",
+			bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[0]));
 	}
 
 	if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, &formats[1])) {
@@ -1078,18 +1094,22 @@
 		/* Write format is a no go... */
 		if (option_debug) {
 			char codec_buf[512];
-			ast_debug(1, "Bridge technology %s wants to write any of formats %s but channel has %s\n", bridge->technology->name,
+			ast_debug(1, "Bridge technology %s wants to write any of formats %s but channel has %s\n",
+				bridge->technology->name,
 				ast_getformatname_multiple(codec_buf, sizeof(codec_buf), bridge->technology->format_capabilities),
 				ast_getformatname(&formats[1]));
 		}
 		/* Switch write format to the best one chosen */
 		if (ast_set_write_format(bridge_channel->chan, &best_format)) {
-			ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n", ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
+			ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n",
+				ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
 			return -1;
 		}
-		ast_debug(1, "Bridge %p put channel %s into write format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
+		ast_debug(1, "Bridge %p put channel %s into write format %s\n",
+			bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format));
 	} else {
-		ast_debug(1, "Bridge %p is happy that channel %s already has write format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[1]));
+		ast_debug(1, "Bridge %p is happy that channel %s already has write format %s\n",
+			bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[1]));
 	}
 
 	return 0;
@@ -1123,7 +1143,7 @@
 	struct ast_bridge_channel *bridge_channel;
 
 	if (bridge->dissolved) {
-		ast_debug(1, "Bridge '%p' is dissolved, not performing smart bridge operation.\n",
+		ast_debug(1, "Bridge %p is dissolved, not performing smart bridge operation.\n",
 			bridge);
 		return 0;
 	}
@@ -1150,7 +1170,7 @@
 	}
 
 	if (!new_capabilities) {
-		ast_debug(1, "Bridge '%p' has no new capabilities, not performing smart bridge operation.\n",
+		ast_debug(1, "Bridge %p has no new capabilities, not performing smart bridge operation.\n",
 			bridge);
 		return 0;
 	}
@@ -1205,8 +1225,9 @@
 		}
 
 		/* First we part them from the old technology */
-		ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p (really %p)\n",
-			old_technology->name, bridge_channel, &temp_bridge, bridge);
+		ast_debug(1, "Giving bridge technology %s notification that %p(%s) is leaving bridge %p (really %p)\n",
+			old_technology->name, bridge_channel, ast_channel_name(bridge_channel->chan),
+			&temp_bridge, bridge);
 		if (old_technology->leave) {
 			old_technology->leave(&temp_bridge, bridge_channel);
 		}
@@ -1215,11 +1236,13 @@
 		bridge_make_compatible(bridge, bridge_channel);
 
 		/* Third we join them to the new technology */
-		ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n",
-			new_technology->name, bridge_channel, bridge);
+		ast_debug(1, "Giving bridge technology %s notification that %p(%s) is joining bridge %p\n",
+			new_technology->name, bridge_channel, ast_channel_name(bridge_channel->chan),
+			bridge);
 		if (new_technology->join && new_technology->join(bridge, bridge_channel)) {
-			ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n",
-				new_technology->name, bridge_channel, bridge);
+			ast_debug(1, "Bridge technology %s failed to join %p(%s) to bridge %p\n",
+				new_technology->name, bridge_channel,
+				ast_channel_name(bridge_channel->chan), bridge);
 		}
 
 		/* Fourth we tell them to wake up so they become aware that the above has happened */
@@ -1268,15 +1291,17 @@
 		ao2_unlock(bridge_channel);
 		ao2_lock(bridge_channel->bridge);
 	} else if (bridge_channel->suspended) {
-		ast_debug(1, "Going into a multithreaded signal wait for bridge channel %p of bridge %p\n",
-			bridge_channel, bridge_channel->bridge);
+		ast_debug(1, "Going into a multithreaded signal wait for bridge channel %p(%s) of bridge %p\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan),
+			bridge_channel->bridge);
 		ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
 		ao2_unlock(bridge_channel);
 		ao2_lock(bridge_channel->bridge);
 	} else {
 		ao2_unlock(bridge_channel);
-		ast_debug(10, "Going into a multithreaded waitfor for bridge channel %p of bridge %p\n",
-			bridge_channel, bridge_channel->bridge);
+		ast_debug(10, "Going into a multithreaded waitfor for bridge channel %p(%s) of bridge %p\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan),
+			bridge_channel->bridge);
 		chan = ast_waitfor_nandfds(&bridge_channel->chan, 1, fds, nfds, NULL, &outfd, &ms);
 		ao2_lock(bridge_channel->bridge);
 		if (!bridge_channel->suspended) {
@@ -1291,8 +1316,9 @@
 	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(%s) of bridge %p\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan),
+			bridge_channel->bridge);
 		ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
 	}
 	ao2_unlock(bridge_channel);
@@ -1362,12 +1388,13 @@
 		int execution_time = 0;
 
 		if (ast_tvdiff_ms(hook->interval_trip_time, start) > 0) {
-			ast_debug(1, "Hook '%p' on '%p' wants to happen in the future, stopping our traversal\n",
-				hook, bridge_channel);
+			ast_debug(1, "Hook %p on bridge channel %p(%s) wants to happen in the future, stopping our traversal\n",
+				hook, bridge_channel, ast_channel_name(bridge_channel->chan));
 			break;
 		}
 
-		ast_debug(1, "Executing hook '%p' on channel '%p'\n", hook, bridge_channel);
+		ast_debug(1, "Executing hook %p on bridge channel %p(%s)\n",
+			hook, bridge_channel, ast_channel_name(bridge_channel->chan));
 		res = hook->callback(bridge, bridge_channel, hook->hook_pvt);
 
 		/*
@@ -1377,7 +1404,8 @@
 		ast_heap_pop(bridge_channel->features->interval_hooks);
 
 		if (res || !hook->interval) {
-			ast_debug(1, "Hook '%p' is being removed from '%p'\n", hook, bridge_channel);
+			ast_debug(1, "Hook %p is being removed from bridge channel %p(%s)\n",
+				hook, bridge_channel, ast_channel_name(bridge_channel->chan));
 			if (hook->destructor) {
 				hook->destructor(hook->hook_pvt);
 			}
@@ -1385,7 +1413,8 @@
 			continue;
 		}
 
-		ast_debug(1, "Updating hook '%p' and adding it back to '%p'\n", hook, bridge_channel);
+		ast_debug(1, "Updating hook %p and adding it back to bridge channel %p(%s)\n",
+			hook, bridge_channel, ast_channel_name(bridge_channel->chan));
 
 		execution_time = ast_tvdiff_ms(ast_tvnow(), start);
 
@@ -1393,8 +1422,6 @@
 		start = ast_tvnow();
 
 		hook->interval_trip_time = ast_tvadd(start, ast_samp2tv(hook->interval - execution_time, 1000));
-
-		ast_debug(1, "Sticking hook '%p' in heap on '%p'\n", hook, bridge_channel->features);
 
 		hook->seqno = ast_atomic_fetchadd_int((int *)&bridge_channel->features->interval_sequence, +1);
 		ast_heap_push(bridge_channel->features->interval_hooks, hook);
@@ -1422,10 +1449,12 @@
 
 		/* If the above timed out simply exit */
 		if (!res) {
-			ast_debug(1, "DTMF feature string collection on bridge channel %p timed out\n", bridge_channel);
+			ast_debug(1, "DTMF feature string collection on bridge channel %p(%s) timed out\n",
+				bridge_channel, ast_channel_name(bridge_channel->chan));
 			break;
 		} else if (res < 0) {
-			ast_debug(1, "DTMF feature string collection failed on bridge channel %p for some reason\n", bridge_channel);
+			ast_debug(1, "DTMF feature string collection failed on bridge channel %p(%s) for some reason\n",
+				bridge_channel, ast_channel_name(bridge_channel->chan));
 			break;
 		}
 
@@ -1433,7 +1462,8 @@
 		/* Add the above DTMF into the DTMF string so we can do our matching */
 		dtmf[dtmf_len++] = res;
 
-		ast_debug(1, "DTMF feature string on bridge channel %p is now '%s'\n", bridge_channel, dtmf);
+		ast_debug(1, "DTMF feature string on bridge channel %p(%s) is now '%s'\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan), dtmf);
 
 		/* Assume that we do not want to look for DTMF any longer */
 		look_for_dtmf = 0;
@@ -1442,14 +1472,17 @@
 		AST_LIST_TRAVERSE(&features->hooks, hook, entry) {
 			/* If this hook matches just break out now */
 			if (!strcmp(hook->dtmf, dtmf)) {
-				ast_debug(1, "DTMF feature hook %p matched DTMF string '%s' on bridge channel %p\n", hook, dtmf, bridge_channel);
+				ast_debug(1, "DTMF feature hook %p matched DTMF string '%s' on bridge channel %p(%s)\n",
+					hook, dtmf, bridge_channel, ast_channel_name(bridge_channel->chan));
 				look_for_dtmf = 0;
 				break;
 			} else if (!strncmp(hook->dtmf, dtmf, dtmf_len)) {
-				ast_debug(1, "DTMF feature hook %p can match DTMF string '%s', it wants '%s', on bridge channel %p\n", hook, dtmf, hook->dtmf, bridge_channel);
+				ast_debug(1, "DTMF feature hook %p can match DTMF string '%s', it wants '%s', on bridge channel %p(%s)\n",
+					hook, dtmf, hook->dtmf, bridge_channel, ast_channel_name(bridge_channel->chan));
 				look_for_dtmf = 1;
 			} else {
-				ast_debug(1, "DTMF feature hook %p does not match DTMF string '%s', it wants '%s', on bridge channel %p\n", hook, dtmf, hook->dtmf, bridge_channel);
+				ast_debug(1, "DTMF feature hook %p does not match DTMF string '%s', it wants '%s', on bridge channel %p(%s)\n",
+					hook, dtmf, hook->dtmf, bridge_channel, ast_channel_name(bridge_channel->chan));
 			}
 		}
 
@@ -1503,7 +1536,8 @@
 /*! \brief Internal function that plays back DTMF on a bridge channel */
 static void bridge_channel_dtmf_stream(struct ast_bridge_channel *bridge_channel, const char *dtmf)
 {
-	ast_debug(1, "Playing DTMF stream '%s' out to bridge channel %p\n", dtmf, bridge_channel);
+	ast_debug(1, "Playing DTMF stream '%s' out to bridge channel %p(%s)\n",
+		dtmf, bridge_channel, ast_channel_name(bridge_channel->chan));
 	ast_dtmf_stream(bridge_channel->chan, NULL, dtmf, 0, 0);
 }
 
@@ -1590,8 +1624,8 @@
 	/* Record the thread that will be the owner of us */
 	bridge_channel->thread = pthread_self();
 
-	ast_debug(1, "Joining bridge channel %p to bridge %p\n",
-		bridge_channel, bridge_channel->bridge);
+	ast_debug(1, "Joining bridge channel %p(%s) to bridge %p\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan), bridge_channel->bridge);
 
 	ao2_lock(bridge_channel->bridge);
 
@@ -1718,19 +1752,23 @@
 
 	/* Restore original formats of the channel as they came in */
 	if (ast_format_cmp(ast_channel_readformat(bridge_channel->chan), &formats[0]) == AST_FORMAT_CMP_NOT_EQUAL) {
-		ast_debug(1, "Bridge is returning %p to read format %s(%d)\n",
-			bridge_channel, ast_getformatname(&formats[0]), formats[0].id);
+		ast_debug(1, "Bridge is returning bridge channel %p(%s) to read format %s\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan),
+			ast_getformatname(&formats[0]));
 		if (ast_set_read_format(bridge_channel->chan, &formats[0])) {
-			ast_debug(1, "Bridge failed to return channel %p to read format %s(%d)\n",
-				bridge_channel, ast_getformatname(&formats[0]), formats[0].id);
+			ast_debug(1, "Bridge failed to return bridge channel %p(%s) to read format %s\n",
+				bridge_channel, ast_channel_name(bridge_channel->chan),
+				ast_getformatname(&formats[0]));
 		}
 	}
 	if (ast_format_cmp(ast_channel_writeformat(bridge_channel->chan), &formats[1]) == AST_FORMAT_CMP_NOT_EQUAL) {
-		ast_debug(1, "Bridge is returning %p to write format %s(%d)\n",
-			bridge_channel, ast_getformatname(&formats[1]), formats[1].id);
+		ast_debug(1, "Bridge is returning bridge channel %p(%s) to write format %s\n",
+			bridge_channel, ast_channel_name(bridge_channel->chan),
+			ast_getformatname(&formats[1]));
 		if (ast_set_write_format(bridge_channel->chan, &formats[1])) {
-			ast_debug(1, "Bridge failed to return channel %p to write format %s(%d)\n",
-				bridge_channel, ast_getformatname(&formats[1]), formats[1].id);
+			ast_debug(1, "Bridge failed to return bridge channel %p(%s) to write format %s\n",
+				bridge_channel, ast_channel_name(bridge_channel->chan),
+				ast_getformatname(&formats[1]));
 		}
 	}
 }
@@ -2557,7 +2595,7 @@
 	hook->destructor = destructor;
 	hook->hook_pvt = hook_pvt;
 
-	ast_debug(1, "Putting interval hook '%p' in the interval hooks heap on features '%p'\n",
+	ast_debug(1, "Putting interval hook %p in the interval hooks heap on features %p\n",
 		hook, features);
 	hook->interval_trip_time = ast_tvadd(ast_tvnow(), ast_samp2tv(hook->interval, 1000));
 	hook->seqno = ast_atomic_fetchadd_int((int *)&features->interval_sequence, +1);
@@ -2598,7 +2636,8 @@
 		dtmf = builtin_features_dtmf[feature];
 		/* If no DTMF is still available (ie: it has been disabled) then error out now */
 		if (ast_strlen_zero(dtmf)) {
-			ast_debug(1, "Failed to enable built in feature %d on %p, no DTMF string is available for it.\n", feature, features);
+			ast_debug(1, "Failed to enable built in feature %d on %p, no DTMF string is available for it.\n",
+				feature, features);
 			return -1;
 		}
 	}




More information about the asterisk-commits mailing list