From: agupta Date: Tue, 4 Dec 2018 08:10:15 +0000 (+0530) Subject: app_amd: Fix infinite loop on silent calls X-Git-Tag: 13.27.0-rc1~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=188b1d3e6851465358498179573c536796246e19;p=thirdparty%2Fasterisk.git app_amd: Fix infinite loop on silent calls The total time logic will now be executed on calls which do not pass any media. ASTERISK-28143 Change-Id: I24726bd29d7e467fc721ca265363417234b22855 --- diff --git a/apps/app_amd.c b/apps/app_amd.c index 5a2543cd7e..f56fe792d4 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -282,7 +282,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; } @@ -412,6 +412,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); }