Call pickup broken for DAHDI channels when beginning with #

The call pickup feature did not work on DAHDI devices for anything other than
feature codes beginning with * since all feature codes in chan_dahdi were
originally hard-coded to begin with *.  This patch is also applied to
chan_dahdi.c to fix this bug with radio modes.

(closes issue AST-621)
Review: https://reviewboard.asterisk.org/r/1336/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@330705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2011-08-03 13:38:17 +00:00
parent 27a0e8dfe4
commit 00c0f7d5b9
2 changed files with 56 additions and 2 deletions

View File

@@ -9689,6 +9689,33 @@ static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
return 0; return 0;
} }
static int canmatch_featurecode(const char *exten)
{
int extlen = strlen(exten);
const char *pickup_ext;
if (!extlen) {
return 1;
}
pickup_ext = ast_pickup_ext();
if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
return 1;
}
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
if (exten[0] == '*' && extlen < 3) {
if (extlen == 1) {
return 1;
}
/* "*0" should be processed before it gets here */
switch (exten[1]) {
case '6':
case '7':
case '8':
return 1;
}
}
return 0;
}
static void *analog_ss_thread(void *data) static void *analog_ss_thread(void *data)
{ {
struct ast_channel *chan = data; struct ast_channel *chan = data;
@@ -10232,7 +10259,7 @@ static void *analog_ss_thread(void *data)
} }
} else if (!ast_canmatch_extension(chan, chan->context, exten, 1, } else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))
&& ((exten[0] != '*') || (strlen(exten) > 2))) { && !canmatch_featurecode(exten)) {
ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<Unknown Caller>"), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<Unknown Caller>"),
chan->context); chan->context);

View File

@@ -1699,6 +1699,33 @@ static int analog_get_sub_fd(struct analog_pvt *p, enum analog_sub sub)
#define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB)) #define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
static int analog_canmatch_featurecode(const char *exten)
{
int extlen = strlen(exten);
const char *pickup_ext;
if (!extlen) {
return 1;
}
pickup_ext = ast_pickup_ext();
if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
return 1;
}
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
if (exten[0] == '*' && extlen < 3) {
if (extlen == 1) {
return 1;
}
/* "*0" should be processed before it gets here */
switch (exten[1]) {
case '6':
case '7':
case '8':
return 1;
}
}
return 0;
}
static void *__analog_ss_thread(void *data) static void *__analog_ss_thread(void *data)
{ {
struct analog_pvt *p = data; struct analog_pvt *p = data;
@@ -2293,7 +2320,7 @@ static void *__analog_ss_thread(void *data)
} }
} else if (!ast_canmatch_extension(chan, chan->context, exten, 1, } else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
chan->caller.id.number.valid ? chan->caller.id.number.str : NULL) chan->caller.id.number.valid ? chan->caller.id.number.str : NULL)
&& ((exten[0] != '*') || (strlen(exten) > 2))) { && !analog_canmatch_featurecode(exten)) {
ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
chan->caller.id.number.valid && chan->caller.id.number.str chan->caller.id.number.valid && chan->caller.id.number.str
? chan->caller.id.number.str : "<Unknown Caller>", ? chan->caller.id.number.str : "<Unknown Caller>",