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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 1 13:26:06 CDT 2013


Author: mmichelson
Date: Wed May  1 13:26:04 2013
New Revision: 387132

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387132
Log:
Add routine to set BLINDTRANSFER channel variable.


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=387132&r1=387131&r2=387132
==============================================================================
--- team/mmichelson/transfer/main/bridging.c (original)
+++ team/mmichelson/transfer/main/bridging.c Wed May  1 13:26:04 2013
@@ -4882,6 +4882,43 @@
 	return PARKING_NOT_APPLICABLE;
 }
 
+/*!
+ * \internal
+ * \brief Set the BLINDTRANSFER variable as appropriate on channels involved in the transfer
+ *
+ * The transferer channel will have its BLINDTRANSFER variable set the same as its BRIDGEPEER
+ * variable. This will account for all channels that it is bridged to. The other channels
+ * involved in the transfer will have their BLINDTRANSFER variable set to the transferer
+ * channel's name.
+ *
+ * \param transferer The channel performing the blind transfer
+ * \param channels The channels belonging to the bridge
+ */
+static void set_blind_transfer_variables(struct ast_channel *transferer, struct ao2_container *channels)
+{
+	struct ao2_iterator iter;
+	struct ast_channel *chan;
+	const char *transferer_name;
+	const char *transferer_bridgepeer;
+
+	ast_channel_lock(transferer);
+	transferer_name = ast_strdupa(ast_channel_name(transferer));
+	transferer_bridgepeer = ast_strdupa(pbx_builtin_getvar_helper(transferer, "BRIDGEPEER"));
+	ast_channel_unlock(transferer);
+
+	for (iter = ao2_iterator_init(channels, 0);
+			(chan = ao2_iterator_next(&iter));
+			ao2_cleanup(chan)) {
+		if (chan == transferer) {
+			pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", transferer_bridgepeer);
+		} else {
+			pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", transferer_name);
+		}
+	}
+
+	ao2_iterator_destroy(&iter);
+}
+
 enum ast_transfer_result ast_bridge_transfer_blind(struct ast_channel *transferer,
 		const char *exten, const char *context, struct ast_framehook_interface *hook,
 		void (*new_channel_cb)(struct ast_channel *chan, void *user_data),
@@ -4932,6 +4969,8 @@
 	if (transfer_prohibited) {
 		return AST_BRIDGE_TRANSFER_NOT_PERMITTED;
 	}
+
+	set_blind_transfer_variables(transferer, channels);
 
 	if (do_bridge_transfer) {
 		return blind_transfer_bridge(transferer, bridge, exten, context, hook,




More information about the asterisk-commits mailing list