From d44aefeef476d744f2915d47c3fdc9b138cdd584 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Mon, 17 Mar 2014 17:22:12 +0000 Subject: Fix stuck channel in ARI through the introduction of synchronous bridge actions. Playing back a file to a channel in an ARI bridge would attempt to wait until the playback concluded before returning. The method used involved signaling the waiting thread in the ARI custom playback function. The problem with this is that there were some corner cases that were not accounted for: * If a bridge channel could not be found, then we never would attempt the playback but would still attempt to wait for the playback to complete. * If the bridge playfile action failed to queue, we would still attempt to wait for the playback to complete. * If the bridge playfile action were queued but some circumstance caused the playback not to occur (the bridge dies, the channel is removed from the bridge), then we would never be notified. The solution to this is to move the waiting logic into the bridge code. A new bridge API function is added to queue a synchronous action on a bridge. The waiting thread is notified when the queued frame has been freed, either due to an error occurring or due to successful playback. As a failsafe, the waiting thread has a 10 minute timeout just in case there is a frame leak somewhere. Review: https://reviewboard.asterisk.org/r/3338 ........ Merged revisions 410673 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410684 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_softmix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bridges') diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index 271f8564e..e2ab2135f 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -661,6 +661,9 @@ static int softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_cha case AST_FRAME_BRIDGE_ACTION: res = ast_bridge_queue_everyone_else(bridge, bridge_channel, frame); break; + case AST_FRAME_BRIDGE_ACTION_SYNC: + ast_log(LOG_ERROR, "Synchronous bridge action written to a softmix bridge.\n"); + ast_assert(0); default: ast_debug(3, "Frame type %d unsupported\n", frame->frametype); /* "Accept" the frame and discard it. */ -- cgit v1.2.3