[asterisk-commits] rmudgett: trunk r402820 - /trunk/apps/app_directed_pickup.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 14 14:53:54 CST 2013


Author: rmudgett
Date: Thu Nov 14 14:53:52 2013
New Revision: 402820

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402820
Log:
Pickup: Ensure using PICKUPMARK never considers the picking channel.

Modified:
    trunk/apps/app_directed_pickup.c

Modified: trunk/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_directed_pickup.c?view=diff&rev=402820&r1=402819&r2=402820
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Thu Nov 14 14:53:52 2013
@@ -220,8 +220,14 @@
 static int find_by_mark(void *obj, void *arg, void *data, int flags)
 {
 	struct ast_channel *target = obj;/*!< Potential pickup target */
+	struct ast_channel *chan = arg;
 	const char *mark = data;
 	const char *tmp;
+
+	if (chan == target) {
+		/* The channel attempting to pickup a call cannot pickup itself. */
+		return 0;
+	}
 
 	ast_channel_lock(target);
 	tmp = pbx_builtin_getvar_helper(target, PICKUPMARK);
@@ -241,7 +247,7 @@
 	int res = -1;
 
 	/* The found channel is already locked. */
-	target = ast_channel_callback(find_by_mark, NULL, (char *) mark, 0);
+	target = ast_channel_callback(find_by_mark, chan, (char *) mark, 0);
 	if (target) {
 		res = ast_do_pickup(chan, target);
 		ast_channel_unlock(target);




More information about the asterisk-commits mailing list