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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 25 20:29:12 CDT 2012


Author: rmudgett
Date: Wed Apr 25 20:29:09 2012
New Revision: 363839

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363839
Log:
* Put more information in pickup_exec() LOG_NOTICE.

* Delay duplicating a string on the stack in pickup_exec().

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=363839&r1=363838&r2=363839
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Wed Apr 25 20:29:09 2012
@@ -274,14 +274,16 @@
 /* application entry point for Pickup() */
 static int pickup_exec(struct ast_channel *chan, const char *data)
 {
-	char *tmp = ast_strdupa(data);
-	char *exten = NULL, *context = NULL;
+	char *tmp;
+	char *exten;
+	char *context;
 
 	if (ast_strlen_zero(data)) {
 		return pickup_by_group(chan) ? 0 : -1;
 	}
 
 	/* Parse extension (and context if there) */
+	tmp = ast_strdupa(data);
 	while (!ast_strlen_zero(tmp) && (exten = strsep(&tmp, "&"))) {
 		if ((context = strchr(exten, '@')))
 			*context++ = '\0';
@@ -291,12 +293,15 @@
 				return -1;
 			}
 		} else {
-			if (!pickup_by_exten(chan, exten, !ast_strlen_zero(context) ? context : ast_channel_context(chan))) {
+			if (ast_strlen_zero(context)) {
+				context = (char *) ast_channel_context(chan);
+			}
+			if (!pickup_by_exten(chan, exten, context)) {
 				/* Pickup successful.  Stop the dialplan this channel is a zombie. */
 				return -1;
 			}
 		}
-		ast_log(LOG_NOTICE, "No target channel found for %s.\n", exten);
+		ast_log(LOG_NOTICE, "No target channel found for %s@%s.\n", exten, context);
 	}
 
 	/* Pickup failed.  Keep going in the dialplan. */




More information about the asterisk-commits mailing list