--- app_directed_pickup.c.orig 2010-09-21 20:18:32.000000000 +0200 +++ app_directed_pickup.c 2010-09-21 20:29:28.000000000 +0200 @@ -179,18 +179,27 @@ char *chkchan; struct pickup_by_name_args pickup_args; - pickup_args.len = strlen(channame) + 1; - - chkchan = alloca(pickup_args.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, "-"); - - pickup_args.name = 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 */ + pickup_args.len = strlen(channame); + pickup_args.name = 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. + */ + pickup_args.len = strlen(channame) + 1; + chkchan = alloca(pickup_args.len + 1); + strcpy(chkchan, channame); + strcat(chkchan, "-"); + pickup_args.name = chkchan; + } return ast_channel_callback(pickup_by_name_cb, NULL, &pickup_args, 0); }