[asterisk-bugs] [JIRA] (ASTERISK-28143) app_amd: Infinite loop on silent calls
Jessie Kid Fernando (JIRA)
noreply at issues.asterisk.org
Fri Oct 25 08:55:48 CDT 2019
[ https://issues.asterisk.org/jira/browse/ASTERISK-28143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=248528#comment-248528 ]
Jessie Kid Fernando edited comment on ASTERISK-28143 at 10/25/19 8:55 AM:
--------------------------------------------------------------------------
I have compiled this one and currently this is the code from line 280 - 308. Let me know if this is correct.
/* Now we go into a loop waiting for frames from the channel */
while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {
int ms = 0;
/* Figure out how long we waited */
if (res > 0) {
ms = 2 * maxWaitTimeForFrame - res;
} else {
ms = 2 * maxWaitTimeForFrame;
}
/* If we fail to read in a frame, that means they hung up */
if (!(f = ast_read(chan))) {
ast_verb(3, "AMD: Channel [%s]. HANGUP\n", ast_channel_name(chan));
ast_debug(1, "Got hangup\n");
strcpy(amdStatus, "HANGUP");
res = 1;
break;
}
if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_CNG || f->frametype == AST_FRAME_NULL) {
/* Figure out how long the frame is in milliseconds */
if (f->frametype == AST_FRAME_VOICE) {
framelength = (ast_codec_samples_count(f) / DEFAULT_SAMPLES_PER_MS);
} else {
framelength = ms;
}
iTotalTime += framelength;
was (Author: jessiekidf at gmail.com):
I have compiled this one and currently this is the code from line 280 - 308. Let me know if this is correct.
280 /* Now we go into a loop waiting for frames from the channel */
281 while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {
282 int ms = 0;
283
284 /* Figure out how long we waited */
285 if (res > 0) {
286 ms = 2 * maxWaitTimeForFrame - res;
287 } else {
288 ms = 2 * maxWaitTimeForFrame;
289 }
290
291 /* If we fail to read in a frame, that means they hung up */
292 if (!(f = ast_read(chan))) {
293 ast_verb(3, "AMD: Channel [%s]. HANGUP\n", ast_channel_name(chan));
294 ast_debug(1, "Got hangup\n");
295 strcpy(amdStatus, "HANGUP");
296 res = 1;
297 break;
298 }
299
300 if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_CNG || f->frametype == AST_FRAME _NULL) {
301 /* Figure out how long the frame is in milliseconds */
302 if (f->frametype == AST_FRAME_VOICE) {
303 framelength = (ast_codec_samples_count(f) / DEFAULT_SAMPLES_PER_MS);
304 } else {
305 framelength = ms;
306 }
307
308 iTotalTime += framelength;
> app_amd: Infinite loop on silent calls
> ---------------------------------------
>
> Key: ASTERISK-28143
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-28143
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Applications/app_amd
> Affects Versions: 15.6.1
> Environment: Ubuntu with asterisk
> Reporter: Abhay Gupta
> Assignee: Abhay Gupta
> Labels: patch
> Target Release: 13.27.0, 16.4.0, 17.0.0
>
> Attachments: amd.patch
>
>
> On our production server , some of the calls never return from AMD application , from logs we could see that they have last gone into AMD() of dialplan and comes out only when the call is HANGUP .
> The suggested patch is to remove that infinite loop and has been tested for last few months and have been working well .
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list