diff options
author | dhubbard <dhubbard@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-01 23:04:52 +0000 |
---|---|---|
committer | dhubbard <dhubbard@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-01 23:04:52 +0000 |
commit | c98fe8ded415fd2de2bcd4ed189436f5cbe51f62 (patch) | |
tree | 350163e8aa520438d258c7b6734075f26dbbfaea | |
parent | fbc2bbdd0114641e407e495be4d4df1170ca24cc (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@215270 f38db490-d61c-443f-a65b-d21fe96a405b
-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 018edc07d..b13eadc08 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -79,11 +79,13 @@ static int softhangup_exec(struct ast_channel *chan, void *data) /* XXX watch out, i think it is wrong to access c-> after unlocking! */ if (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; |