[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r391452 - /team/mmichelson/tran...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 11 17:17:40 CDT 2013


Author: mmichelson
Date: Tue Jun 11 17:17:39 2013
New Revision: 391452

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391452
Log:
Correct some errors that occurred in scenarios where bridges were linked to complete a transfer.

* Lock the local channel when getting its peer.
* Unref the local channel peer when we are finished with it.
* Don't try to use ARRAY_LEN on an array parameter in a function. That doesn't work.


Modified:
    team/mmichelson/transfer_stasis/main/bridging.c
    team/mmichelson/transfer_stasis/main/stasis_bridging.c

Modified: team/mmichelson/transfer_stasis/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/bridging.c?view=diff&rev=391452&r1=391451&r2=391452
==============================================================================
--- team/mmichelson/transfer_stasis/main/bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/bridging.c Tue Jun 11 17:17:39 2013
@@ -5741,8 +5741,13 @@
 	}
 
 	if (bridge2) {
-		/* XXX Need to lock local_chan here and check for failure */
-		struct ast_channel *local_chan2 = ast_local_get_peer(local_chan);
+		RAII_VAR(struct ast_channel *, local_chan2, NULL, ao2_cleanup);
+
+		ast_channel_lock(local_chan);
+		local_chan2 = ast_local_get_peer(local_chan);
+		ast_channel_unlock(local_chan);
+
+		ast_assert(local_chan2 != NULL);
 
 		/* XXX This isn't accurate since the channels here aren't necessarily
 		 * labeled correctly for the publication. i.e. chan1 is not necessarily

Modified: team/mmichelson/transfer_stasis/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/stasis_bridging.c?view=diff&rev=391452&r1=391451&r2=391452
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Tue Jun 11 17:17:39 2013
@@ -522,7 +522,7 @@
 	}
 
 	transfer_msg->dest_type = AST_ATTENDED_TRANSFER_DEST_LINK;
-	for (i = 0; i < ARRAY_LEN(locals); ++i) {
+	for (i = 0; i < 2; ++i) {
 		transfer_msg->dest.links[i].channel = ast_strdup(ast_channel_uniqueid(locals[i]->channel));
 		if (!transfer_msg->dest.links[i].channel) {
 			return;
@@ -643,7 +643,7 @@
 		ast_log(LOG_NOTICE, "Transfer to application %s\n", xfer_msg->dest.app);
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_LINK:
-		ast_log(LOG_NOTICE, "Transfer linking two bridges. First bridge and chan: %s and %s. Second bridge and chan: %s and %s\n",
+		ast_log(LOG_NOTICE, "Transfer linking two bridges.\n\t\tFirst bridge and chan: %s and %s.\n\t\tSecond bridge and chan: %s and %s\n",
 				xfer_msg->dest.links[0].channel, xfer_msg->dest.links[0].bridge,
 				xfer_msg->dest.links[1].channel, xfer_msg->dest.links[1].bridge);
 		break;




More information about the asterisk-commits mailing list