aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_disa.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-26 07:08:47 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-26 07:08:47 +0000
commit3b2a896e6f97ed14d3c4e07c6a4e39976a584733 (patch)
tree0237cb4d2a9b78b253e5fb86221a195640910a75 /apps/app_disa.c
parenta4a27725e3f7ce850a8a0697392cd4a6dc56300e (diff)
Fix timeouts when no-password used (bug #3859)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5264 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_disa.c')
-rwxr-xr-xapps/app_disa.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 9f85c55e5..e60562c47 100755
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -180,7 +180,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
if (!strcasecmp(tmp, "no-password"))
{;
- k = 1;
+ k |= 1; /* We have the password */
ast_log(LOG_DEBUG, "DISA no-password login success\n");
}
gettimeofday(&lastdigittime,NULL);
@@ -192,10 +192,10 @@ static int disa_exec(struct ast_channel *chan, void *data)
gettimeofday(&now,NULL);
/* if outa time, give em reorder */
if (ms_diff(&now,&lastdigittime) >
- ((k) ? digittimeout : firstdigittimeout))
+ ((k&2) ? digittimeout : firstdigittimeout))
{
ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
- ((k) ? "extension" : "password"),chan->name);
+ ((k&1) ? "extension" : "password"),chan->name);
break;
}
if ((res = ast_waitfor(chan, -1) < 0)) {
@@ -230,13 +230,15 @@ static int disa_exec(struct ast_channel *chan, void *data)
j = f->subclass; /* save digit */
ast_frfree(f);
if (i == 0)
+ {
+ k|=2; /* We have the first digit */
ast_playtones_stop(chan);
-
+ }
gettimeofday(&lastdigittime,NULL);
/* got a DTMF tone */
if (i < AST_MAX_EXTENSION) /* if still valid number of digits */
{
- if (!k) /* if in password state */
+ if (!(k&1)) /* if in password state */
{
if (j == '#') /* end of password */
{
@@ -287,7 +289,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
ast_log(LOG_DEBUG,"DISA on chan %s password is good\n",chan->name);
play_dialtone(chan, mailbox);
- k = 1;
+ k|=1; /* In number mode */
i = 0; /* re-set buffer pointer */
exten[sizeof(acctcode)] = 0;
strncpy(acctcode,exten, sizeof(acctcode) - 1);
@@ -299,7 +301,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
exten[i++] = j; /* save digit */
exten[i] = 0;
- if (!k) continue; /* if getting password, continue doing it */
+ if (!(k&1)) continue; /* if getting password, continue doing it */
/* if this exists */
if (ast_ignore_pattern(ourcontext, exten)) {
@@ -318,7 +320,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
}
}
- if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->cid.cid_num))
+ if (k==3 && ast_exists_extension(chan,ourcontext,exten,1, chan->cid.cid_num))
{
ast_playtones_stop(chan);
/* We're authenticated and have a valid extension */