[asterisk-commits] mmichelson: branch mmichelson/transfer r386457 - /team/mmichelson/transfer/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 24 15:51:48 CDT 2013
Author: mmichelson
Date: Wed Apr 24 15:51:44 2013
New Revision: 386457
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386457
Log:
Use signed linear as the format when requesting a local channel for whole-bridge blind transfers.
We use a file-scoped format_cap so we only have to allocate it once. It is initialized at startup.
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=386457&r1=386456&r2=386457
==============================================================================
--- team/mmichelson/transfer/main/bridging.c (original)
+++ team/mmichelson/transfer/main/bridging.c Wed Apr 24 15:51:44 2013
@@ -4248,14 +4248,35 @@
return channels;
}
-/*!
- * \internal
- * \brief Accomplish a transfer by swapping a Local channel with an existing channel
- *
- * This, in a sense, blind transfers an entire bridge to an extension and context. It
- * works by creating a local channel to dial out and swapping the called local channel
- * with the transferring channel. By doing so, all participants in the bridge are
- * privy to the goings-on of the blind transfer.
+/*! Signed linear format capabilities structure that can be reused */
+static struct ast_format_cap *slin_cap;
+
+/*!
+ * \internal
+ * \brief Initialize reusable signed linear format cap
+ * \retval 0 Success
+ * \retval non-zero failure
+ */
+static int initialize_slin_cap(void)
+{
+ struct ast_format slin_format;
+
+ slin_cap = ast_format_cap_alloc_nolock();
+ if (!slin_cap) {
+ return -1;
+ }
+
+ ast_format_cap_set(slin_cap, ast_getformatbyname("slin", &slin_format));
+ return 0;
+}
+
+/*!
+ * \internal
+ * \brief Transfer an entire bridge to a specific destination.
+ *
+ * This creates a local channel to dial out and swaps the called local channel
+ * with the transferer channel. By doing so, all participants in the bridge are
+ * connected to the specified destination.
*
* While this means of transferring would work for both two-party and multi-party
* bridges, this method is only used for multi-party bridges since this method would
@@ -4267,7 +4288,7 @@
* \param context The destination context for the blind transfer
* \return The success or failure of the operation
*/
-static enum ast_transfer_result local_channel_swap_transfer(struct ast_channel *transferer,
+static enum ast_transfer_result blind_transfer_bridge(struct ast_channel *transferer,
struct ast_bridge *bridge, const char *exten, const char *context)
{
struct ast_channel *local;
@@ -4275,8 +4296,7 @@
int cause;
snprintf(chan_name, sizeof(chan_name), "%s@%s", exten, context);
- local = ast_request("Local", ast_channel_nativeformats(transferer),
- transferer, chan_name, &cause);
+ local = ast_request("Local", slin_cap, transferer, chan_name, &cause);
if (!local) {
return AST_BRIDGE_TRANSFER_FAIL;
}
@@ -4397,7 +4417,7 @@
}
if (do_bridge_transfer) {
- return local_channel_swap_transfer(transferer, bridge, exten, context);
+ return blind_transfer_bridge(transferer, bridge, exten, context);
}
/* Reaching this portion means that we're dealing with a two-party bridge */
@@ -5034,6 +5054,11 @@
return -1;
}
+ if (initialize_slin_cap()) {
+ bridge_shutdown();
+ return -1;
+ }
+
ast_bridging_init_basic();
/* BUGBUG need AMI action equivalents to the CLI commands. */
More information about the asterisk-commits
mailing list