mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
Write to read monitor before translation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1059 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
channel.c
13
channel.c
@@ -1064,12 +1064,19 @@ 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_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);
|
ast_frfree(f);
|
||||||
f = &null_frame;
|
f = &null_frame;
|
||||||
} else if (chan->pvt->readtrans) {
|
} 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);
|
f = ast_translate(chan->pvt->readtrans, f, 1);
|
||||||
if (!f)
|
if (!f)
|
||||||
f = &null_frame;
|
f = &null_frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure we always return NULL in the future */
|
/* Make sure we always return NULL in the future */
|
||||||
if (!f) {
|
if (!f) {
|
||||||
@@ -1089,10 +1096,6 @@ struct ast_frame *ast_read(struct ast_channel *chan)
|
|||||||
/* Answer the CDR */
|
/* Answer the CDR */
|
||||||
ast_setstate(chan, AST_STATE_UP);
|
ast_setstate(chan, AST_STATE_UP);
|
||||||
ast_cdr_answer(chan->cdr);
|
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);
|
pthread_mutex_unlock(&chan->lock);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user