[asterisk-commits] mmichelson: branch mmichelson/more_transfer r388647 - /team/mmichelson/more_t...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 13 16:41:53 CDT 2013


Author: mmichelson
Date: Mon May 13 16:41:50 2013
New Revision: 388647

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388647
Log:
Change what information is copied during a blind transfer to the dialplan channel.


Modified:
    team/mmichelson/more_transfer/bridges/bridge_builtin_features.c

Modified: team/mmichelson/more_transfer/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/bridges/bridge_builtin_features.c?view=diff&rev=388647&r1=388646&r2=388647
==============================================================================
--- team/mmichelson/more_transfer/bridges/bridge_builtin_features.c (original)
+++ team/mmichelson/more_transfer/bridges/bridge_builtin_features.c Mon May 13 16:41:50 2013
@@ -94,14 +94,21 @@
 	return res;
 }
 
+/*!
+ * \internal
+ * \brief Copy information from the caller to a separate channel.
+ *
+ * This causes datastores and channel variables to be inherited from the
+ * caller channel to the dest channel.
+ *
+ * \note Both channels must be locked before calling this function
+ * \param dest Destination channel
+ * \param caller Source channel
+ */
 static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)
 {
-	ast_channel_lock_both(caller, dest);
-	ast_connected_line_copy_from_caller(ast_channel_connected(dest), ast_channel_caller(caller));
 	ast_channel_inherit_variables(caller, dest);
 	ast_channel_datastore_inherit(caller, dest);
-	ast_channel_unlock(dest);
-	ast_channel_unlock(caller);
 }
 
 /*! \brief Helper function that creates an outgoing channel and returns it immediately */
@@ -122,7 +129,11 @@
 	}
 
 	/* Before we actually dial out let's inherit appropriate information. */
+	ast_channel_lock_both(caller, chan);
+	ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(caller));
 	copy_caller_data(chan, caller);
+	ast_channel_unlock(chan);
+	ast_channel_unlock(caller);
 
 	/* Since the above worked fine now we actually call it and return the channel */
 	if (ast_call(chan, destination, 0)) {
@@ -168,7 +179,10 @@
 {
 	struct ast_channel *transferer_channel = user_data;
 
+	ast_channel_lock_both(transferer_channel, new_channel);
 	copy_caller_data(new_channel, transferer_channel);
+	ast_channel_unlock(new_channel);
+	ast_channel_unlock(transferer_channel);
 }
 
 /*! \brief Internal built in feature for blind transfers */




More information about the asterisk-commits mailing list