[asterisk-commits] mmichelson: branch mmichelson/transfer r387127 - in /team/mmichelson/transfer...

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


Author: mmichelson
Date: Wed May  1 12:36:02 2013
New Revision: 387127

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387127
Log:
Add another parameter to the blind transfer function.

This adds a callback that can be called on the channel that
runs dialplan during a blind transfer. The callback is called
after channel creation but before it starts to run dialplan.


Modified:
    team/mmichelson/transfer/include/asterisk/bridging.h
    team/mmichelson/transfer/main/bridging.c
    team/mmichelson/transfer/main/manager.c

Modified: team/mmichelson/transfer/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/include/asterisk/bridging.h?view=diff&rev=387127&r1=387126&r2=387127
==============================================================================
--- team/mmichelson/transfer/include/asterisk/bridging.h (original)
+++ team/mmichelson/transfer/include/asterisk/bridging.h Wed May  1 12:36:02 2013
@@ -1285,6 +1285,10 @@
  * by the caller of ast_bridge_blind_transfer(). If the transfer fails, then
  * the hook will not be attached to any call.
  *
+ * Callers may also provide a callback to be called on the channel that will
+ * be running dialplan. The user data passed into ast_bridge_transfer_blind
+ * will be given as the argument to the callback to be interpreted as desired.
+ *
  * \note Do not call this function with the transferer or its tech_pvt locked.
  *
  * \param transferer The channel performing the blind transfer
@@ -1294,7 +1298,9 @@
  * \return The success or failure result of the blind transfer
  */
 enum ast_transfer_result ast_bridge_transfer_blind(struct ast_channel *transferer,
-		const char *exten, const char *context, struct ast_framehook_interface *hook);
+		const char *exten, const char *context, struct ast_framehook_interface *hook,
+		void (*new_channel_cb)(struct ast_channel *chan, void *user_data),
+		void *user_data);
 
 /*!
  * \brief Attended transfer

Modified: team/mmichelson/transfer/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/main/bridging.c?view=diff&rev=387127&r1=387126&r2=387127
==============================================================================
--- team/mmichelson/transfer/main/bridging.c (original)
+++ team/mmichelson/transfer/main/bridging.c Wed May  1 12:36:02 2013
@@ -4729,7 +4729,9 @@
  */
 static enum ast_transfer_result blind_transfer_bridge(struct ast_channel *transferer,
 		struct ast_bridge *bridge, const char *exten, const char *context,
-		struct ast_framehook_interface *hook)
+		struct ast_framehook_interface *hook,
+		void (*new_channel_cb)(struct ast_channel *chan, void *user_data),
+		void *user_data)
 {
 	struct ast_channel *local;
 	char chan_name[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2];
@@ -4745,6 +4747,11 @@
 		ast_hangup(local);
 		return AST_BRIDGE_TRANSFER_FAIL;
 	}
+
+	if (new_channel_cb) {
+		new_channel_cb(local, user_data);
+	}
+
 	if (ast_call(local, chan_name, 0)) {
 		ast_hangup(local);
 		return AST_BRIDGE_TRANSFER_FAIL;
@@ -4804,7 +4811,9 @@
  * \retval non-zero Failed to queue the action
  */
 static int bridge_channel_queue_blind_transfer(struct ast_channel *transferee,
-		const char *exten, const char *context, struct ast_framehook_interface *hook)
+		const char *exten, const char *context, struct ast_framehook_interface *hook,
+		void (*new_channel_cb)(struct ast_channel *chan, void *user_data),
+		void *user_data)
 {
 	RAII_VAR(struct ast_bridge_channel *, transferee_bridge_channel, NULL, ao2_cleanup);
 	struct blind_transfer_data blind_data;
@@ -4822,6 +4831,10 @@
 		}
 	}
 
+	if (new_channel_cb) {
+		new_channel_cb(transferee, user_data);
+	}
+
 	ast_copy_string(blind_data.exten, exten, sizeof(blind_data.exten));
 	ast_copy_string(blind_data.context, context, sizeof(blind_data.context));
 
@@ -4870,7 +4883,9 @@
 }
 
 enum ast_transfer_result ast_bridge_transfer_blind(struct ast_channel *transferer,
-		const char *exten, const char *context, struct ast_framehook_interface *hook)
+		const char *exten, const char *context, struct ast_framehook_interface *hook,
+		void (*new_channel_cb)(struct ast_channel *chan, void *user_data),
+		void *user_data)
 {
 	RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
 	RAII_VAR(struct ao2_container *, channels, NULL, ao2_cleanup);
@@ -4919,7 +4934,8 @@
 	}
 
 	if (do_bridge_transfer) {
-		return blind_transfer_bridge(transferer, bridge, exten, context, hook);
+		return blind_transfer_bridge(transferer, bridge, exten, context, hook,
+				new_channel_cb, user_data);
 	}
 
 	/* Reaching this portion means that we're dealing with a two-party bridge */
@@ -4929,7 +4945,8 @@
 		return AST_BRIDGE_TRANSFER_FAIL;
 	}
 
-	if (bridge_channel_queue_blind_transfer(transferee, exten, context, hook)) {
+	if (bridge_channel_queue_blind_transfer(transferee, exten, context, hook,
+				new_channel_cb, user_data)) {
 		return AST_BRIDGE_TRANSFER_FAIL;
 	}
 

Modified: team/mmichelson/transfer/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/main/manager.c?view=diff&rev=387127&r1=387126&r2=387127
==============================================================================
--- team/mmichelson/transfer/main/manager.c (original)
+++ team/mmichelson/transfer/main/manager.c Wed May  1 12:36:02 2013
@@ -3919,7 +3919,7 @@
 		context = ast_channel_context(chan);
 	}
 
-	switch (ast_bridge_transfer_blind(chan, exten, context, NULL)) {
+	switch (ast_bridge_transfer_blind(chan, exten, context, NULL, NULL, NULL)) {
 	case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
 		astman_send_error(s, m, "Transfer not permitted");
 		break;




More information about the asterisk-commits mailing list