diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-05 19:56:29 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-10-05 19:56:29 +0000 |
commit | 9af5af227bfeeec721dc6f44c1a37ef4ba4886dd (patch) | |
tree | 8a2c034de80ead6eec068e7bf6b364389548b30a /apps | |
parent | bd17e241eeb7dacbfb055c384afa326f591add71 (diff) |
Merged revisions 290375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r290375 | dvossel | 2010-10-05 14:54:50 -0500 (Tue, 05 Oct 2010) | 10 lines
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
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@290376 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_directed_pickup.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index bcefb0661..3914e0d8e 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -179,18 +179,24 @@ static struct ast_channel *my_ast_get_channel_by_name_locked(const char *channam 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. + /* Check if channel name contains a '-'. + * In this case the channel name will be interpreted as full channel name. */ - strcpy(chkchan, channame); - strcat(chkchan, "-"); - - pickup_args.name = chkchan; + if (strchr(channame, '-')) { + /* 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); } |