aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-16 02:47:03 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-16 02:47:03 +0000
commit177e092ee9e1d265a953efd9d0f90fd77289cb46 (patch)
treef5f3665e6d5ac2806b317041f9323afd068088ee
parentb2f9fe53c3c09849e34b93cb2b78ea7ee811c8a8 (diff)
Add "prod" function, to get audio moving
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@856 f38db490-d61c-443f-a65b-d21fe96a405b
-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