--- apps/app_directed_pickup.c.orig 2010-05-10 21:06:54.000000000 +0200 +++ apps/app_directed_pickup.c 2010-09-20 10:23:43.000000000 +0200 @@ -129,16 +129,27 @@ 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. - */ - strcpy(chkchan, channame); - strcat(chkchan, "-"); + /* Check if channel name contains a '-'. + * In this case the channel name will be interpreted as full channel name. + * */ + if (NULL != strchr(channame, (int) '-') ) + { + /* 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;