aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-05 09:31:11 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-05 09:31:11 +0000
commit73a43a142e81c66b275dcff6ca7fbfa021795c1a (patch)
tree626d8014327c44505a2b4adc7cfdaebfd56fa449
parent5ee41a6f0bb1afd380d2c34bb837772a847500d0 (diff)
fix timeout with no password (bug #3589)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/v1-0@5401 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xCHANGES2
-rwxr-xr-xapps/app_disa.c18
2 files changed, 12 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 3b1521c20..f28020cb2 100755
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,8 @@
-- res_agi
-- A fix has been added to prevent calls from being hung up when more than one
call is executing an AGI script calling the GET DATA command.
+ -- app_disa
+ -- Fixed the timeout used when no password is set
-- general
-- A problem has been fixed with saying the date in Spanish.
-- A line was missing for the autosupport script that caused "make rpm" to fail
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 03f13c67c..3d4f866f9 100755
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -161,7 +161,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);
@@ -173,10 +173,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)) {
@@ -211,13 +211,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 */
{
@@ -268,7 +270,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);
- k = 1;
+ k|=1; /* In number mode */
i = 0; /* re-set buffer pointer */
exten[sizeof(acctcode)] = 0;
strncpy(acctcode,exten, sizeof(acctcode) - 1);
@@ -280,7 +282,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)) {
@@ -299,7 +301,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
}
}
- if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->callerid))
+ if ((k==3) && (ast_exists_extension(chan,ourcontext,exten,1, chan->callerid)))
{
ast_playtones_stop(chan);
/* We're authenticated and have a valid extension */