diff options
author | Joshua Colp <jcolp@digium.com> | 2013-06-13 11:02:16 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2013-06-13 11:02:16 +0000 |
commit | 65c492e851639897d8db79741bdcebc3557ad29d (patch) | |
tree | ca67c5c9f3765f2dc4a45f2a4bdbc85c8d8b6fdd /include/asterisk | |
parent | 1e9faaf78a9caa4f03f456bf027aa139c31783f2 (diff) |
Add support for requiring that all queued messages on a caching topic have been handled before
retrieving from the cache and also change adding channels to an endpoint to be an immediate
operation.
Review: https://reviewboard.asterisk.org/r/2599/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/channel.h | 13 | ||||
-rw-r--r-- | include/asterisk/stasis.h | 18 | ||||
-rw-r--r-- | include/asterisk/stasis_endpoints.h | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index c2edc18e7..42d50f21b 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -152,6 +152,7 @@ extern "C" { #include "asterisk/framehook.h" #include "asterisk/stasis.h" #include "asterisk/json.h" +#include "asterisk/endpoints.h" #define DATASTORE_INHERIT_FOREVER INT_MAX @@ -4265,4 +4266,16 @@ struct ast_channel *ast_channel_yank(struct ast_channel *yankee); */ int ast_channel_move(struct ast_channel *dest, struct ast_channel *source); +/*! + * \since 12 + * \brief Forward channel stasis messages to the given endpoint + * + * \param chan The channel to forward from + * \param endpoint The endpoint to forward to + * + * \retval 0 Success + * \retval non-zero Failure + */ +int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint); + #endif /* _ASTERISK_CHANNEL_H */ diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h index bd303ebd8..19ebb41c9 100644 --- a/include/asterisk/stasis.h +++ b/include/asterisk/stasis.h @@ -670,9 +670,23 @@ struct stasis_topic *stasis_caching_get_topic(struct stasis_caching_topic *cachi * \return \c NULL if message is not found. * \since 12 */ -struct stasis_message *stasis_cache_get(struct stasis_caching_topic *caching_topic, +#define stasis_cache_get(caching_topic, type, id) stasis_cache_get_extended(caching_topic, type, id, 0) + +/*! + * \brief Retrieve an item from the cache. + * \param caching_topic The topic returned from stasis_caching_topic_create(). + * \param type Type of message to retrieve. + * \param id Identity of the snapshot to retrieve. + * \param guaranteed If set to 1 it is guaranteed that any pending messages have been processed. + * \return Message from the cache. The cache still owns the message, so + * ao2_ref() if you want to keep it. + * \return \c NULL if message is not found. + * \since 12 + */ +struct stasis_message *stasis_cache_get_extended(struct stasis_caching_topic *caching_topic, struct stasis_message_type *type, - const char *id); + const char *id, + unsigned int guaranteed); /*! * \brief Dump cached items to a subscription diff --git a/include/asterisk/stasis_endpoints.h b/include/asterisk/stasis_endpoints.h index 2aeb614e6..10abcd77b 100644 --- a/include/asterisk/stasis_endpoints.h +++ b/include/asterisk/stasis_endpoints.h @@ -122,12 +122,14 @@ struct stasis_caching_topic *ast_endpoint_topic_all_cached(void); * * \param tech Name of the endpoint's technology. * \param resource Resource name of the endpoint. + * \param guaranteed Whether to require all pending messages to have been processed or not. * \return Snapshot of the endpoint with the given name. * \return \c NULL if endpoint is not found, or on error. * \since 12 */ struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech, - const char *resource + const char *resource, + unsigned int guaranteed ); /*! @} */ |