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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 7 18:16:39 CDT 2013


Author: mmichelson
Date: Fri Jun  7 18:16:37 2013
New Revision: 390939

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390939
Log:
Publish a stasis message on blind transfer.


Modified:
    team/mmichelson/transfer_stasis/main/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=390939&r1=390938&r2=390939
==============================================================================
--- team/mmichelson/transfer_stasis/main/bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/bridging.c Fri Jun  7 18:16:37 2013
@@ -5824,16 +5824,19 @@
 	int do_bridge_transfer;
 	int transfer_prohibited;
 	enum try_parking_result parking_result;
+	enum ast_transfer_result transfer_result;
 
 	bridge = acquire_bridge(transferer);
 	if (!bridge) {
-		return AST_BRIDGE_TRANSFER_INVALID;
+		transfer_result = AST_BRIDGE_TRANSFER_INVALID;
+		goto publish;
 	}
 	ast_channel_lock(transferer);
 	bridge_channel = ast_channel_get_bridge_channel(transferer);
 	ast_channel_unlock(transferer);
 	if (!bridge_channel) {
-		return AST_BRIDGE_TRANSFER_INVALID;
+		transfer_result = AST_BRIDGE_TRANSFER_INVALID;
+		goto publish;
 	}
 
 	/* Take off hold if they are on hold. */
@@ -5842,9 +5845,11 @@
 	parking_result = try_parking(bridge, transferer, exten, context);
 	switch (parking_result) {
 	case PARKING_SUCCESS:
-		return AST_BRIDGE_TRANSFER_SUCCESS;
+		transfer_result = AST_BRIDGE_TRANSFER_SUCCESS;
+		goto publish;
 	case PARKING_FAILURE:
-		return AST_BRIDGE_TRANSFER_FAIL;
+		transfer_result = AST_BRIDGE_TRANSFER_FAIL;
+		goto publish;
 	case PARKING_NOT_APPLICABLE:
 	default:
 		break;
@@ -5855,10 +5860,12 @@
 
 		channels = ast_bridge_peers_nolock(bridge);
 		if (!channels) {
-			return AST_BRIDGE_TRANSFER_FAIL;
+			transfer_result = AST_BRIDGE_TRANSFER_FAIL;
+			goto publish;
 		}
 		if (ao2_container_count(channels) <= 1) {
-			return AST_BRIDGE_TRANSFER_INVALID;
+			transfer_result = AST_BRIDGE_TRANSFER_INVALID;
+			goto publish;
 		}
 		transfer_prohibited = ast_test_flag(&bridge->feature_flags,
 				AST_BRIDGE_FLAG_TRANSFER_PROHIBITED);
@@ -5868,30 +5875,39 @@
 	}
 
 	if (transfer_prohibited) {
-		return AST_BRIDGE_TRANSFER_NOT_PERMITTED;
+		transfer_result = AST_BRIDGE_TRANSFER_NOT_PERMITTED;
+		goto publish;
 	}
 
 	set_blind_transfer_variables(transferer, channels);
 
 	if (do_bridge_transfer) {
-		return blind_transfer_bridge(transferer, bridge, exten, context,
+		transfer_result = blind_transfer_bridge(transferer, bridge, exten, context,
 				new_channel_cb, user_data);
+		goto publish;
 	}
 
 	/* Reaching this portion means that we're dealing with a two-party bridge */
 
 	transferee = get_transferee(channels, transferer);
 	if (!transferee) {
-		return AST_BRIDGE_TRANSFER_FAIL;
+		transfer_result = AST_BRIDGE_TRANSFER_FAIL;
+		goto publish;
 	}
 
 	if (bridge_channel_queue_blind_transfer(transferee, exten, context,
 				new_channel_cb, user_data)) {
-		return AST_BRIDGE_TRANSFER_FAIL;
+		transfer_result = AST_BRIDGE_TRANSFER_FAIL;
+		goto publish;
 	}
 
 	ast_bridge_remove(bridge, transferer);
-	return AST_BRIDGE_TRANSFER_SUCCESS;
+	transfer_result = AST_BRIDGE_TRANSFER_SUCCESS;
+
+publish:
+	/* XXX is_native parameter cannot be determined with current API */
+	ast_bridge_publish_blind_transfer(1, transfer_result, transferer, bridge, context, exten);
+	return transfer_result;
 }
 
 /*!




More information about the asterisk-commits mailing list