diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-05-28 19:38:02 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-05-28 19:38:02 +0000 |
commit | 84e8f2aba1ef50c243336b1deb68d1a4f1232627 (patch) | |
tree | 64565a337acd37450d8cab0ebc7824694e1374ca | |
parent | 5552f72418d0ee2083836ee42803d49ecc1c5cd6 (diff) |
Write to read monitor before translation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1059 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channel.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1064,10 +1064,17 @@ struct ast_frame *ast_read(struct ast_channel *chan) ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %d since our native format has changed to %d\n", chan->name, f->subclass, chan->nativeformats); ast_frfree(f); f = &null_frame; - } else if (chan->pvt->readtrans) { - f = ast_translate(chan->pvt->readtrans, f, 1); - if (!f) - f = &null_frame; + } else { + if (chan->monitor && chan->monitor->read_stream ) { + if( ast_writestream( chan->monitor->read_stream, f ) < 0 ) { + ast_log(LOG_WARNING, "Failed to write data to channel monitor read stream\n"); + } + } + if (chan->pvt->readtrans) { + f = ast_translate(chan->pvt->readtrans, f, 1); + if (!f) + f = &null_frame; + } } } @@ -1089,11 +1096,7 @@ struct ast_frame *ast_read(struct ast_channel *chan) /* Answer the CDR */ ast_setstate(chan, AST_STATE_UP); ast_cdr_answer(chan->cdr); - } else if( ( f->frametype == AST_FRAME_VOICE ) && chan->monitor && chan->monitor->read_stream ) { - if( ast_writestream( chan->monitor->read_stream, f ) < 0 ) { - ast_log(LOG_WARNING, "Failed to write data to channel monitor read stream\n"); - } - } + } pthread_mutex_unlock(&chan->lock); /* Run any generator sitting on the line */ |