aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xchannel.c13
-rwxr-xr-xinclude/asterisk/channel.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/channel.c b/channel.c
index 33538e7a2..8d235ea3b 100755
--- a/channel.c
+++ b/channel.c
@@ -726,6 +726,7 @@ int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen,
chan->generator->release(chan, chan->generatordata);
chan->generatordata = NULL;
}
+ ast_prod(chan);
if ((chan->generatordata = gen->alloc(chan, params))) {
chan->generator = gen;
} else {
@@ -1210,6 +1211,18 @@ static int do_senddigit(struct ast_channel *chan, char digit)
return 0;
}
+int ast_prod(struct ast_channel *chan)
+{
+ struct ast_frame a = { AST_FRAME_VOICE };
+ char nothing[128];
+ /* Send an empty audio frame to get things moving */
+ if (chan->_state != AST_STATE_UP) {
+ a.subclass = chan->pvt->rawwriteformat;
+ a.data = nothing + AST_FRIENDLY_OFFSET;
+ }
+ return 0;
+}
+
int ast_write(struct ast_channel *chan, struct ast_frame *fr)
{
int res = -1;
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 73ecc8b29..da849c899 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -462,6 +462,9 @@ struct ast_frame *ast_read(struct ast_channel *chan);
*/
int ast_write(struct ast_channel *chan, struct ast_frame *frame);
+/* Send empty audio to prime a channel driver */
+int ast_prod(struct ast_channel *chan);
+
//! Sets read format on channel chan
/*!
* \param chan channel to change