[asterisk-commits] dlee: branch dlee/better-nicknames r401436 - in /team/dlee/better-nicknames: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 22 14:16:05 CDT 2013


Author: dlee
Date: Tue Oct 22 14:16:03 2013
New Revision: 401436

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401436
Log:
Merged revisions 401315-401434 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    team/dlee/better-nicknames/   (props changed)
    team/dlee/better-nicknames/apps/app_queue.c
    team/dlee/better-nicknames/include/asterisk/bridge_channel_internal.h
    team/dlee/better-nicknames/main/bridge.c
    team/dlee/better-nicknames/main/bridge_channel.c
    team/dlee/better-nicknames/main/editline/term.c
    team/dlee/better-nicknames/res/parking/parking_bridge.c
    team/dlee/better-nicknames/res/parking/parking_bridge_features.c
    team/dlee/better-nicknames/res/res_parking.c
    team/dlee/better-nicknames/rest-api/api-docs/channels.json

Propchange: team/dlee/better-nicknames/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Tue Oct 22 14:16:03 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702,385356,395020,396441,397034,397604,399305
+/branches/11:373240,375247,375702,385356,395020,396441,397034,397604,399305,401379

Propchange: team/dlee/better-nicknames/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/better-nicknames/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct 22 14:16:03 2013
@@ -1,1 +1,1 @@
-/branches/12:1-401313
+/branches/12:1-401435

Modified: team/dlee/better-nicknames/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/apps/app_queue.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/apps/app_queue.c (original)
+++ team/dlee/better-nicknames/apps/app_queue.c Tue Oct 22 14:16:03 2013
@@ -9727,6 +9727,7 @@
 {
 	const char *queuename, *interface;
 	struct member *mem = NULL;
+	char *res = CLI_FAILURE;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -9748,36 +9749,39 @@
 	queuename = a->argv[5];
 	interface = a->argv[3];
 
+	if (log_membername_as_agent) {
+		mem = find_member_by_queuename_and_interface(queuename, interface);
+	}
+
 	switch (remove_from_queue(queuename, interface)) {
 	case RES_OKAY:
-		if (log_membername_as_agent) {
-			mem = find_member_by_queuename_and_interface(queuename, interface);
-		}
 		if (!mem || ast_strlen_zero(mem->membername)) {
 			ast_queue_log(queuename, "CLI", interface, "REMOVEMEMBER", "%s", "");
 		} else {
 			ast_queue_log(queuename, "CLI", mem->membername, "REMOVEMEMBER", "%s", "");
 		}
-		if (mem) {
-			ao2_ref(mem, -1);
-		}
 		ast_cli(a->fd, "Removed interface %s from queue '%s'\n", interface, queuename);
-		return CLI_SUCCESS;
+		res = CLI_SUCCESS;
+		break;
 	case RES_EXISTS:
 		ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
-		return CLI_FAILURE;
+		break;
 	case RES_NOSUCHQUEUE:
 		ast_cli(a->fd, "Unable to remove interface from queue '%s': No such queue\n", queuename);
-		return CLI_FAILURE;
+		break;
 	case RES_OUTOFMEMORY:
 		ast_cli(a->fd, "Out of memory\n");
-		return CLI_FAILURE;
+		break;
 	case RES_NOT_DYNAMIC:
 		ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Member is not dynamic\n", interface, queuename);
-		return CLI_FAILURE;
-	default:
-		return CLI_FAILURE;
-	}
+		break;
+	}
+
+	if (mem) {
+		ao2_ref(mem, -1);
+	}
+
+	return res;
 }
 
 static char *complete_queue_pause_member(const char *line, const char *word, int pos, int state)

Modified: team/dlee/better-nicknames/include/asterisk/bridge_channel_internal.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/include/asterisk/bridge_channel_internal.h?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/include/asterisk/bridge_channel_internal.h (original)
+++ team/dlee/better-nicknames/include/asterisk/bridge_channel_internal.h Tue Oct 22 14:16:03 2013
@@ -107,6 +107,9 @@
  *
  * \retval 0 on success.
  * \retval -1 on failure.  The channel did not get pushed.
+ *
+ * \note On failure the caller must call
+ * ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
  */
 int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel);
 

Modified: team/dlee/better-nicknames/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/main/bridge.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/main/bridge.c (original)
+++ team/dlee/better-nicknames/main/bridge.c Tue Oct 22 14:16:03 2013
@@ -1791,6 +1791,8 @@
 		bridge_channel_change_bridge(bridge_channel, dst_bridge);
 
 		if (bridge_channel_internal_push(bridge_channel)) {
+			ast_bridge_features_remove(bridge_channel->features,
+				AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 			ast_bridge_channel_leave_bridge(bridge_channel,
 				BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
 		}
@@ -2036,11 +2038,15 @@
 
 	if (bridge_channel_internal_push(bridge_channel)) {
 		/* Try to put the channel back into the original bridge. */
+		ast_bridge_features_remove(bridge_channel->features,
+			AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 		if (attempt_recovery && was_in_bridge) {
 			/* Point back to original bridge. */
 			bridge_channel_change_bridge(bridge_channel, orig_bridge);
 
 			if (bridge_channel_internal_push(bridge_channel)) {
+				ast_bridge_features_remove(bridge_channel->features,
+					AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 				ast_bridge_channel_leave_bridge(bridge_channel,
 					BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
 				bridge_channel_settle_owed_events(orig_bridge, bridge_channel);

Modified: team/dlee/better-nicknames/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/main/bridge_channel.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/main/bridge_channel.c (original)
+++ team/dlee/better-nicknames/main/bridge_channel.c Tue Oct 22 14:16:03 2013
@@ -1566,7 +1566,6 @@
 		|| ast_bridge_channel_establish_roles(bridge_channel)) {
 		ast_debug(1, "Bridge %s: pushing %p(%s) into bridge failed\n",
 			bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan));
-		ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 		return -1;
 	}
 	bridge_channel->in_bridge = 1;
@@ -1879,9 +1878,6 @@
 			ast_channel_name(bridge_channel->chan));
 		ast_cond_wait(&bridge_channel->cond, ao2_object_get_lockaddr(bridge_channel));
 	} else {
-		ast_debug(10, "Bridge %s: %p(%s) is going into a waitfor\n",
-			bridge_channel->bridge->uniqueid, bridge_channel,
-			ast_channel_name(bridge_channel->chan));
 		ast_bridge_channel_unlock(bridge_channel);
 		outfd = -1;
 		ms = bridge_channel_next_interval(bridge_channel);
@@ -1972,8 +1968,7 @@
 	 */
 	ast_bridge_lock(bridge_channel->bridge);
 
-	/* Make sure we're still good to be put into a bridge
-	 */
+	/* Make sure we're still good to be put into a bridge */
 	ast_channel_lock(bridge_channel->chan);
 	if (ast_channel_internal_bridge(bridge_channel->chan)
 		|| ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_ZOMBIE)) {
@@ -1996,8 +1991,14 @@
 	}
 
 	if (bridge_channel_internal_push(bridge_channel)) {
-		ast_bridge_channel_leave_bridge(bridge_channel,
-			BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
+		int cause = bridge_channel->bridge->cause;
+
+		ast_bridge_unlock(bridge_channel->bridge);
+		ast_bridge_channel_kick(bridge_channel, cause);
+		ast_bridge_channel_lock_bridge(bridge_channel);
+		ast_bridge_features_remove(bridge_channel->features,
+			AST_BRIDGE_HOOK_REMOVE_ON_PULL);
+		bridge_channel_dissolve_check(bridge_channel);
 		res = -1;
 	}
 	bridge_reconfigured(bridge_channel->bridge, !bridge_channel->inhibit_colp);

Modified: team/dlee/better-nicknames/main/editline/term.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/main/editline/term.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/main/editline/term.c (original)
+++ team/dlee/better-nicknames/main/editline/term.c Tue Oct 22 14:16:03 2013
@@ -65,15 +65,17 @@
 #include <ncurses.h>
 #endif
 #if defined(HAVE_TERM_H)
+/* Can not use /usr/include/term.h because of a lot of incompatibilities, so just define some prototypes */
 #include "term.h"
-/* Can not use /usr/include/term.h because of a lot of incompatibilities, so just define some prototypes */
+#endif /* defined(HAVE_TERM_H) */
+#if defined(HAVE_TERM_H) || !(defined(HAVE_TERMCAP_H) || defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H))
 extern int tgetent(char *, const char *);
 extern int tgetflag(const char *);
 extern int tgetnum(const char *);
 extern char *tgetstr(const char *, char **);
 extern int tputs (const char *, int, int (*)(int));
 extern char *tgoto (const char *, int, int);
-#endif /* defined(HAVE_TERM_H) */
+#endif /* defined(HAVE_TERM_H) or none_of_the_others */
 #include <sys/types.h>
 #include <sys/ioctl.h>
 

Modified: team/dlee/better-nicknames/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/parking/parking_bridge.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/res/parking/parking_bridge.c (original)
+++ team/dlee/better-nicknames/res/parking/parking_bridge.c Tue Oct 22 14:16:03 2013
@@ -368,16 +368,16 @@
 	case PARK_UNSET:
 		/* This should be impossible now since the resolution is forcibly set to abandon if it was unset at this point. Resolution
 		   isn't allowed to be changed when it isn't currently PARK_UNSET. */
-		return;
+		break;
 	case PARK_ABANDON:
 		/* Since the call was abandoned without additional handling, we need to issue the give up event and unpark the user. */
 		publish_parked_call(pu, PARKED_CALL_GIVEUP);
 		unpark_parked_user(pu);
-		return;
+		break;
 	case PARK_FORCED:
 		/* PARK_FORCED is currently unused, but it is expected that it would be handled similar to PARK_ANSWERED.
 		 * There is currently no event related to forced parked calls either */
-		return;
+		break;
 	case PARK_ANSWERED:
 		/* If answered or forced, the channel should be pulled from the bridge as part of that process and unlinked from
 		 * the parking lot afterwards. We do need to apply bridge features though and play the courtesy tone if set. */
@@ -387,14 +387,14 @@
 		if (pu->lot->cfg->parkedplay & AST_FEATURE_FLAG_BYCALLEE) {
 			ast_bridge_channel_queue_playfile(bridge_channel, NULL, pu->lot->cfg->courtesytone, NULL);
 		}
-
-		return;
+		break;
 	case PARK_TIMEOUT:
 		/* Timeout is similar to abandon because it simply sets the bridge state to end and doesn't
 		 * actually pull the channel. Because of that, unpark should happen in here. */
 		publish_parked_call(pu, PARKED_CALL_TIMEOUT);
+		parked_call_retrieve_enable_features(bridge_channel->chan, pu->lot, AST_FEATURE_FLAG_BYCALLEE);
 		unpark_parked_user(pu);
-		return;
+		break;
 	}
 }
 

Modified: team/dlee/better-nicknames/res/parking/parking_bridge_features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/parking/parking_bridge_features.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/res/parking/parking_bridge_features.c (original)
+++ team/dlee/better-nicknames/res/parking/parking_bridge_features.c Tue Oct 22 14:16:03 2013
@@ -452,6 +452,43 @@
 	return parking_park_call(bridge_channel, NULL, 0);
 }
 
+/*!
+ * \internal
+ * \brief Setup the caller features for when that channel is dialed.
+ * \since 12.0.0
+ *
+ * \param chan Parked channel leaving the parking lot.
+ * \param cfg Parking lot configuration.
+ *
+ * \return Nothing
+ */
+static void parking_timeout_set_caller_features(struct ast_channel *chan, struct parking_lot_cfg *cfg)
+{
+	char features[5];
+	char *pos;
+
+	/*
+	 * We are setting the callee Dial flag values because in the
+	 * timeout case, the caller is who is being called back.
+	 */
+	pos = features;
+	if (cfg->parkedcalltransfers & AST_FEATURE_FLAG_BYCALLER) {
+		*pos++ = 't';
+	}
+	if (cfg->parkedcallreparking & AST_FEATURE_FLAG_BYCALLER) {
+		*pos++ = 'k';
+	}
+	if (cfg->parkedcallhangup & AST_FEATURE_FLAG_BYCALLER) {
+		*pos++ = 'h';
+	}
+	if (cfg->parkedcallrecording & AST_FEATURE_FLAG_BYCALLER) {
+		*pos++ = 'x';
+	}
+	*pos = '\0';
+
+	pbx_builtin_setvar_helper(chan, "BRIDGE_FEATURES", features);
+}
+
 /*! \internal
  * \brief Interval hook. Pulls a parked call from the parking bridge after the timeout is passed and sets the resolution to timeout.
  *
@@ -481,25 +518,26 @@
 		ao2_unlock(user);
 		return -1;
 	}
-
 	user->resolution = PARK_TIMEOUT;
 	ao2_unlock(user);
 
 	ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
 		AST_CAUSE_NORMAL_CLEARING);
 
+	dial_string = user->parker_dial_string;
+	dial_string_flat = ast_strdupa(dial_string);
+	flatten_dial_string(dial_string_flat);
+
 	/* Set parking timeout channel variables */
 	snprintf(parking_space, sizeof(parking_space), "%d", user->parking_space);
+	ast_channel_stage_snapshot(chan);
 	pbx_builtin_setvar_helper(chan, "PARKING_SPACE", parking_space);
 	pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parking_space); /* Deprecated version of PARKING_SPACE */
 	pbx_builtin_setvar_helper(chan, "PARKEDLOT", user->lot->name);
-
-	dial_string = user->parker_dial_string;
-	dial_string_flat = ast_strdupa(dial_string);
-	flatten_dial_string(dial_string_flat);
-
 	pbx_builtin_setvar_helper(chan, "PARKER", dial_string);
 	pbx_builtin_setvar_helper(chan, "PARKER_FLAT", dial_string_flat);
+	parking_timeout_set_caller_features(chan, user->lot->cfg);
+	ast_channel_stage_snapshot_done(chan);
 
 	/* Dialplan generation for park-dial extensions */
 
@@ -532,7 +570,6 @@
 		user->lot->cfg->comebackdialtime);
 
 	duplicate_returnexten = ast_strdup(returnexten);
-
 	if (!duplicate_returnexten) {
 		ast_log(LOG_ERROR, "Failed to create parking redial parker extension %s@%s - Dial(%s)\n",
 			dial_string_flat, PARK_DIAL_CONTEXT, returnexten);

Modified: team/dlee/better-nicknames/res/res_parking.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/res/res_parking.c?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/res/res_parking.c (original)
+++ team/dlee/better-nicknames/res/res_parking.c Tue Oct 22 14:16:03 2013
@@ -98,8 +98,11 @@
 						<note><para>When parking times out and the channel returns to the dial plan, the following variables are set:
 						</para></note>
 						<variablelist>
+							<variable name="PARKING_SPACE">
+								<para>extension that the call was parked in prior to timing out.</para>
+							</variable>
 							<variable name="PARKINGSLOT">
-								<para>extension that the call was parked in prior to timing out.</para>
+								<para>Deprecated.  Use <variable>PARKING_SPACE</variable> instead.</para>
 							</variable>
 							<variable name="PARKEDLOT">
 								<para>name of the lot that the call was parked in prior to timing out.</para>
@@ -107,6 +110,9 @@
 							<variable name="PARKER">
 								<para>The device that parked the call</para>
 							</variable>
+							<variable name="PARKER_FLAT">
+								<para>The flat version of <variable>PARKER</variable></para>
+							</variable>
 						</variablelist>
 					</description>
 				</configOption>
@@ -131,33 +137,33 @@
 					<description>
 						<enumlist>
 							<enum name="no"><para>Apply to neither side.</para></enum>
-							<enum name="caller"><para>Apply to only to the caller picking up the parked call.</para></enum>
-							<enum name="callee"><para>Apply to only to the parked call being picked up.</para></enum>
-							<enum name="both"><para>Apply to both the caller and the callee.</para></enum>
+							<enum name="caller"><para>Apply only to the call connecting with the call coming out of the parking lot.</para></enum>
+							<enum name="callee"><para>Apply only to the call coming out of the parking lot.</para></enum>
+							<enum name="both"><para>Apply to both sides.</para></enum>
 						</enumlist>
 						<note><para>If courtesy tone is not specified then this option will be ignored.</para></note>
 					</description>
 				</configOption>
 				<configOption name="parkedcalltransfers" default="no">
-					<synopsis>Apply the DTMF transfer features to the caller and/or callee when parked calls are picked up.</synopsis>
+					<synopsis>Who to apply the DTMF transfer features to when parked calls are picked up or timeout.</synopsis>
 					<description>
 						<xi:include xpointer="xpointer(/docs/configInfo[@name='res_parking']/configFile[@name='res_parking.conf']/configObject[@name='parking_lot']/configOption[@name='parkedplay']/description/enumlist)" />
 					</description>
 				</configOption>
 				<configOption name="parkedcallreparking" default="no">
-					<synopsis>Apply the DTMF parking feature to the caller and/or callee when parked calls are picked up.</synopsis>
+					<synopsis>Who to apply the DTMF parking feature to when parked calls are picked up or timeout.</synopsis>
 					<description>
 						<xi:include xpointer="xpointer(/docs/configInfo[@name='res_parking']/configFile[@name='res_parking.conf']/configObject[@name='parking_lot']/configOption[@name='parkedplay']/description/enumlist)" />
 					</description>
 				</configOption>
 				<configOption name="parkedcallhangup" default="no">
-					<synopsis>Apply the DTMF Hangup feature to the caller and/or callee when parked calls are picked up.</synopsis>
+					<synopsis>Who to apply the DTMF hangup feature to when parked calls are picked up or timeout.</synopsis>
 					<description>
 						<xi:include xpointer="xpointer(/docs/configInfo[@name='res_parking']/configFile[@name='res_parking.conf']/configObject[@name='parking_lot']/configOption[@name='parkedplay']/description/enumlist)" />
 					</description>
 				</configOption>
 				<configOption name="parkedcallrecording" default="no">
-					<synopsis>Apply the DTMF recording features to the caller and/or callee when parked calls are picked up</synopsis>
+					<synopsis>Who to apply the DTMF MixMonitor recording feature to when parked calls are picked up or timeout.</synopsis>
 					<description>
 						<xi:include xpointer="xpointer(/docs/configInfo[@name='res_parking']/configFile[@name='res_parking.conf']/configObject[@name='parking_lot']/configOption[@name='parkedplay']/description/enumlist)" />
 					</description>

Modified: team/dlee/better-nicknames/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/better-nicknames/rest-api/api-docs/channels.json?view=diff&rev=401436&r1=401435&r2=401436
==============================================================================
--- team/dlee/better-nicknames/rest-api/api-docs/channels.json (original)
+++ team/dlee/better-nicknames/rest-api/api-docs/channels.json Tue Oct 22 14:16:03 2013
@@ -22,7 +22,7 @@
 					"summary": "Create a new channel (originate).",
 					"notes": "The new channel is created immediately and a snapshot of it returned. If a Stasis application is provided it will be automatically subscribed to the originated channel for further events and updates.",
 					"nickname": "originate",
-					"responseClass": "channel",
+					"responseClass": "Channel",
 					"parameters": [
 						{
 							"name": "endpoint",




More information about the asterisk-commits mailing list