[asterisk-commits] mmichelson: branch mmichelson/transfer r386460 - /team/mmichelson/transfer/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 24 16:33:40 CDT 2013


Author: mmichelson
Date: Wed Apr 24 16:33:36 2013
New Revision: 386460

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386460
Log:
Add support for blind transferring to a parking extension.

Currently, the relevant code is commented out. This is because
it is dependent on parking code not present in this branch. Once
team/jrose/bridge_projects is merged, the code may be uncommented
and tested properly.


Modified:
    team/mmichelson/transfer/main/bridging.c

Modified: team/mmichelson/transfer/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/main/bridging.c?view=diff&rev=386460&r1=386459&r2=386460
==============================================================================
--- team/mmichelson/transfer/main/bridging.c (original)
+++ team/mmichelson/transfer/main/bridging.c Wed Apr 24 16:33:36 2013
@@ -4378,6 +4378,48 @@
 	return 0;
 }
 
+enum try_parking_result {
+	PARKING_SUCCESS,
+	PARKING_FAILURE,
+	PARKING_NOT_APPLICABLE,
+};
+
+static enum try_parking_result try_parking(struct ast_bridge *bridge, struct ast_channel *transferer)
+{
+	/* XXX The following is all commented out because the functionality is not
+	 * present yet. The functions referenced here are available at team/jrose/bridge_projects.
+	 * Once the code there has been merged into team/group/bridge_construction,
+	 * this can be uncommented and tested
+	 */
+
+#if 0
+	RAII_VAR(struct ast_bridge_channel *, transferer_bridge_channel, NULL, ao2_cleanup);
+	struct ast_exten *parking_exten;
+
+	{
+		SCOPED_LOCK(lock, transferer, ast_channel_lock, ast_channel_unlock);
+		transfer_bridge_channel = ast_channel_internal_bridge_channel(transferer);
+		if (!transferer) {
+			return PARKING_FAILURE;
+		}
+		ao2_ref(transferer_bridge_channel, +1);
+	}
+
+	/* XXX the second parameter here is a channel to potentially put into autoservice.
+	 * We only would need to put the transferer into autoservice if this is called
+	 * from the transferer's thread that is servicing the channel. Would this
+	 * ever happen?
+	 */
+	parking_exten = ast_get_parking_exten(exten, NULL, context);
+	if (parking_exten) {
+		return ast_park_blind_xfer(bridge, transferer, parking_exten) == 0 ?
+			PARKING_SUCCESS : PARKING_FAILURE;
+	}
+#endif
+
+	return PARKING_NOT_APPLICABLE;
+}
+
 enum ast_transfer_result ast_bridge_blind_transfer(struct ast_channel *transferer,
 		const char *exten, const char *context, struct ast_framehook *hook)
 {
@@ -4386,6 +4428,7 @@
 	RAII_VAR(struct ast_channel *, transferee, NULL, ao2_cleanup);
 	int do_bridge_transfer;
 	int transfer_prohibited;
+	enum try_parking_result parking_result;
 
 	{
 		SCOPED_LOCK(lock, transferer, ast_channel_lock, ast_channel_unlock);
@@ -4394,6 +4437,17 @@
 			return AST_BRIDGE_TRANSFER_INVALID;
 		}
 		ao2_ref(bridge, +1);
+	}
+
+	parking_result = try_parking(bridge, transferer);
+	switch (parking_result) {
+	case PARKING_SUCCESS:
+		return AST_BRIDGE_TRANSFER_SUCCESS;
+	case PARKING_FAILURE:
+		return AST_BRIDGE_TRANSFER_FAIL;
+	case PARKING_NOT_APPLICABLE:
+	default:
+		break;
 	}
 
 	{




More information about the asterisk-commits mailing list