aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directed_pickup.c
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-05 19:54:50 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-05 19:54:50 +0000
commitf5ac6c7a586d0fd35d5173a06c29483de0711119 (patch)
tree05676f104005f33726f63a89ec986aba20cded75 /apps/app_directed_pickup.c
parentf0e50161e655078cf901786c009be3aa19c63be8 (diff)
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.6.2@290375 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directed_pickup.c')
-rw-r--r--apps/app_directed_pickup.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c
index a00cd475e..26fc610a3 100644
--- a/apps/app_directed_pickup.c
+++ b/apps/app_directed_pickup.c
@@ -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;