aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-26 15:56:08 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-26 15:56:08 +0000
commita0c0f8d3e7009ad3f20c95bf04c387495b7a6666 (patch)
treec4fe5b673c71c049f492ba534713a0cea72693f5 /apps
parent5339699544e33664ebf7471ca3313b7847d7fea3 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.6.2@225871 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_fax.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/app_fax.c b/apps/app_fax.c
index c4a1d42b6..17c75cf6b 100644
--- a/apps/app_fax.c
+++ b/apps/app_fax.c
@@ -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;