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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 7 17:51:50 CDT 2013


Author: mmichelson
Date: Tue May  7 17:51:48 2013
New Revision: 387872

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387872
Log:
Restore manager Bridge action's previous behavior of continuing in the dialplan after the bridge breaks.


Modified:
    team/mmichelson/more_transfer/main/features.c

Modified: team/mmichelson/more_transfer/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/main/features.c?view=diff&rev=387872&r1=387871&r2=387872
==============================================================================
--- team/mmichelson/more_transfer/main/features.c (original)
+++ team/mmichelson/more_transfer/main/features.c Tue May  7 17:51:48 2013
@@ -7137,6 +7137,29 @@
 	return CLI_SUCCESS;
 }
 
+/*!
+ * \internal
+ * \brief Add an arbitrary channel to a bridge
+ *
+ * The channel that is being added to the bridge can be in any state: unbridged,
+ * bridged, answered, unanswered, etc. The channel will be added asynchronously,
+ * meaning that when this function returns once the channel has been added to
+ * the bridge, not once the channel has been removed from the bridge.
+ *
+ * In addition, a tone can optionally be played to the channel once the
+ * channel is placed into the bridge.
+ *
+ * \note When this function returns, there is no guarantee that the channel that
+ * was passed in is valid any longer. Do not attempt to operate on the channel
+ * after this function returns.
+ *
+ * \param bridge Bridge to which the channel should be added
+ * \param chan The channel to add to the bridge
+ * \param features Features for this channel in the bridge
+ * \param play_tone Indicates if a tone should be played to the channel
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
 static int add_to_bridge(struct ast_bridge *bridge, struct ast_channel *chan,
 		struct ast_bridge_features *features, int play_tone)
 {
@@ -7175,6 +7198,7 @@
 			return -1;
 		}
 	}
+
 	if (play_tone && !ast_strlen_zero(xfersound)) {
 		struct ast_channel *play_chan = bridge_chan ?: chan;
 		RAII_VAR(struct ast_bridge_channel *, play_bridge_channel, NULL, ao2_cleanup);
@@ -7214,7 +7238,13 @@
 	RAII_VAR(struct ast_channel *, chana, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_channel *, chanb, NULL, ao2_cleanup);
 	const char *chana_name;
+	const char *chana_exten;
+	const char *chana_context;
+	int chana_priority;
 	const char *chanb_name;
+	const char *chanb_exten;
+	const char *chanb_context;
+	int chanb_priority;
 	struct ast_bridge *bridge;
 	char buf[256];
 
@@ -7231,7 +7261,12 @@
 		astman_send_error(s, m, buf);
 		return 0;
 	}
+	ast_channel_lock(chana);
 	chana_name = ast_strdupa(ast_channel_name(chana));
+	chana_exten = ast_strdupa(ast_channel_exten(chana));
+	chana_context = ast_strdupa(ast_channel_context(chana));
+	chana_priority = ast_channel_priority(chana);
+	ast_channel_unlock(chana);
 
 	chanb = ast_channel_get_by_name_prefix(channelb, strlen(channelb));
 	if (!chanb) {
@@ -7239,7 +7274,12 @@
 		astman_send_error(s, m, buf);
 		return 0;
 	}
+	ast_channel_lock(chanb);
 	chanb_name = ast_strdupa(ast_channel_name(chanb));
+	chanb_exten = ast_strdupa(ast_channel_exten(chanb));
+	chanb_context = ast_strdupa(ast_channel_context(chanb));
+	chanb_priority = ast_channel_priority(chanb);
+	ast_channel_unlock(chanb);
 
 	bridge = ast_bridge_basic_new();
 	if (!bridge) {
@@ -7247,12 +7287,14 @@
 		return 0;
 	}
 
+	ast_after_bridge_set_go_on(chana, chana_context, chana_exten, chana_priority, NULL);
 	if (add_to_bridge(bridge, chana, NULL, ast_true(playtone))) {
 		snprintf(buf, sizeof(buf), "Unable to add Channel1 to bridge: %s", ast_channel_name(chana));
 		astman_send_error(s, m, buf);
 		return 0;
 	}
 
+	ast_after_bridge_set_go_on(chanb, chanb_context, chanb_exten, chanb_priority, NULL);
 	if (add_to_bridge(bridge, chanb, NULL, ast_true(playtone))) {
 		snprintf(buf, sizeof(buf), "Unable to add Channel2 to bridge: %s", ast_channel_name(chanb));
 		astman_send_error(s, m, buf);




More information about the asterisk-commits mailing list