Index: main/channel.c =================================================================== --- main/channel.c (revision 43756) +++ main/channel.c (working copy) @@ -3597,7 +3597,7 @@ if (bridge_end.tv_sec) { to = ast_tvdiff_ms(bridge_end, ast_tvnow()); if (to <= 0) { - res = AST_BRIDGE_RETRY; + res = AST_BRIDGE_COMPLETE; break; } } else @@ -3786,8 +3786,10 @@ if (!ast_tvzero(nexteventts)) { now = ast_tvnow(); to = ast_tvdiff_ms(nexteventts, now); - if (to < 0) - to = 0; + if (to <= 0) { + res = AST_BRIDGE_COMPLETE; + break; + } } if (config->timelimit) { Index: res/res_features.c =================================================================== --- res/res_features.c (revision 43756) +++ res/res_features.c (working copy) @@ -1301,7 +1301,6 @@ int hasfeatures=0; int hadfeatures=0; struct ast_option_header *aoh; - struct timeval start = { 0 , 0 }; struct ast_bridge_config backup_config; memset(&backup_config, 0, sizeof(backup_config)); @@ -1354,22 +1353,22 @@ } for (;;) { struct ast_channel *other; /* used later */ - if (config->feature_timer) - start = ast_tvnow(); res = ast_channel_bridge(chan, peer, config, &f, &who); if (config->feature_timer) { + ast_verbose("has config->feature_timer ...\n"); /* Update time limit for next pass */ - diff = ast_tvdiff_ms(ast_tvnow(), start); + diff = ast_tvdiff_ms(ast_tvnow(), config->start_time); config->feature_timer -= diff; + ast_verbose("adjusted to %ld\n", config->feature_timer); if (hasfeatures) { + ast_verbose("hasfeatures ...\n"); /* Running on backup config, meaning a feature might be being activated, but that's no excuse to keep things going indefinitely! */ if (backup_config.feature_timer && ((backup_config.feature_timer -= diff) <= 0)) { - if (option_debug) - ast_log(LOG_DEBUG, "Timed out, realtime this time!\n"); + ast_log(LOG_DEBUG, "Timed out, realtime this time!\n"); config->feature_timer = 0; who = chan; if (f) @@ -1379,8 +1378,7 @@ } else if (config->feature_timer <= 0) { /* Not *really* out of time, just out of time for digits to come in for features. */ - if (option_debug) - ast_log(LOG_DEBUG, "Timed out for feature!\n"); + ast_log(LOG_DEBUG, "Timed out for feature!\n"); if (!ast_strlen_zero(peer_featurecode)) { ast_dtmf_stream(chan, peer, peer_featurecode, 0); memset(peer_featurecode, 0, sizeof(peer_featurecode)); @@ -1400,8 +1398,15 @@ hadfeatures = hasfeatures; /* Continue as we were */ continue; + } else if (!f) { + /* The bridge returned without a frame and there is a feature in progress. + * However, we don't think the feature has quite yet timed out, so just + * go back into the bridge. */ + ast_verbose("hasfeatures, but no frame :(\n"); + continue; } } else { + ast_verbose("doesn't have features ..."); if (config->feature_timer <=0) { /* We ran out of time */ config->feature_timer = 0; @@ -1421,6 +1426,7 @@ if (!f || (f->frametype == AST_FRAME_CONTROL && (f->subclass == AST_CONTROL_HANGUP || f->subclass == AST_CONTROL_BUSY || f->subclass == AST_CONTROL_CONGESTION ) ) ) { + ast_verbose("returning from !f (%d) or HANGUP/BUSY/CONGESTION\n", !f); res = -1; break; }