diff options
author | Dwayne M. Hubbard <dwayne.hubbard@gmail.com> | 2009-09-02 01:16:59 +0000 |
---|---|---|
committer | Dwayne M. Hubbard <dwayne.hubbard@gmail.com> | 2009-09-02 01:16:59 +0000 |
commit | b5c89b7d0c018ed6d6d563a81067d54d331e11a4 (patch) | |
tree | 2ae8c263a37da5db217b3a1207175ecc4ec9cc14 /apps | |
parent | 2cfddf8cb632fd00d1f790315cdaa39a1518ffaf (diff) |
Merged revisions 215270 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r215270 | dhubbard | 2009-09-01 18:04:52 -0500 (Tue, 01 Sep 2009) | 12 lines
Use strrchr() so SoftHangup will correctly truncate multi-hyphen channel names
In general channel names are in the form Foo/Bar-Z, but the channel name
could have multiple hyphens and look like Foo/B-a-r-Z. Use strrchr to
truncate the channel name at the last hyphen.
(closes issue #15810)
Reported by: dhubbard
Patches:
dw-softhangup-1.4.patch uploaded by dhubbard (license 733)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_softhangup.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index 2a7ab113a..50bdb6809 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -103,11 +103,13 @@ static int softhangup_exec(struct ast_channel *chan, const char *data) ast_copy_string(name, c->name, sizeof(name)); if (ast_test_flag(&flags, OPTION_ALL)) { /* CAPI is set up like CAPI[foo/bar]/clcnt */ - if (!strcmp(c->tech->type, "CAPI")) + if (!strcmp(c->tech->type, "CAPI")) { cut = strrchr(name, '/'); /* Basically everything else is Foo/Bar-Z */ - else - cut = strchr(name, '-'); + } else { + /* use strrchr() because Foo/Bar-Z could actually be Foo/B-a-r-Z */ + cut = strrchr(name,'-'); + } /* Get rid of what we've cut */ if (cut) *cut = 0; |