Backport audio handling loop fixes from trunk version of app_fax.

This backport resolves some issues handling audio frames during FAX processing,
and ensures that the FAX application doesn't accidentally get notified of a T.38
switchover at the end of a successful FAX.

(closes issue #16127)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@225871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.2
Kevin P. Fleming 16 years ago
parent 73b59435b0
commit c9a23f6d78

@ -492,25 +492,27 @@ static int transmit_audio(fax_session *s)
while (!s->finished) {
inf = NULL;
if ((res = ast_waitfor(s->chan, 20)) < 0) {
if ((res = ast_waitfor(s->chan, 25)) < 0) {
ast_debug(1, "Error waiting for a frame\n");
break;
}
/* if nothing arrived, check the watchdog timers */
if (res == 0) {
now = ast_tvnow();
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
res = -1;
break;
} else {
/* timers have not triggered, loop around to wait
* again
*/
continue;
}
/* Watchdog */
now = ast_tvnow();
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
res = -1;
break;
}
if (!res) {
/* There was timeout waiting for a frame. Loop around and wait again */
continue;
}
/* There is a frame available. Get it */
res = 0;
if (!(inf = ast_read(s->chan))) {
ast_debug(1, "Channel hangup\n");
res = -1;

Loading…
Cancel
Save