diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index 2a7ab113ac..50bdb6809d 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;