Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 242729) +++ channels/chan_local.c (working copy) @@ -217,9 +217,7 @@ } if (other) { - if (other->pbx || other->_bridge || !ast_strlen_zero(other->appl)) { - ast_queue_frame(other, f); - } /* else the frame won't go anywhere */ + ast_queue_frame(other, f); ast_channel_unlock(other); } Index: main/channel.c =================================================================== --- main/channel.c (revision 242729) +++ main/channel.c (working copy) @@ -1028,24 +1028,24 @@ } } - if ((queued_frames + new_frames) > 128) { - ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name); - while ((f = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { - ast_frfree(f); + if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) { + int count = 0; + ast_log(LOG_WARNING, "Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ? "" : "voice ", chan->name); + AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, cur, frame_list) { + /* Save the most recent frame */ + if (!AST_LIST_NEXT(cur, frame_list)) { + break; + } else if (cur->frametype == AST_FRAME_VOICE || cur->frametype == AST_FRAME_VIDEO || cur->frametype == AST_FRAME_NULL) { + if (++count > 64) { + break; + } + AST_LIST_REMOVE_CURRENT(frame_list); + ast_frfree(cur); + } } - ast_channel_unlock(chan); - return 0; + AST_LIST_TRAVERSE_SAFE_END; } - if ((queued_voice_frames + new_voice_frames) > 96) { - ast_log(LOG_WARNING, "Exceptionally long voice queue length queuing to %s\n", chan->name); - while ((f = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { - ast_frfree(f); - } - ast_channel_unlock(chan); - return 0; - } - if (after) { AST_LIST_INSERT_LIST_AFTER(&chan->readq, &frames, after, frame_list); } else {