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
This commit is contained in:
Joshua Colp
2013-06-13 11:02:16 +00:00
parent 1e9faaf78a
commit 65c492e851
8 changed files with 126 additions and 34 deletions

View File

@@ -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 */

View File

@@ -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

View File

@@ -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
);
/*! @} */