]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes PickupChan() not working with full channel name.
authorDavid Vossel <dvossel@digium.com>
Tue, 5 Oct 2010 19:54:50 +0000 (19:54 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 5 Oct 2010 19:54:50 +0000 (19:54 +0000)
(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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@290375 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_directed_pickup.c

index a00cd475e2f87cb31f53fd8130a84611e1b611a8..26fc610a319f55acfef72c36fb224788e05e7a9d 100644 (file)
@@ -129,16 +129,24 @@ static struct ast_channel *my_ast_get_channel_by_name_locked(const char *channam
        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;