[svn-commits] rmudgett: branch rmudgett/bridge_tasks r421560 - in /team/rmudgett/bridge_tas...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 20 11:18:38 CDT 2014


Author: rmudgett
Date: Wed Aug 20 11:18:31 2014
New Revision: 421560

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421560
Log:
Resolve, reset.

Modified:
    team/rmudgett/bridge_tasks/   (props changed)
    team/rmudgett/bridge_tasks/include/asterisk/stasis_bridges.h
    team/rmudgett/bridge_tasks/main/bridge.c
    team/rmudgett/bridge_tasks/main/manager.c
    team/rmudgett/bridge_tasks/main/stasis_bridges.c
    team/rmudgett/bridge_tasks/res/ari/ari_model_validators.c
    team/rmudgett/bridge_tasks/res/ari/ari_model_validators.h
    team/rmudgett/bridge_tasks/res/stasis/app.c
    team/rmudgett/bridge_tasks/rest-api/api-docs/events.json
    team/rmudgett/bridge_tasks/tests/test_cel.c

Propchange: team/rmudgett/bridge_tasks/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/rmudgett/bridge_tasks/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Propchange: team/rmudgett/bridge_tasks/
------------------------------------------------------------------------------
--- bridge_tasks-integrated (original)
+++ bridge_tasks-integrated Wed Aug 20 11:18:31 2014
@@ -1,1 +1,1 @@
-/trunk:1-421506
+/trunk:1-421559

Modified: team/rmudgett/bridge_tasks/include/asterisk/stasis_bridges.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/include/asterisk/stasis_bridges.h?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/include/asterisk/stasis_bridges.h (original)
+++ team/rmudgett/bridge_tasks/include/asterisk/stasis_bridges.h Wed Aug 20 11:18:31 2014
@@ -300,6 +300,8 @@
 	char exten[AST_MAX_EXTENSION];
 	/*! Transferee channel. NULL if there were multiple transferee channels */
 	struct ast_channel_snapshot *transferee;
+	/*! The channel replacing the transferer when multiple parties are being transferred */
+	struct ast_channel_snapshot *replace_channel;
 };
 
 /*!
@@ -312,11 +314,15 @@
  * \param to_transferee The bridge between the transferer and transferee plus the transferer channel
  * \param context The destination context for the blind transfer
  * \param exten The destination extension for the blind transfer
- * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL.
+ * \param transferee_channel If a single channel is being transferred, this is it. If
+ *                           multiple parties are being transferred, this is NULL.
+ * \param replace_channel If multiple parties are being transferred or the transfer
+ *                        cannot reach across the bridge due to bridge flags, this is
+ *                        the channel connecting their bridge to the destination.
  */
 void ast_bridge_publish_blind_transfer(int is_external, enum ast_transfer_result result,
 		struct ast_bridge_channel_pair *to_transferee, const char *context, const char *exten,
-		struct ast_channel *transferee_channel);
+		struct ast_channel *transferee_channel, struct ast_channel *replace_channel);
 
 enum ast_attended_transfer_dest_type {
 	/*! The transfer failed, so there is no appropriate final state */

Modified: team/rmudgett/bridge_tasks/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/main/bridge.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/main/bridge.c (original)
+++ team/rmudgett/bridge_tasks/main/bridge.c Wed Aug 20 11:18:31 2014
@@ -3832,6 +3832,26 @@
 	return mute;
 }
 
+static void publish_blind_transfer_full(int is_external, enum ast_transfer_result result,
+		struct ast_channel *transferer, struct ast_bridge *bridge,
+		const char *context, const char *exten, struct ast_channel *transferee_channel,
+		struct ast_channel *replace_channel)
+{
+	struct ast_bridge_channel_pair pair;
+
+	pair.channel = transferer;
+	pair.bridge = bridge;
+
+	if (bridge) {
+		ast_bridge_lock(bridge);
+	}
+	ast_bridge_publish_blind_transfer(is_external, result, &pair, context, exten,
+		transferee_channel, replace_channel);
+	if (bridge) {
+		ast_bridge_unlock(bridge);
+	}
+}
+
 /*!
  * \internal
  * \brief Transfer an entire bridge to a specific destination.
@@ -3844,16 +3864,21 @@
  * bridges, this method is only used for multi-party bridges since this method would
  * be less efficient for two-party bridges.
  *
+ * \param is_external Whether the transfer is externally initiated
  * \param transferer The channel performing a transfer
  * \param bridge The bridge where the transfer is being performed
  * \param exten The destination extension for the blind transfer
+ * \param transferee The party being transferred if there is only one
  * \param context The destination context for the blind transfer
  * \param hook Framehook to attach to local channel
+ *
  * \return The success or failure of the operation
  */
-static enum ast_transfer_result blind_transfer_bridge(struct ast_channel *transferer,
-		struct ast_bridge *bridge, const char *exten, const char *context,
-		transfer_channel_cb new_channel_cb, struct transfer_channel_data *user_data_wrapper)
+static enum ast_transfer_result blind_transfer_bridge(int is_external,
+		struct ast_channel *transferer, struct ast_bridge *bridge,
+		const char *exten, const char *context, struct ast_channel *transferee,
+		transfer_channel_cb new_channel_cb,
+		struct transfer_channel_data *user_data_wrapper)
 {
 	struct ast_channel *local;
 	char chan_name[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2];
@@ -3885,6 +3910,8 @@
 		ast_hangup(local);
 		return AST_BRIDGE_TRANSFER_FAIL;
 	}
+	publish_blind_transfer_full(is_external, AST_BRIDGE_TRANSFER_SUCCESS, transferer, bridge,
+		context, exten, transferee, local);
 	return AST_BRIDGE_TRANSFER_SUCCESS;
 }
 
@@ -4241,16 +4268,8 @@
 		struct ast_channel *transferer, struct ast_bridge *bridge,
 		const char *context, const char *exten, struct ast_channel *transferee_channel)
 {
-	struct ast_bridge_channel_pair pair;
-	pair.channel = transferer;
-	pair.bridge = bridge;
-	if (bridge) {
-		ast_bridge_lock(bridge);
-	}
-	ast_bridge_publish_blind_transfer(is_external, result, &pair, context, exten, transferee_channel);
-	if (bridge) {
-		ast_bridge_unlock(bridge);
-	}
+	publish_blind_transfer_full(is_external, result, transferer, bridge, context,
+		exten, transferee_channel, NULL);
 }
 
 enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
@@ -4328,8 +4347,12 @@
 	set_transfer_variables_all(transferer, channels, 0);
 
 	if (do_bridge_transfer) {
-		transfer_result = blind_transfer_bridge(transferer, bridge, exten, context,
-				new_channel_cb, user_data_wrapper);
+		/* if blind_transfer_bridge succeeds, it publishes its own message */
+		transfer_result = blind_transfer_bridge(is_external, transferer, bridge,
+			exten, context, transferee, new_channel_cb, user_data_wrapper);
+		if (transfer_result == AST_BRIDGE_TRANSFER_SUCCESS)  {
+			return transfer_result;
+		}
 		goto publish;
 	}
 

Modified: team/rmudgett/bridge_tasks/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/main/manager.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/main/manager.c (original)
+++ team/rmudgett/bridge_tasks/main/manager.c Wed Aug 20 11:18:31 2014
@@ -216,6 +216,14 @@
 			</parameter>
 			<parameter name="Variables">
 				<para>Comma <literal>,</literal> separated list of variable to include.</para>
+			</parameter>
+			<parameter name="AllVariables">
+				<para>If set to "true", the Status event will include all channel variables for
+				the requested channel(s).</para>
+				<enumlist>
+					<enum name="true"/>
+					<enum name="false"/>
+				</enumlist>
 			</parameter>
 		</syntax>
 		<description>
@@ -3929,19 +3937,132 @@
 	return 0;
 }
 
+static void generate_status(struct mansession *s, struct ast_channel *chan, char **vars, int varc, int all_variables, char *id_text)
+{
+	struct timeval now;
+	long elapsed_seconds;
+	struct ast_bridge *bridge;
+	RAII_VAR(struct ast_str *, variable_str, NULL, ast_free);
+	struct ast_str *write_transpath = ast_str_alloca(256);
+	struct ast_str *read_transpath = ast_str_alloca(256);
+	struct ast_str *codec_buf = ast_str_alloca(128);
+	struct ast_party_id effective_id;
+	int i;
+	RAII_VAR(struct ast_channel_snapshot *, snapshot,
+		ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan)),
+		ao2_cleanup);
+	RAII_VAR(struct ast_str *, snapshot_str, NULL, ast_free);
+
+	if (!snapshot) {
+		return;
+	}
+
+	snapshot_str = ast_manager_build_channel_state_string(snapshot);
+	if (!snapshot_str) {
+		return;
+	}
+
+	if (all_variables) {
+		variable_str = ast_str_create(2048);
+	} else {
+		variable_str = ast_str_create(1024);
+	}
+
+	if (!variable_str) {
+		return;
+	}
+
+	now = ast_tvnow();
+	elapsed_seconds = ast_tvdiff_sec(now, ast_channel_creationtime(chan));
+
+	/* Even if all_variables has been specified, explicitly requested variables
+	 * may be global variables or dialplan functions */
+	for (i = 0; i < varc; i++) {
+		char valbuf[512], *ret = NULL;
+
+		if (vars[i][strlen(vars[i]) - 1] == ')') {
+			if (ast_func_read(chan, vars[i], valbuf, sizeof(valbuf)) < 0) {
+				valbuf[0] = '\0';
+			}
+			ret = valbuf;
+		} else {
+			pbx_retrieve_variable(chan, vars[i], &ret, valbuf, sizeof(valbuf), NULL);
+		}
+
+		ast_str_append(&variable_str, 0, "Variable: %s=%s\r\n", vars[i], ret);
+	}
+
+	/* Walk all channel variables and add them */
+	if (all_variables) {
+		struct ast_var_t *variables;
+
+		AST_LIST_TRAVERSE(ast_channel_varshead(chan), variables, entries) {
+			ast_str_append(&variable_str, 0, "Variable: %s=%s\r\n",
+				ast_var_name(variables), ast_var_value(variables));
+		}
+	}
+
+	bridge = ast_channel_get_bridge(chan);
+	effective_id = ast_channel_connected_effective_id(chan);
+
+	astman_append(s,
+		"Event: Status\r\n"
+		"Privilege: Call\r\n"
+		"%s"
+		"Type: %s\r\n"
+		"DNID: %s\r\n"
+		"EffectiveConnectedLineNum: %s\r\n"
+		"EffectiveConnectedLineName: %s\r\n"
+		"TimeToHangup: %ld\r\n"
+		"BridgeID: %s\r\n"
+		"Linkedid: %s\r\n"
+		"Application: %s\r\n"
+		"Data: %s\r\n"
+		"Nativeformats: %s\r\n"
+		"Readformat: %s\r\n"
+		"Readtrans: %s\r\n"
+		"Writeformat: %s\r\n"
+		"Writetrans: %s\r\n"
+		"Callgroup: %llu\r\n"
+		"Pickupgroup: %llu\r\n"
+		"Seconds: %ld\r\n"
+		"%s"
+		"%s"
+		"\r\n",
+		ast_str_buffer(snapshot_str),
+		ast_channel_tech(chan)->type,
+		S_OR(ast_channel_dialed(chan)->number.str, ""),
+		S_COR(effective_id.number.valid, effective_id.number.str, "<unknown>"),
+		S_COR(effective_id.name.valid, effective_id.name.str, "<unknown>"),
+		ast_channel_whentohangup(chan)->tv_sec,
+		bridge ? bridge->uniqueid : "",
+		ast_channel_linkedid(chan),
+		ast_channel_appl(chan),
+		ast_channel_data(chan),
+		ast_format_cap_get_names(ast_channel_nativeformats(chan), &codec_buf),
+		ast_format_get_name(ast_channel_readformat(chan)),
+		ast_translate_path_to_str(ast_channel_readtrans(chan), &read_transpath),
+		ast_format_get_name(ast_channel_writeformat(chan)),
+		ast_translate_path_to_str(ast_channel_writetrans(chan), &write_transpath),
+		ast_channel_callgroup(chan),
+		ast_channel_pickupgroup(chan),
+		(long)elapsed_seconds,
+		ast_str_buffer(variable_str),
+		id_text);
+
+	ao2_cleanup(bridge);
+}
+
 /*! \brief Manager "status" command to show channels */
-/* Needs documentation... */
 static int action_status(struct mansession *s, const struct message *m)
 {
 	const char *name = astman_get_header(m, "Channel");
 	const char *chan_variables = astman_get_header(m, "Variables");
+	const char *all_chan_variables = astman_get_header(m, "AllVariables");
+	int all_variables = 0;
 	const char *id = astman_get_header(m, "ActionID");
 	char *variables = ast_strdupa(S_OR(chan_variables, ""));
-	struct ast_str *variable_str = ast_str_create(1024);
-	struct ast_str *write_transpath = ast_str_alloca(256);
-	struct ast_str *read_transpath = ast_str_alloca(256);
 	struct ast_channel *chan;
-	struct ast_str *codec_buf = ast_str_alloca(64);
 	int channels = 0;
 	int all = ast_strlen_zero(name); /* set if we want all channels */
 	char id_text[256];
@@ -3950,20 +4071,17 @@
 		AST_APP_ARG(name)[100];
 	);
 
-	if (!variable_str) {
-		astman_send_error(s, m, "Memory Allocation Failure");
-		return 1;
+	if (!ast_strlen_zero(all_chan_variables)) {
+		all_variables = ast_true(all_chan_variables);
 	}
 
 	if (!(function_capable_string_allowed_with_auths(variables, s->session->writeperm))) {
-		ast_free(variable_str);
 		astman_send_error(s, m, "Status Access Forbidden: Variables");
 		return 0;
 	}
 
 	if (all) {
 		if (!(it_chans = ast_channel_iterator_all_new())) {
-			ast_free(variable_str);
 			astman_send_error(s, m, "Memory Allocation Failure");
 			return 1;
 		}
@@ -3972,7 +4090,6 @@
 		chan = ast_channel_get_by_name(name);
 		if (!chan) {
 			astman_send_error(s, m, "No such channel");
-			ast_free(variable_str);
 			return 0;
 		}
 	}
@@ -3991,106 +4108,10 @@
 
 	/* if we look by name, we break after the first iteration */
 	for (; chan; all ? chan = ast_channel_iterator_next(it_chans) : 0) {
-		struct timeval now;
-		long elapsed_seconds;
-		struct ast_bridge *bridge;
-
 		ast_channel_lock(chan);
 
-		now = ast_tvnow();
-		elapsed_seconds = ast_tvdiff_sec(now, ast_channel_creationtime(chan));
-
-		if (!ast_strlen_zero(chan_variables)) {
-			int i;
-			ast_str_reset(variable_str);
-			for (i = 0; i < vars.argc; i++) {
-				char valbuf[512], *ret = NULL;
-
-				if (vars.name[i][strlen(vars.name[i]) - 1] == ')') {
-					if (ast_func_read(chan, vars.name[i], valbuf, sizeof(valbuf)) < 0) {
-						valbuf[0] = '\0';
-					}
-					ret = valbuf;
-				} else {
-					pbx_retrieve_variable(chan, vars.name[i], &ret, valbuf, sizeof(valbuf), NULL);
-				}
-
-				ast_str_append(&variable_str, 0, "Variable: %s=%s\r\n", vars.name[i], ret);
-			}
-		}
-
+		generate_status(s, chan, vars.name, vars.argc, all_variables, id_text);
 		channels++;
-
-		bridge = ast_channel_get_bridge(chan);
-
-		astman_append(s,
-			"Event: Status\r\n"
-			"Privilege: Call\r\n"
-			"Channel: %s\r\n"
-			"ChannelState: %u\r\n"
-			"ChannelStateDesc: %s\r\n"
-			"CallerIDNum: %s\r\n"
-			"CallerIDName: %s\r\n"
-			"ConnectedLineNum: %s\r\n"
-			"ConnectedLineName: %s\r\n"
-			"Accountcode: %s\r\n"
-			"Context: %s\r\n"
-			"Exten: %s\r\n"
-			"Priority: %d\r\n"
-			"Uniqueid: %s\r\n"
-			"Type: %s\r\n"
-			"DNID: %s\r\n"
-			"EffectiveConnectedLineNum: %s\r\n"
-			"EffectiveConnectedLineName: %s\r\n"
-			"TimeToHangup: %ld\r\n"
-			"BridgeID: %s\r\n"
-			"Linkedid: %s\r\n"
-			"Application: %s\r\n"
-			"Data: %s\r\n"
-			"Nativeformats: %s\r\n"
-			"Readformat: %s\r\n"
-			"Readtrans: %s\r\n"
-			"Writeformat: %s\r\n"
-			"Writetrans: %s\r\n"
-			"Callgroup: %llu\r\n"
-			"Pickupgroup: %llu\r\n"
-			"Seconds: %ld\r\n"
-			"%s"
-			"%s"
-			"\r\n",
-			ast_channel_name(chan),
-			ast_channel_state(chan),
-			ast_state2str(ast_channel_state(chan)),
-			S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
-			S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>"),
-			S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, "<unknown>"),
-			S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, "<unknown>"),
-			ast_channel_accountcode(chan),
-			ast_channel_context(chan),
-			ast_channel_exten(chan),
-			ast_channel_priority(chan),
-			ast_channel_uniqueid(chan),
-			ast_channel_tech(chan)->type,
-			S_OR(ast_channel_dialed(chan)->number.str, ""),
-			S_COR(ast_channel_connected_effective_id(chan).number.valid, ast_channel_connected_effective_id(chan).number.str, "<unknown>"),
-			S_COR(ast_channel_connected_effective_id(chan).name.valid, ast_channel_connected_effective_id(chan).name.str, "<unknown>"),
-			ast_channel_whentohangup(chan)->tv_sec,
-			bridge ? bridge->uniqueid : "",
-			ast_channel_linkedid(chan),
-			ast_channel_appl(chan),
-			ast_channel_data(chan),
-			ast_format_cap_get_names(ast_channel_nativeformats(chan), &codec_buf),
-			ast_format_get_name(ast_channel_readformat(chan)),
-			ast_translate_path_to_str(ast_channel_readtrans(chan), &read_transpath),
-			ast_format_get_name(ast_channel_writeformat(chan)),
-			ast_translate_path_to_str(ast_channel_writetrans(chan), &write_transpath),
-			ast_channel_callgroup(chan),
-			ast_channel_pickupgroup(chan),
-			(long)elapsed_seconds,
-			ast_str_buffer(variable_str),
-			id_text);
-
-		ao2_cleanup(bridge);
 
 		ast_channel_unlock(chan);
 		chan = ast_channel_unref(chan);
@@ -4105,8 +4126,6 @@
 		"%s"
 		"Items: %d\r\n"
 		"\r\n", id_text, channels);
-
-	ast_free(variable_str);
 
 	return 0;
 }

Modified: team/rmudgett/bridge_tasks/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/main/stasis_bridges.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/main/stasis_bridges.c (original)
+++ team/rmudgett/bridge_tasks/main/stasis_bridges.c Wed Aug 20 11:18:31 2014
@@ -636,7 +636,10 @@
 	const struct stasis_message_sanitizer *sanitize)
 {
 	struct ast_blind_transfer_message *transfer_msg = stasis_message_data(msg);
-	struct ast_json *json_transferer, *json_transferee = NULL, *out;
+	struct ast_json *json_transferer;
+	struct ast_json *json_transferee = NULL;
+	struct ast_json *out;
+	struct ast_json *json_replace = NULL;
 	const struct timeval *tv = stasis_message_timestamp(msg);
 
 	json_transferer = ast_channel_snapshot_to_json(transfer_msg->to_transferee.channel_snapshot, sanitize);
@@ -647,6 +650,16 @@
 	if (transfer_msg->transferee) {
 		json_transferee = ast_channel_snapshot_to_json(transfer_msg->transferee, sanitize);
 		if (!json_transferee) {
+			ast_json_unref(json_transferer);
+			return NULL;
+		}
+	}
+
+	if (transfer_msg->replace_channel) {
+		json_replace = ast_channel_snapshot_to_json(transfer_msg->replace_channel, sanitize);
+		if (!json_replace) {
+			ast_json_unref(json_transferee);
+			ast_json_unref(json_transferer);
 			return NULL;
 		}
 	}
@@ -661,10 +674,18 @@
 		"is_external", ast_json_boolean(transfer_msg->is_external));
 
 	if (!out) {
+		ast_json_unref(json_transferee);
+		ast_json_unref(json_replace);
 		return NULL;
 	}
 
 	if (json_transferee && ast_json_object_set(out, "transferee", json_transferee)) {
+		ast_json_unref(out);
+		ast_json_unref(json_replace);
+		return NULL;
+	}
+
+	if (json_replace && ast_json_object_set(out, "replace_channel", json_replace)) {
 		ast_json_unref(out);
 		return NULL;
 	}
@@ -741,7 +762,7 @@
 
 void ast_bridge_publish_blind_transfer(int is_external, enum ast_transfer_result result,
 		struct ast_bridge_channel_pair *transferer, const char *context, const char *exten,
-		struct ast_channel *transferee_channel)
+		struct ast_channel *transferee_channel, struct ast_channel *replace_channel)
 {
 	struct ast_blind_transfer_message *msg;
 	struct stasis_message *stasis;
@@ -758,6 +779,9 @@
 
 	if (transferee_channel) {
 		msg->transferee = ast_channel_snapshot_get_latest(ast_channel_uniqueid(transferee_channel));
+	}
+	if (replace_channel) {
+		msg->replace_channel = ast_channel_snapshot_get_latest(ast_channel_uniqueid(replace_channel));
 	}
 	msg->is_external = is_external;
 	msg->result = result;

Modified: team/rmudgett/bridge_tasks/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/res/ari/ari_model_validators.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/res/ari/ari_model_validators.c (original)
+++ team/rmudgett/bridge_tasks/res/ari/ari_model_validators.c Wed Aug 20 11:18:31 2014
@@ -2062,6 +2062,15 @@
 				res = 0;
 			}
 		} else
+		if (strcmp("replace_channel", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ast_ari_validate_channel(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BridgeBlindTransfer field replace_channel failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("result", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_result = 1;

Modified: team/rmudgett/bridge_tasks/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/res/ari/ari_model_validators.h?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/res/ari/ari_model_validators.h (original)
+++ team/rmudgett/bridge_tasks/res/ari/ari_model_validators.h Wed Aug 20 11:18:31 2014
@@ -1304,6 +1304,7 @@
  * - context: string (required)
  * - exten: string (required)
  * - is_external: boolean (required)
+ * - replace_channel: Channel
  * - result: string (required)
  * - transferee: Channel
  * BridgeCreated

Modified: team/rmudgett/bridge_tasks/res/stasis/app.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/res/stasis/app.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/res/stasis/app.c (original)
+++ team/rmudgett/bridge_tasks/res/stasis/app.c Wed Aug 20 11:18:31 2014
@@ -696,19 +696,6 @@
 	return subscribed;
 }
 
-static void bridge_blind_transfer_handler(void *data, struct stasis_subscription *sub,
-	struct stasis_message *message)
-{
-	struct stasis_app *app = data;
-	struct ast_blind_transfer_message *transfer_msg = stasis_message_data(message);
-	struct ast_bridge_snapshot *bridge = transfer_msg->to_transferee.bridge_snapshot;
-
-	if (bridge_app_subscribed(app, transfer_msg->to_transferee.channel_snapshot->uniqueid) ||
-		(bridge && bridge_app_subscribed_involved(app, bridge))) {
-		stasis_publish(app->topic, message);
-	}
-}
-
 static void set_replacement_channel(struct ast_channel_snapshot *to_be_replaced,
 		struct ast_channel_snapshot *replacing)
 {
@@ -724,6 +711,24 @@
 	}
 	ast_channel_cleanup(chan);
 	ao2_cleanup(control);
+}
+
+static void bridge_blind_transfer_handler(void *data, struct stasis_subscription *sub,
+	struct stasis_message *message)
+{
+	struct stasis_app *app = data;
+	struct ast_blind_transfer_message *transfer_msg = stasis_message_data(message);
+	struct ast_bridge_snapshot *bridge = transfer_msg->to_transferee.bridge_snapshot;
+
+	if (transfer_msg->replace_channel) {
+		set_replacement_channel(transfer_msg->to_transferee.channel_snapshot,
+				transfer_msg->replace_channel);
+	}
+
+	if (bridge_app_subscribed(app, transfer_msg->to_transferee.channel_snapshot->uniqueid) ||
+		(bridge && bridge_app_subscribed_involved(app, bridge))) {
+		stasis_publish(app->topic, message);
+	}
 }
 
 static void bridge_attended_transfer_handler(void *data, struct stasis_subscription *sub,

Modified: team/rmudgett/bridge_tasks/rest-api/api-docs/events.json
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/rest-api/api-docs/events.json?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/rest-api/api-docs/events.json (original)
+++ team/rmudgett/bridge_tasks/rest-api/api-docs/events.json Wed Aug 20 11:18:31 2014
@@ -285,6 +285,11 @@
 					"required": true,
 					"type": "Channel"
 				},
+				"replace_channel": {
+					"description": "The channel that is replacing transferer when the transferee(s) can not be transferred directly",
+					"required": false,
+					"type": "Channel"
+				},
 				"transferee": {
 					"description": "The channel that is being transferred",
 					"required": false,

Modified: team/rmudgett/bridge_tasks/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_tasks/tests/test_cel.c?view=diff&rev=421560&r1=421559&r2=421560
==============================================================================
--- team/rmudgett/bridge_tasks/tests/test_cel.c (original)
+++ team/rmudgett/bridge_tasks/tests/test_cel.c Wed Aug 20 11:18:31 2014
@@ -1257,7 +1257,7 @@
 	pair.channel = chan_alice;
 	ast_bridge_lock(bridge);
 	ast_bridge_publish_blind_transfer(1, AST_BRIDGE_TRANSFER_SUCCESS,
-		&pair, "transfer_context", "transfer_extension", NULL);
+		&pair, "transfer_context", "transfer_extension", NULL, NULL);
 	ast_bridge_unlock(bridge);
 	BLINDTRANSFER_EVENT(chan_alice, bridge, "transfer_extension", "transfer_context");
 




More information about the svn-commits mailing list