diff --git a/apps/app_amd.c b/apps/app_amd.c index 3f805bb9abaa9257c36417fdf2f9f79581c732f1..5285287bfb0e7c34a02d28c7fbd1ddcee3ce31d7 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -280,7 +280,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) int ms = 0; /* Figure out how long we waited */ - if (res > 0) { + if (res >= 0) { ms = 2 * maxWaitTimeForFrame - res; } @@ -410,6 +410,14 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) } } + } else { + iTotalTime += ms; + if (iTotalTime >= totalAnalysisTime) { + ast_frfree(f); + strcpy(amdStatus , "NOTSURE"); + sprintf(amdCause , "TOOLONG-%d", iTotalTime); + break; + } } ast_frfree(f); }