Add API for channel frame deferral.

There are several places in Asterisk that have duplicated logic
for deferring important frames until later.

This commit adds a couple of API calls to facilitate this automatically.

ast_channel_start_defer_frames(): Future reads of deferrable frames on
this channel will be deferred until later.

ast_channel_stop_defer_frames(): Any frames that have been deferred get
requeued onto the channel.

ASTERISK-26343

Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641
This commit is contained in:
Mark Michelson
2016-11-03 16:36:13 -05:00
committed by George Joseph
parent 61af0e6704
commit f073f648b8
3 changed files with 89 additions and 0 deletions

View File

@@ -221,6 +221,7 @@ struct ast_channel {
struct stasis_cp_single *topics; /*!< Topic for all channel's events */
struct stasis_forward *endpoint_forward; /*!< Subscription for event forwarding to endpoint's topic */
struct stasis_forward *endpoint_cache_forward; /*!< Subscription for cache updates to endpoint's topic */
struct ast_readq_list deferred_readq;
};
/*! \brief The monotonically increasing integer counter for channel uniqueids */
@@ -1681,3 +1682,8 @@ enum ast_channel_error ast_channel_internal_errno(void)
return *error_code;
}
struct ast_readq_list *ast_channel_deferred_readq(struct ast_channel *chan)
{
return &chan->deferred_readq;
}