[asterisk-commits] dvossel: branch 1.6.2 r290375 - /branches/1.6.2/apps/app_directed_pickup.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 5 14:54:53 CDT 2010


Author: dvossel
Date: Tue Oct  5 14:54:50 2010
New Revision: 290375

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290375
Log:
Fixes PickupChan() not working with full channel name.

(closes issue #18011)
Reported by: schern
Patches:
      app_directed_pickup.c.2.patch uploaded by schern (license 995)
      app_directed_pickup.c.trunk.patch uploaded by schern (license 995)
Tested by: schern, dvossel


Modified:
    branches/1.6.2/apps/app_directed_pickup.c

Modified: branches/1.6.2/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/apps/app_directed_pickup.c?view=diff&rev=290375&r1=290374&r2=290375
==============================================================================
--- branches/1.6.2/apps/app_directed_pickup.c (original)
+++ branches/1.6.2/apps/app_directed_pickup.c Tue Oct  5 14:54:50 2010
@@ -129,16 +129,24 @@
 	size_t channame_len, chkchan_len;
 
 	channame_len = strlen(channame);
-	chkchan_len = channame_len + 1;
-
- 	chkchan = alloca(chkchan_len + 1);
-
-	/* need to append a '-' for the comparison so we check full channel name,
-	 * i.e SIP/hgc- , use a temporary variable so original stays the same for
-	 * debugging.
+
+	/* Check if channel name contains a '-'.
+	 * In this case the channel name will be interpreted as full channel name.
 	 */
-	strcpy(chkchan, channame);
-	strcat(chkchan, "-");
+	if (strchr(channame, '-')) {
+		/* check full channel name */
+		chkchan_len = channame_len;
+		chkchan = (char *)channame;
+	} else {
+		/* need to append a '-' for the comparison so we check full channel name,
+		 * i.e SIP/hgc- , use a temporary variable so original stays the same for
+		 * debugging.
+		 */
+		chkchan_len = channame_len + 1;
+		chkchan = alloca(chkchan_len + 1);
+		strcpy(chkchan, channame);
+		strcat(chkchan, "-");
+	}
 
 	for (chan = ast_walk_channel_by_name_prefix_locked(NULL, channame, channame_len);
 		 chan;




More information about the asterisk-commits mailing list