[asterisk-commits] mmichelson: branch mmichelson/atxfer_features r392795 - in /team/mmichelson/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 24 18:45:46 CDT 2013


Author: mmichelson
Date: Mon Jun 24 18:45:44 2013
New Revision: 392795

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392795
Log:
Add the ability to swap between bridges as the transferer.

Testing a basic scenario, it worked as expected. The transferer
could switch between talking to the transfer target and the transferee.
The party not being spoken to was placed on hold. Really cool.


Modified:
    team/mmichelson/atxfer_features/include/asterisk/bridging_features.h
    team/mmichelson/atxfer_features/include/asterisk/features_config.h
    team/mmichelson/atxfer_features/main/bridging_basic.c
    team/mmichelson/atxfer_features/main/features_config.c

Modified: team/mmichelson/atxfer_features/include/asterisk/bridging_features.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/include/asterisk/bridging_features.h?view=diff&rev=392795&r1=392794&r2=392795
==============================================================================
--- team/mmichelson/atxfer_features/include/asterisk/bridging_features.h (original)
+++ team/mmichelson/atxfer_features/include/asterisk/bridging_features.h Mon Jun 24 18:45:44 2013
@@ -269,6 +269,8 @@
 	char threeway[MAXIMUM_DTMF_FEATURE_STRING];
 	/*! DTMF string used to complete the transfer (If not empty.) */
 	char complete[MAXIMUM_DTMF_FEATURE_STRING];
+	/*! DTMF string used to swap bridged targets (If not empty.) */
+	char swap[MAXIMUM_DTMF_FEATURE_STRING];
 };
 
 /*!

Modified: team/mmichelson/atxfer_features/include/asterisk/features_config.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/include/asterisk/features_config.h?view=diff&rev=392795&r1=392794&r2=392795
==============================================================================
--- team/mmichelson/atxfer_features/include/asterisk/features_config.h (original)
+++ team/mmichelson/atxfer_features/include/asterisk/features_config.h Mon Jun 24 18:45:44 2013
@@ -64,6 +64,8 @@
 		AST_STRING_FIELD(atxfercomplete);
 		/*! DTMF sequence used to turn an attempted atxfer into a three-way call */
 		AST_STRING_FIELD(atxferthreeway);
+		/*! DTMF sequence used to swap which party the transferer is talking to */
+		AST_STRING_FIELD(atxferswap);
 	);
 	/*! Milliseconds allowed between digit presses when dialing transfer destination */
 	unsigned int transferdigittimeout;

Modified: team/mmichelson/atxfer_features/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/bridging_basic.c?view=diff&rev=392795&r1=392794&r2=392795
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Mon Jun 24 18:45:44 2013
@@ -142,6 +142,7 @@
  */
 static int bridge_personality_normal_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
 {
+	ast_log(LOG_NOTICE, "NORMAL PUSH\n");
 	if (ast_bridge_hangup_hook(bridge_channel->features, basic_hangup_hook, NULL, NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL)
 		|| ast_bridge_channel_setup_features(bridge_channel)) {
 		return -1;
@@ -990,7 +991,10 @@
 	const char *swap_dtmf;
 	struct bridge_basic_personality *personality = self->personality;
 
+	ast_log(LOG_NOTICE, "ATXFER PUSH\n");
+
 	if (!ast_channel_has_role(bridge_channel->chan, TRANSFERER_ROLE_NAME)) {
+		ast_log(LOG_NOTICE, "NOT THE TRANSFERER!\n");
 		return 0;
 	}
 
@@ -1108,13 +1112,13 @@
 	return 0;
 }
 
-/* XXX Needs swap option as well */
-static int add_transferer_role(struct ast_channel *chan, const char *abort, const char *complete, const char *threeway)
+static int add_transferer_role(struct ast_channel *chan, const char *abort, const char *complete, const char *threeway, const char *swap)
 {
 	return ast_channel_add_bridge_role(chan, TRANSFERER_ROLE_NAME) ||
 		ast_channel_set_bridge_role_option(chan, TRANSFERER_ROLE_NAME, "abort", abort) ||
 		ast_channel_set_bridge_role_option(chan, TRANSFERER_ROLE_NAME, "complete", complete) ||
-		ast_channel_set_bridge_role_option(chan, TRANSFERER_ROLE_NAME, "threeway", threeway);
+		ast_channel_set_bridge_role_option(chan, TRANSFERER_ROLE_NAME, "threeway", threeway) ||
+		ast_channel_set_bridge_role_option(chan, TRANSFERER_ROLE_NAME, "swap", swap);
 }
 
 
@@ -1375,6 +1379,7 @@
 	const char *atxfer_abort;
 	const char *atxfer_threeway;
 	const char *atxfer_complete;
+	const char *atxfer_swap;
 	const char *fail_sound;
 	RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
 	int atxferdropcall;
@@ -1403,16 +1408,18 @@
 		atxfer_abort = ast_strdupa(S_OR(attended_transfer->abort, xfer_cfg->atxferabort));
 		atxfer_threeway = ast_strdupa(S_OR(attended_transfer->threeway, xfer_cfg->atxferthreeway));
 		atxfer_complete = ast_strdupa(S_OR(attended_transfer->complete, xfer_cfg->atxfercomplete));
+		atxfer_swap = ast_strdupa(S_OR(attended_transfer->swap, xfer_cfg->atxferswap));
 	} else {
 		atxfer_abort = ast_strdupa(xfer_cfg->atxferabort);
 		atxfer_threeway = ast_strdupa(xfer_cfg->atxferthreeway);
 		atxfer_complete = ast_strdupa(xfer_cfg->atxfercomplete);
+		atxfer_swap = ast_strdupa(xfer_cfg->atxferswap);
 	}
 	fail_sound = ast_strdupa(xfer_cfg->xferfailsound);
 	atxferdropcall = xfer_cfg->atxferdropcall;
 	atxfercallbackretries = xfer_cfg->atxfercallbackretries;
 	atxfernoanswertimeout = xfer_cfg->atxfernoanswertimeout;
-	if (add_transferer_role(bridge_channel->chan, atxfer_abort, atxfer_complete, atxfer_threeway)) {
+	if (add_transferer_role(bridge_channel->chan, atxfer_abort, atxfer_complete, atxfer_threeway, atxfer_swap)) {
 		ast_channel_unlock(bridge_channel->chan);
 		ast_bridge_merge_inhibit(bridge, -1);
 		ao2_ref(bridge, -1);
@@ -1471,6 +1478,7 @@
 	attach_framehook(peer, props);
 
 	ast_bridge_basic_change_personality_atxfer(attended_bridge, props);
+	ast_bridge_basic_change_personality_atxfer(bridge, props);
 
 	if (ast_call(peer, destination, 0)) {
 		ast_bridge_destroy(attended_bridge);

Modified: team/mmichelson/atxfer_features/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/features_config.c?view=diff&rev=392795&r1=392794&r2=392795
==============================================================================
--- team/mmichelson/atxfer_features/main/features_config.c (original)
+++ team/mmichelson/atxfer_features/main/features_config.c Mon Jun 24 18:45:44 2013
@@ -101,6 +101,16 @@
 						<para>This option is only available to the transferrer during an attended
 						transfer operation. Pressing this DTMF sequence will result in the transferrer,
 						the transferees, and the transfer target all being in a single bridge together.</para>
+					</description>
+				</configOption>
+				<configOption name="atxferswap" default="*4">
+					<synopsis>Digits to dial to change who the transferrer is currently bridged to during an attended transfer</synopsis>
+					<description>
+						<para>This option is only available to the transferrer during an attended
+						transfer operation. Pressing this DTMF sequence will result in the transferrer swapping
+						which party he is bridged with. For instance, if the transferrer is currently bridged with
+						the transfer target, then pressing this DTMF sequence will cause the transferrer to be
+						bridged with the transferees.</para>
 					</description>
 				</configOption>
 				<configOption name="pickupexten" default="*8">
@@ -350,6 +360,7 @@
 #define DEFAULT_ATXFER_ABORT                        "*1"
 #define DEFAULT_ATXFER_COMPLETE                     "*2"
 #define DEFAULT_ATXFER_THREEWAY                     "*3"
+#define DEFAULT_ATXFER_SWAP                         "*4"
 
 /*! Default pickup options */
 #define DEFAULT_PICKUPEXTEN                         "*8"
@@ -837,6 +848,8 @@
 		ast_string_field_set(xfer, atxfercomplete, value);
 	} else if (!strcasecmp(name, "atxferthreeway")) {
 		ast_string_field_set(xfer, atxferthreeway, value);
+	} else if (!strcasecmp(name, "atxferswap")) {
+		ast_string_field_set(xfer, atxferswap, value);
 	} else {
 		/* Unrecognized option */
 		res = -1;
@@ -870,6 +883,8 @@
 		ast_copy_string(buf, xfer->atxfercomplete, len);
 	} else if (!strcasecmp(field, "atxferthreeway")) {
 		ast_copy_string(buf, xfer->atxferthreeway, len);
+	} else if (!strcasecmp(field, "atxferswap")) {
+		ast_copy_string(buf, xfer->atxferswap, len);
 	} else {
 		/* Unrecognized option */
 		res = -1;
@@ -1618,6 +1633,8 @@
 			DEFAULT_ATXFER_COMPLETE, xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "atxferthreeway", ACO_EXACT, global_options,
 			DEFAULT_ATXFER_THREEWAY, xfer_handler, 0);
+	aco_option_register_custom(&cfg_info, "atxferswap", ACO_EXACT, global_options,
+			DEFAULT_ATXFER_SWAP, xfer_handler, 0);
 
 	aco_option_register_custom(&cfg_info, "pickupexten", ACO_EXACT, global_options,
 			DEFAULT_PICKUPEXTEN, pickup_handler, 0);




More information about the asterisk-commits mailing list