Index: asterisk/channel.c =================================================================== RCS file: /usr/cvsroot/asterisk/channel.c,v retrieving revision 1.224 diff -u -r1.224 channel.c --- asterisk/channel.c 20 Jul 2005 16:39:49 -0000 1.224 +++ asterisk/channel.c 21 Jul 2005 17:12:07 -0000 @@ -557,6 +557,9 @@ struct ast_frame *prev, *cur; int blah = 1; int qlen = 0; + int voicelen = 0; + int otherlen = 0; + /* Build us a copy and free the original one */ f = ast_frdup(fin); if (!f) { @@ -573,22 +576,29 @@ ast_mutex_unlock(&chan->lock); return 0; } + + if (cur->frametype == AST_FRAME_VOICE) { + voicelen++; + } else { + otherlen++; + } + prev = cur; cur = cur->next; qlen++; } - /* Allow up to 96 voice frames outstanding, and up to 128 total frames */ - if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen > 128)) { - if (fin->frametype != AST_FRAME_VOICE) { - ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name); - CRASH; - } else { - ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name); - ast_frfree(f); - ast_mutex_unlock(&chan->lock); - return 0; - } + /* Allow up to 96 voice frames outstanding, and up to 128 total frames */ + if ((fin->frametype == AST_FRAME_VOICE) && (voicelen > 96)) { + ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name); + ast_frfree(f); + ast_mutex_unlock(&chan->lock); + return 0; + } + if ((fin->frametype != AST_FRAME_VOICE) && ((voicelen + otherlen) > 128)) { + ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name); + CRASH; } + if (prev) prev->next = f; else