Asterisk - The Open Source Telephony Project
18.5.0
|
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation. More...
#include "asterisk/json.h"
#include "asterisk/manager.h"
#include "asterisk/utils.h"
#include "asterisk/event.h"
Go to the source code of this file.
Data Structures | |
struct | stasis_cache_update |
Cache update message. More... | |
struct | stasis_message_sanitizer |
Structure containing callbacks for Stasis message sanitization. More... | |
struct | stasis_message_vtable |
Virtual table providing methods for messages. More... | |
struct | stasis_subscription_change |
Holds details about changes to subscriptions for the specified topic. More... | |
Macros | |
#define | STASIS_MESSAGE_TYPE_CLEANUP(name) |
Boiler-plate messaging macro for cleaning up message types. More... | |
#define | STASIS_MESSAGE_TYPE_DEFN(name, ...) |
Boiler-plate messaging macro for defining public message types. More... | |
#define | STASIS_MESSAGE_TYPE_DEFN_LOCAL(name, ...) |
Boiler-plate messaging macro for defining local message types. More... | |
#define | STASIS_MESSAGE_TYPE_INIT(name) |
Boiler-plate messaging macro for initializing message types. More... | |
#define | stasis_subscribe(topic, callback, data) __stasis_subscribe(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | stasis_subscribe_pool(topic, callback, data) __stasis_subscribe_pool(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
#define | STASIS_UMOS_MAX (STASIS_UMOS_ENDPOINT + 1) |
Number of snapshot types. More... | |
Typedefs | |
typedef struct stasis_message *(* | cache_aggregate_calc_fn) (struct stasis_cache_entry *entry, struct stasis_message *new_snapshot) |
Callback to calculate the aggregate cache entry. More... | |
typedef void(* | cache_aggregate_publish_fn) (struct stasis_topic *topic, struct stasis_message *aggregate) |
Callback to publish the aggregate cache entry message. More... | |
typedef const char *(* | snapshot_get_id) (struct stasis_message *message) |
Callback extract a unique identity from a snapshot message. More... | |
typedef void(* | stasis_subscription_cb) (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Callback function type for Stasis subscriptions. More... | |
Enumerations | |
enum | stasis_message_type_result { STASIS_MESSAGE_TYPE_ERROR = -1, STASIS_MESSAGE_TYPE_SUCCESS, STASIS_MESSAGE_TYPE_DECLINED } |
Return code for Stasis message type creation attempts. More... | |
enum | stasis_subscription_message_filter { STASIS_SUBSCRIPTION_FILTER_NONE = 0, STASIS_SUBSCRIPTION_FILTER_FORCED_NONE, STASIS_SUBSCRIPTION_FILTER_SELECTIVE } |
Stasis subscription message filters. More... | |
enum | stasis_subscription_message_formatters { STASIS_SUBSCRIPTION_FORMATTER_NONE = 0, STASIS_SUBSCRIPTION_FORMATTER_JSON = 1 << 0, STASIS_SUBSCRIPTION_FORMATTER_AMI = 1 << 1, STASIS_SUBSCRIPTION_FORMATTER_EVENT = 1 << 2 } |
Stasis subscription formatter filters. More... | |
enum | stasis_user_multi_object_snapshot_type { STASIS_UMOS_CHANNEL = 0, STASIS_UMOS_BRIDGE, STASIS_UMOS_ENDPOINT } |
Object type code for multi user object snapshots. More... | |
Functions | |
struct stasis_subscription * | __stasis_subscribe (struct stasis_topic *topic, stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func) |
Create a subscription. More... | |
struct stasis_subscription * | __stasis_subscribe_pool (struct stasis_topic *topic, stasis_subscription_cb callback, void *data, const char *file, int lineno, const char *func) |
Create a subscription whose callbacks occur on a thread pool. More... | |
void | ast_multi_object_blob_add (struct ast_multi_object_blob *multi, enum stasis_user_multi_object_snapshot_type type, void *object) |
Add an object to a multi object blob previously created. More... | |
struct ast_multi_object_blob * | ast_multi_object_blob_create (struct ast_json *blob) |
Create a stasis multi object blob. More... | |
void | ast_multi_object_blob_single_channel_publish (struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob) |
Create and publish a stasis message blob on a channel with it's snapshot. More... | |
struct stasis_message_type * | ast_multi_user_event_type (void) |
Message type for custom user defined events with multi object blobs. More... | |
struct stasis_message * | stasis_cache_clear_create (struct stasis_message *message) |
A message which instructs the caching topic to remove an entry from its cache. More... | |
struct stasis_message_type * | stasis_cache_clear_type (void) |
Message type for clearing a message from a stasis cache. More... | |
struct stasis_cache * | stasis_cache_create (snapshot_get_id id_fn) |
Create a cache. More... | |
struct stasis_cache * | stasis_cache_create_full (snapshot_get_id id_fn, cache_aggregate_calc_fn aggregate_calc_fn, cache_aggregate_publish_fn aggregate_publish_fn) |
Create a cache. More... | |
struct ao2_container * | stasis_cache_dump (struct stasis_cache *cache, struct stasis_message_type *type) |
Dump cached items to a subscription for the ast_eid_default entity. More... | |
struct ao2_container * | stasis_cache_dump_all (struct stasis_cache *cache, struct stasis_message_type *type) |
Dump all entity items from the cache to a subscription. More... | |
struct ao2_container * | stasis_cache_dump_by_eid (struct stasis_cache *cache, struct stasis_message_type *type, const struct ast_eid *eid) |
Dump cached items to a subscription for a specific entity. More... | |
struct stasis_message * | stasis_cache_entry_get_aggregate (struct stasis_cache_entry *entry) |
Get the aggregate cache entry snapshot. More... | |
struct stasis_message * | stasis_cache_entry_get_local (struct stasis_cache_entry *entry) |
Get the local entity's cache entry snapshot. More... | |
struct stasis_message * | stasis_cache_entry_get_remote (struct stasis_cache_entry *entry, int idx) |
Get a remote entity's cache entry snapshot by index. More... | |
struct stasis_message * | stasis_cache_get (struct stasis_cache *cache, struct stasis_message_type *type, const char *id) |
Retrieve an item from the cache for the ast_eid_default entity. More... | |
struct ao2_container * | stasis_cache_get_all (struct stasis_cache *cache, struct stasis_message_type *type, const char *id) |
Retrieve all matching entity items from the cache. More... | |
struct stasis_message * | stasis_cache_get_by_eid (struct stasis_cache *cache, struct stasis_message_type *type, const char *id, const struct ast_eid *eid) |
Retrieve an item from the cache for a specific entity. More... | |
int | stasis_cache_init (void) |
struct stasis_message_type * | stasis_cache_update_type (void) |
Message type for cache update messages. More... | |
int | stasis_caching_accept_message_type (struct stasis_caching_topic *caching_topic, struct stasis_message_type *type) |
Indicate to a caching topic that we are interested in a message type. More... | |
struct stasis_topic * | stasis_caching_get_topic (struct stasis_caching_topic *caching_topic) |
Returns the topic of cached events from a caching topics. More... | |
int | stasis_caching_set_filter (struct stasis_caching_topic *caching_topic, enum stasis_subscription_message_filter filter) |
Set the message type filtering level on a cache. More... | |
struct stasis_caching_topic * | stasis_caching_topic_create (struct stasis_topic *original_topic, struct stasis_cache *cache) |
Create a topic which monitors and caches messages from another topic. More... | |
struct stasis_caching_topic * | stasis_caching_unsubscribe (struct stasis_caching_topic *caching_topic) |
Unsubscribes a caching topic from its upstream topic. More... | |
struct stasis_caching_topic * | stasis_caching_unsubscribe_and_join (struct stasis_caching_topic *caching_topic) |
Unsubscribes a caching topic from its upstream topic, blocking until all messages have been forwarded. More... | |
int | stasis_config_init (void) |
struct stasis_forward * | stasis_forward_all (struct stasis_topic *from_topic, struct stasis_topic *to_topic) |
Create a subscription which forwards all messages from one topic to another. More... | |
struct stasis_forward * | stasis_forward_cancel (struct stasis_forward *forward) |
int | stasis_init (void) |
Initialize the Stasis subsystem. More... | |
void | stasis_log_bad_type_access (const char *name) |
int | stasis_message_can_be_ami (struct stasis_message *msg) |
Determine if the given message can be converted to AMI. More... | |
struct stasis_message * | stasis_message_create (struct stasis_message_type *type, void *data) |
Create a new message. More... | |
struct stasis_message * | stasis_message_create_full (struct stasis_message_type *type, void *data, const struct ast_eid *eid) |
Create a new message for an entity. More... | |
void * | stasis_message_data (const struct stasis_message *msg) |
Get the data contained in a message. More... | |
const struct ast_eid * | stasis_message_eid (const struct stasis_message *msg) |
Get the entity id for a stasis_message. More... | |
const struct timeval * | stasis_message_timestamp (const struct stasis_message *msg) |
Get the time when a message was created. More... | |
struct ast_manager_event_blob * | stasis_message_to_ami (struct stasis_message *msg) |
Build the AMI representation of the message. More... | |
struct ast_event * | stasis_message_to_event (struct stasis_message *msg) |
Build the Generic event system representation of the message. More... | |
struct ast_json * | stasis_message_to_json (struct stasis_message *msg, struct stasis_message_sanitizer *sanitize) |
Build the JSON representation of the message. More... | |
struct stasis_message_type * | stasis_message_type (const struct stasis_message *msg) |
Get the message type for a stasis_message. More... | |
enum stasis_subscription_message_formatters | stasis_message_type_available_formatters (const struct stasis_message_type *message_type) |
Get a bitmap of available formatters for a message type. More... | |
enum stasis_message_type_result | stasis_message_type_create (const char *name, struct stasis_message_vtable *vtable, struct stasis_message_type **result) |
Create a new message type. More... | |
int | stasis_message_type_declined (const char *name) |
Check whether a message type is declined. More... | |
unsigned int | stasis_message_type_hash (const struct stasis_message_type *type) |
Gets the hash of a given message type. More... | |
int | stasis_message_type_id (const struct stasis_message_type *type) |
Gets the id of a given message type. More... | |
const char * | stasis_message_type_name (const struct stasis_message_type *type) |
Gets the name of a given message type. More... | |
void | stasis_publish (struct stasis_topic *topic, struct stasis_message *message) |
Publish a message to a topic's subscribers. More... | |
void | stasis_publish_sync (struct stasis_subscription *sub, struct stasis_message *message) |
Publish a message to a topic's subscribers, synchronizing on the specified subscriber. More... | |
void | stasis_subscription_accept_formatters (struct stasis_subscription *subscription, enum stasis_subscription_message_formatters formatters) |
Indicate to a subscription that we are interested in messages with one or more formatters. More... | |
int | stasis_subscription_accept_message_type (struct stasis_subscription *subscription, const struct stasis_message_type *type) |
Indicate to a subscription that we are interested in a message type. More... | |
void | stasis_subscription_cb_noop (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Stasis subscription callback function that does nothing. More... | |
struct stasis_message_type * | stasis_subscription_change_type (void) |
Gets the message type for subscription change notices. More... | |
int | stasis_subscription_decline_message_type (struct stasis_subscription *subscription, const struct stasis_message_type *type) |
Indicate to a subscription that we are not interested in a message type. More... | |
int | stasis_subscription_final_message (struct stasis_subscription *sub, struct stasis_message *msg) |
Determine whether a message is the final message to be received on a subscription. More... | |
int | stasis_subscription_is_done (struct stasis_subscription *subscription) |
Returns whether subscription has received its final message. More... | |
int | stasis_subscription_is_subscribed (const struct stasis_subscription *sub) |
Returns whether a subscription is currently subscribed. More... | |
void | stasis_subscription_join (struct stasis_subscription *subscription) |
Block until the last message is processed on a subscription. More... | |
int | stasis_subscription_set_congestion_limits (struct stasis_subscription *subscription, long low_water, long high_water) |
Set the high and low alert water marks of the stasis subscription. More... | |
int | stasis_subscription_set_filter (struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter) |
Set the message type filtering level on a subscription. More... | |
const char * | stasis_subscription_uniqueid (const struct stasis_subscription *sub) |
Get the unique ID for the subscription. More... | |
struct stasis_topic * | stasis_topic_create (const char *name) |
Create a new topic. More... | |
struct stasis_topic * | stasis_topic_create_with_detail (const char *name, const char *detail) |
Create a new topic with given detail. More... | |
const char * | stasis_topic_detail (const struct stasis_topic *topic) |
Return the detail of a topic. More... | |
struct stasis_topic * | stasis_topic_get (const char *name) |
Get a topic of the given name. More... | |
const char * | stasis_topic_name (const struct stasis_topic *topic) |
Return the name of a topic. More... | |
struct stasis_topic_pool * | stasis_topic_pool_create (struct stasis_topic *pooled_topic) |
Create a topic pool that routes messages from dynamically generated topics to the given topic. More... | |
void | stasis_topic_pool_delete_topic (struct stasis_topic_pool *pool, const char *topic_name) |
Delete a topic from the topic pool. More... | |
struct stasis_topic * | stasis_topic_pool_get_topic (struct stasis_topic_pool *pool, const char *topic_name) |
Find or create a topic in the pool. More... | |
int | stasis_topic_pool_topic_exists (const struct stasis_topic_pool *pool, const char *topic_name) |
Check if a topic exists in a pool. More... | |
size_t | stasis_topic_subscribers (const struct stasis_topic *topic) |
Return the number of subscribers of a topic. More... | |
const char * | stasis_topic_uniqueid (const struct stasis_topic *topic) |
Return the uniqueid of a topic. More... | |
struct stasis_subscription * | stasis_unsubscribe (struct stasis_subscription *subscription) |
Cancel a subscription. More... | |
struct stasis_subscription * | stasis_unsubscribe_and_join (struct stasis_subscription *subscription) |
Cancel a subscription, blocking until the last message is processed. More... | |
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
Definition in file stasis.h.
#define STASIS_MESSAGE_TYPE_CLEANUP | ( | name | ) |
Boiler-plate messaging macro for cleaning up message types.
Note that if your type is defined in core instead of a loadable module, you should call message type cleanup from an ast_register_cleanup() handler instead of an ast_register_atexit() handler.
The reason is that during an immediate shutdown, loadable modules (which may refer to core message types) are not unloaded. While the atexit handlers are run, there's a window of time where a module subscription might reference a core message type after it's been cleaned up. Which is bad.
name | Name of message type. |
Definition at line 1523 of file stasis.h.
Referenced by __unload_module(), aoc_shutdown(), cdr_engine_shutdown(), cleanup_module(), devstate_cleanup(), endpoints_stasis_cleanup(), file_shutdown(), load_module(), local_shutdown(), manager_confbridge_shutdown(), manager_shutdown(), meetme_stasis_cleanup(), mwi_cleanup(), parking_stasis_cleanup(), pbx_shutdown(), pickup_shutdown(), presence_state_engine_cleanup(), rtp_engine_shutdown(), security_stasis_cleanup(), stasis_bridging_cleanup(), stasis_cache_cleanup(), stasis_channels_cleanup(), stasis_cleanup(), stasis_system_cleanup(), test_cleanup(), and unload_module().
#define STASIS_MESSAGE_TYPE_DEFN | ( | name, | |
... | |||
) |
Boiler-plate messaging macro for defining public message types.
name | Name of message type. |
... | Virtual table methods for messages of this type. |
#define STASIS_MESSAGE_TYPE_DEFN_LOCAL | ( | name, | |
... | |||
) |
Boiler-plate messaging macro for defining local message types.
name | Name of message type. |
... | Virtual table methods for messages of this type. |
#define STASIS_MESSAGE_TYPE_INIT | ( | name | ) |
Boiler-plate messaging macro for initializing message types.
name | Name of message type. |
Definition at line 1501 of file stasis.h.
Referenced by __init_manager(), ast_aoc_cli_init(), ast_endpoint_stasis_init(), ast_file_init(), ast_local_init(), ast_parking_stasis_init(), ast_pbx_init(), ast_pickup_init(), ast_presence_state_engine_init(), ast_rtp_engine_init(), ast_security_stasis_init(), ast_stasis_bridging_init(), ast_stasis_channels_init(), ast_stasis_system_init(), ast_test_init(), devstate_init(), load_module(), manager_confbridge_init(), meetme_stasis_init(), mwi_init(), stasis_cache_init(), and stasis_init().
#define stasis_subscribe | ( | topic, | |
callback, | |||
data | |||
) | __stasis_subscribe(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Definition at line 652 of file stasis.h.
Referenced by acl_change_stasis_subscribe(), ast_res_pjsip_initialize_configuration(), AST_TEST_DEFINE(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), cc_generic_agent_start_monitoring(), create_cts(), create_new_generic_list(), devstate_init(), load_module(), load_pbx(), network_change_stasis_subscribe(), parking_manager_enable_stasis(), presence_change_common(), rtp_reload(), and xmpp_init_event_distribution().
#define stasis_subscribe_pool | ( | topic, | |
callback, | |||
data | |||
) | __stasis_subscribe_pool(topic, callback, data, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Definition at line 682 of file stasis.h.
Referenced by AST_TEST_DEFINE(), create_parked_subscription_full(), load_module(), park_and_announce_app_exec(), refer_blind_callback(), stasis_state_subscribe_pool(), subscribe_device_state(), and xmpp_init_event_distribution().
typedef struct stasis_message*(* cache_aggregate_calc_fn) (struct stasis_cache_entry *entry, struct stasis_message *new_snapshot) |
Callback to calculate the aggregate cache entry.
entry | Cache entry to calculate a new aggregate snapshot. |
new_snapshot | The shapshot that is being updated. |
typedef void(* cache_aggregate_publish_fn) (struct stasis_topic *topic, struct stasis_message *aggregate) |
Callback to publish the aggregate cache entry message.
Once an aggregate message is calculated. This callback publishes the message so subscribers will know the new value of an aggregated state.
topic | The aggregate message may be published to this topic. It is the topic to which the cache itself is subscribed. |
aggregate | The aggregate shapshot message to publish. |
typedef const char*(* snapshot_get_id) (struct stasis_message *message) |
Callback extract a unique identity from a snapshot message.
This identity is unique to the underlying object of the snapshot, such as the UniqueId field of a channel.
message | Message to extract id from. |
NULL
if the message_type of the message isn't a handled snapshot. typedef void(* stasis_subscription_cb) (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Return code for Stasis message type creation attempts.
Stasis subscription message filters.
Definition at line 297 of file stasis.h.
Stasis subscription formatter filters.
There should be an entry here for each member of stasis_message_vtable
struct stasis_subscription* __stasis_subscribe | ( | struct stasis_topic * | topic, |
stasis_subscription_cb | callback, | ||
void * | data, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Create a subscription.
In addition to being AO2 managed memory (requiring an ao2_cleanup() to free up this reference), the subscription must be explicitly unsubscribed from its topic using stasis_unsubscribe().
The invocations of the callback are serialized, but may not always occur on the same thread. The invocation order of different subscriptions is unspecified.
topic | Topic to subscribe to. |
callback | Callback function for subscription messages. |
data | Data to be passed to the callback, in addition to the message. |
NULL
on error. Definition at line 944 of file stasis.c.
References internal_stasis_subscribe().
Referenced by stasis_message_router_create_internal().
struct stasis_subscription* __stasis_subscribe_pool | ( | struct stasis_topic * | topic, |
stasis_subscription_cb | callback, | ||
void * | data, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Create a subscription whose callbacks occur on a thread pool.
In addition to being AO2 managed memory (requiring an ao2_cleanup() to free up this reference), the subscription must be explicitly unsubscribed from its topic using stasis_unsubscribe().
The invocations of the callback are serialized, but will almost certainly not always happen on the same thread. The invocation order of different subscriptions is unspecified.
Unlike stasis_subscribe, this function will explicitly use a threadpool to dispatch items to its callback
. This form of subscription should be used when many subscriptions may be made to the specified topic
.
topic | Topic to subscribe to. |
callback | Callback function for subscription messages. |
data | Data to be passed to the callback, in addition to the message. |
NULL
on error. Definition at line 955 of file stasis.c.
References internal_stasis_subscribe().
Referenced by stasis_message_router_create_internal().
struct stasis_message* stasis_cache_clear_create | ( | struct stasis_message * | message | ) |
A message which instructs the caching topic to remove an entry from its cache.
message | Message representative of the cache entry that should be cleared. This will become the data held in the stasis_cache_clear message. |
NULL
on error. Definition at line 778 of file stasis_cache.c.
References stasis_cache_clear_type(), and stasis_message_create().
Referenced by ast_delete_mwi_state_full(), ast_device_state_clear_cache(), ast_endpoint_shutdown(), AST_TEST_DEFINE(), clear_node_cache(), and remove_device_states_cb().
struct stasis_cache* stasis_cache_create | ( | snapshot_get_id | id_fn | ) |
Create a cache.
This is the backend store for a stasis_caching_topic. The cache is thread safe, allowing concurrent reads and writes.
The returned object is AO2 managed, so ao2_cleanup() when you're done.
id_fn | Callback to extract the id from a snapshot message. |
New | cache indexed by id_fn. |
Definition at line 360 of file stasis_cache.c.
References NULL, and stasis_cache_create_full().
Referenced by ast_presence_state_engine_init(), AST_TEST_DEFINE(), mwi_init(), and stasis_cp_all_create().
struct stasis_cache* stasis_cache_create_full | ( | snapshot_get_id | id_fn, |
cache_aggregate_calc_fn | aggregate_calc_fn, | ||
cache_aggregate_publish_fn | aggregate_publish_fn | ||
) |
Create a cache.
This is the backend store for a stasis_caching_topic. The cache is thread safe, allowing concurrent reads and writes.
The returned object is AO2 managed, so ao2_cleanup() when you're done.
id_fn | Callback to extract the id from a snapshot message. |
aggregate_calc_fn | Callback to calculate the aggregate cache entry. |
aggregate_publish_fn | Callback to publish the aggregate cache entry. |
New | cache indexed by id_fn. |
Definition at line 334 of file stasis_cache.c.
References stasis_cache::aggregate_calc_fn, stasis_cache::aggregate_publish_fn, AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_alloc_options, ao2_cleanup, ao2_container_alloc_hash, cache, cache_dtor(), cache_entry_cmp(), cache_entry_hash(), stasis_cache::entries, stasis_cache::id_fn, NULL, and NUM_CACHE_BUCKETS.
Referenced by AST_TEST_DEFINE(), devstate_init(), and stasis_cache_create().
struct ao2_container* stasis_cache_dump | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type | ||
) |
Dump cached items to a subscription for the ast_eid_default entity.
cache | The cache to query. |
type | Type of message to dump (any type if NULL ). |
ao2_container | containing all matches (must be unreffed by caller) |
Definition at line 736 of file stasis_cache.c.
References ast_eid_default, and stasis_cache_dump_by_eid().
Referenced by action_presencestatelist(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), AST_TEST_DEFINE(), asterisk_publication_devicestate_refresh(), asterisk_publication_mwi_refresh(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), endpoints_scrape_cb(), load_module(), unload_module(), and xmpp_init_event_distribution().
struct ao2_container* stasis_cache_dump_all | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type | ||
) |
Dump all entity items from the cache to a subscription.
cache | The cache to query. |
type | Type of message to dump (any type if NULL ). |
ao2_container | containing all matches (must be unreffed by caller) |
Definition at line 757 of file stasis_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_callback, ao2_container_alloc_list, ast_assert, cache_dump_all_cb(), cache_dump_data::container, cache_dump_data::eid, stasis_cache::entries, NULL, OBJ_MULTIPLE, OBJ_NODATA, stasis_cache_clear_type(), stasis_cache_update_type(), STASIS_MESSAGE_TYPE_DEFN(), type, and cache_dump_data::type.
Referenced by AST_TEST_DEFINE(), cache_cleanup(), and cleanup_module().
struct ao2_container* stasis_cache_dump_by_eid | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type, | ||
const struct ast_eid * | eid | ||
) |
Dump cached items to a subscription for a specific entity.
cache | The cache to query. |
type | Type of message to dump (any type if NULL ). |
eid | Specific entity id to retrieve. NULL for aggregate. |
ao2_container | containing all matches (must be unreffed by caller) |
Definition at line 718 of file stasis_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_callback, ao2_container_alloc_list, ast_assert, cache_dump_by_eid_cb(), cache_dump_data::container, cache_dump_data::eid, stasis_cache::entries, NULL, OBJ_MULTIPLE, OBJ_NODATA, type, and cache_dump_data::type.
Referenced by action_devicestatelist(), AST_TEST_DEFINE(), cpg_confchg_cb(), and stasis_cache_dump().
struct stasis_message* stasis_cache_entry_get_aggregate | ( | struct stasis_cache_entry * | entry | ) |
Get the aggregate cache entry snapshot.
entry | Cache entry to get the aggregate snapshot. |
Aggregate-snapshot | in cache. |
NULL | if not present. |
Definition at line 365 of file stasis_cache.c.
References stasis_cache_entry::aggregate.
Referenced by cache_test_aggregate_calc_fn(), and device_state_aggregate_calc().
struct stasis_message* stasis_cache_entry_get_local | ( | struct stasis_cache_entry * | entry | ) |
Get the local entity's cache entry snapshot.
entry | Cache entry to get the local entity's snapshot. |
Internal-snapshot | in cache. |
NULL | if not present. |
Definition at line 370 of file stasis_cache.c.
References stasis_cache_entry::local.
Referenced by cache_test_aggregate_calc_fn(), and device_state_aggregate_calc().
struct stasis_message* stasis_cache_entry_get_remote | ( | struct stasis_cache_entry * | entry, |
int | idx | ||
) |
Get a remote entity's cache entry snapshot by index.
entry | Cache entry to get a remote entity's snapshot. |
idx | Which remote entity's snapshot to get. |
Remote-entity-snapshot | in cache. |
NULL | if not present. |
Definition at line 375 of file stasis_cache.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, and NULL.
Referenced by cache_test_aggregate_calc_fn(), and device_state_aggregate_calc().
struct stasis_message* stasis_cache_get | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type, | ||
const char * | id | ||
) |
Retrieve an item from the cache for the ast_eid_default entity.
The returned item is AO2 managed, so ao2_cleanup() when you're done with it.
cache | The cache to query. |
type | Type of message to retrieve. |
id | Identity of the snapshot to retrieve. |
Message | from the cache. |
Definition at line 686 of file stasis_cache.c.
References ast_eid_default, and stasis_cache_get_by_eid().
Referenced by ast_endpoint_latest_snapshot(), AST_TEST_DEFINE(), get_cached_mwi(), has_voicemail(), presence_state_cached(), unistim_send_mwi_to_peer(), and update_registry().
struct ao2_container* stasis_cache_get_all | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type, | ||
const char * | id | ||
) |
Retrieve all matching entity items from the cache.
cache | The cache to query. |
type | Type of message to retrieve. |
id | Identity of the snapshot to retrieve. |
Container | of matching items found. |
Definition at line 587 of file stasis_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_rdlock, ao2_unlock, ast_assert, cache_entry_dump(), cache_find(), stasis_cache::entries, and NULL.
Referenced by AST_TEST_DEFINE().
struct stasis_message* stasis_cache_get_by_eid | ( | struct stasis_cache * | cache, |
struct stasis_message_type * | type, | ||
const char * | id, | ||
const struct ast_eid * | eid | ||
) |
Retrieve an item from the cache for a specific entity.
The returned item is AO2 managed, so ao2_cleanup() when you're done with it.
cache | The cache to query. |
type | Type of message to retrieve. |
id | Identity of the snapshot to retrieve. |
eid | Specific entity id to retrieve. NULL for aggregate. |
Message | from the cache. |
Definition at line 659 of file stasis_cache.c.
References ao2_bump, ao2_cleanup, ao2_rdlock, ao2_unlock, ast_assert, cache_entry_by_eid(), cache_find(), stasis_cache::entries, and NULL.
Referenced by ast_delete_mwi_state_full(), ast_device_state_clear_cache(), AST_TEST_DEFINE(), check_cache_aggregate(), devstate_cached(), and stasis_cache_get().
int stasis_cache_init | ( | void | ) |
Definition at line 1008 of file stasis_cache.c.
References ast_register_cleanup(), stasis_cache_cleanup(), stasis_cache_clear_type(), stasis_cache_update_type(), and STASIS_MESSAGE_TYPE_INIT.
Referenced by stasis_init().
int stasis_caching_accept_message_type | ( | struct stasis_caching_topic * | caching_topic, |
struct stasis_message_type * | type | ||
) |
Indicate to a caching topic that we are interested in a message type.
This will cause the caching topic to receive messages of the given message type. This enables internal filtering in the stasis message bus to reduce messages.
caching_topic | The caching topic. |
type | The message type we wish to receive. |
0 | on success |
-1 | failure |
Definition at line 90 of file stasis_cache.c.
References stasis_cache_clear_type(), stasis_subscription_accept_message_type(), stasis_subscription_change_type(), and stasis_caching_topic::sub.
Referenced by ast_presence_state_engine_init(), devstate_init(), and stasis_cp_single_accept_message_type().
struct stasis_topic* stasis_caching_get_topic | ( | struct stasis_caching_topic * | caching_topic | ) |
Returns the topic of cached events from a caching topics.
caching_topic | The caching topic. |
NULL
if caching_topic is NULL
. Definition at line 85 of file stasis_cache.c.
References stasis_caching_topic::topic.
Referenced by ast_device_state_topic_cached(), ast_mwi_topic_cached(), ast_presence_state_topic_cached(), AST_TEST_DEFINE(), stasis_cp_single_create(), and stasis_cp_single_topic_cached().
int stasis_caching_set_filter | ( | struct stasis_caching_topic * | caching_topic, |
enum stasis_subscription_message_filter | filter | ||
) |
Set the message type filtering level on a cache.
This will cause the underlying subscription to filter messages according to the provided filter level. For example if selective is used then only messages matching those provided to stasis_subscription_accept_message_type will be raised to the subscription callback.
caching_topic | The caching topic. |
filter | What filter to use |
0 | on success |
-1 | failure |
Definition at line 109 of file stasis_cache.c.
References stasis_subscription_set_filter(), and stasis_caching_topic::sub.
Referenced by ast_presence_state_engine_init(), devstate_init(), and stasis_cp_single_set_filter().
struct stasis_caching_topic* stasis_caching_topic_create | ( | struct stasis_topic * | original_topic, |
struct stasis_cache * | cache | ||
) |
Create a topic which monitors and caches messages from another topic.
The idea is that some topics publish 'snapshots' of some other object's state that should be cached. When these snapshot messages are received, the cache is updated, and a stasis_cache_update() message is forwarded, which has both the original snapshot message and the new message.
The returned object is AO2 managed, so ao2_cleanup() when done with it.
original_topic | Topic publishing snapshot messages. |
cache | Backend cache in which to keep snapshots. |
NULL
on error Definition at line 948 of file stasis_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_container_register(), ao2_ref, ast_asprintf, ast_atomic_fetchadd_int(), ast_free, ast_log, stasis_caching_topic::cache, cache, caching_topic_exec(), stasis_cache::entries, internal_stasis_subscribe(), LOG_ERROR, NULL, stasis_caching_topic::original_topic, print_cache_entry(), stasis_cache::registered, stasis_caching_topic_dtor(), stasis_topic_create(), stasis_topic_name(), stasis_caching_topic::sub, and stasis_caching_topic::topic.
Referenced by ast_presence_state_engine_init(), AST_TEST_DEFINE(), devstate_init(), mwi_init(), and stasis_cp_sink_create().
struct stasis_caching_topic* stasis_caching_unsubscribe | ( | struct stasis_caching_topic * | caching_topic | ) |
Unsubscribes a caching topic from its upstream topic.
This function returns immediately, so be sure to cleanup when stasis_subscription_final_message() is received.
caching_topic | Caching topic to unsubscribe |
NULL
for convenience Definition at line 119 of file stasis_cache.c.
References ao2_cleanup, ao2_ref, ast_log, LOG_ERROR, NULL, stasis_subscription_is_subscribed(), stasis_unsubscribe(), and stasis_caching_topic::sub.
Referenced by AST_TEST_DEFINE(), stasis_caching_unsubscribe_and_join(), and stasis_cp_single_unsubscribe().
struct stasis_caching_topic* stasis_caching_unsubscribe_and_join | ( | struct stasis_caching_topic * | caching_topic | ) |
Unsubscribes a caching topic from its upstream topic, blocking until all messages have been forwarded.
See stasis_unsubscriben_and_join() for more info on when to use this as opposed to stasis_caching_unsubscribe().
caching_topic | Caching topic to unsubscribe |
NULL
for convenience Definition at line 146 of file stasis_cache.c.
References ao2_cleanup, ao2_ref, NULL, stasis_caching_unsubscribe(), stasis_subscription_join(), and stasis_caching_topic::sub.
Referenced by AST_TEST_DEFINE(), devstate_cleanup(), mwi_cleanup(), and presence_state_engine_cleanup().
int stasis_config_init | ( | void | ) |
struct stasis_forward* stasis_forward_all | ( | struct stasis_topic * | from_topic, |
struct stasis_topic * | to_topic | ||
) |
Create a subscription which forwards all messages from one topic to another.
Note that the topic parameter of the invoked callback will the be the topic the message was sent to, not the topic the subscriber subscribed to.
from_topic | Topic to forward. |
to_topic | Destination topic of forwarded messages. |
NULL
on error. Definition at line 1578 of file stasis.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_ref, ao2_unlock, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, forward_dtor(), stasis_forward::from_topic, NULL, stasis_forward::to_topic, topic_add_subscription(), and topic_lock_both.
Referenced by __init_manager(), ari_bridges_play_new(), ast_ari_bridges_record(), ast_channel_forward_endpoint(), ast_channel_internal_setup_topics(), AST_TEST_DEFINE(), create_subscriptions(), endpoint_internal_create(), forwards_create_bridge(), forwards_create_channel(), forwards_create_endpoint(), load_general_config(), load_module(), manager_bridging_init(), manager_channels_init(), manager_mwi_init(), manager_subscriptions_init(), manager_system_init(), stasis_cp_all_create(), stasis_cp_single_create(), stasis_topic_pool_get_topic(), and state_alloc().
struct stasis_forward* stasis_forward_cancel | ( | struct stasis_forward * | forward | ) |
Definition at line 1548 of file stasis.c.
References ao2_cleanup, ao2_unlock, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_GET, AST_VECTOR_REMOVE_ELEM_UNORDERED, AST_VECTOR_SIZE, stasis_forward::from_topic, NULL, stasis_forward::to_topic, topic_lock_both, and topic_remove_subscription().
Referenced by all_dtor(), ari_bridges_play_new(), ast_ari_bridges_record(), ast_channel_internal_cleanup(), ast_endpoint_shutdown(), AST_TEST_DEFINE(), bridge_channel_control_thread(), cleanup_module(), destroy_subscriptions(), forwards_unsubscribe(), load_general_config(), load_module(), manager_bridging_cleanup(), manager_channels_shutdown(), manager_mwi_shutdown(), manager_shutdown(), manager_system_shutdown(), stasis_cp_single_unsubscribe(), state_dtor(), topic_pool_entry_dtor(), and unload_module().
int stasis_init | ( | void | ) |
Initialize the Stasis subsystem.
Definition at line 3061 of file stasis.c.
References ACO_EXACT, aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), ACO_PROCESS_ERROR, aco_set_defaults(), AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_container_alloc_hash, ao2_global_obj_ref, ao2_global_obj_replace_unref, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_multi_user_event_type(), ast_register_cleanup(), ast_threadpool_create(), AST_THREADPOOL_OPTIONS_VERSION, AST_VECTOR_INIT, ast_threadpool_options::auto_increment, declined_handler(), stasis_config::declined_message_types, FLDSET, globals, ast_threadpool_options::idle_timeout, stasis_threadpool_conf::idle_timeout_sec, ast_threadpool_options::initial_size, stasis_threadpool_conf::initial_size, LOG_ERROR, LOG_NOTICE, ast_threadpool_options::max_size, stasis_threadpool_conf::max_size, NULL, OPT_INT_T, PARSE_IN_RANGE, stasis_cache_init(), stasis_cleanup(), stasis_config_alloc(), STASIS_MESSAGE_TYPE_INIT, stasis_subscription_change_type(), SUBSCRIPTION_STATISTICS_BUCKETS, subscription_statistics_cmp(), subscription_statistics_hash(), stasis_config::threadpool_options, TOPIC_ALL_BUCKETS, TOPIC_STATISTICS_BUCKETS, topic_statistics_cmp(), topic_statistics_hash(), and ast_threadpool_options::version.
Referenced by asterisk_daemon().
void stasis_log_bad_type_access | ( | const char * | name | ) |
Definition at line 1940 of file stasis.c.
References ast_log, LOG_ERROR, and stasis_message_type_declined().
int stasis_message_can_be_ami | ( | struct stasis_message * | msg | ) |
Determine if the given message can be converted to AMI.
msg | Message to see if can be converted to AMI. |
0 | Cannot be converted |
non-zero | Can be converted |
Definition at line 251 of file stasis_message.c.
References HAS_VIRTUAL, and to_ami().
Referenced by manager_default_msg_cb().
struct stasis_message* stasis_message_create | ( | struct stasis_message_type * | type, |
void * | data | ||
) |
Create a new message.
This message is an ao2
object, and must be ao2_cleanup()'ed when you are done with it. Messages are also immutable, and must not be modified after they are initialized. Especially the data in the message.
type | Type of the message |
data | Immutable data that is the actual contents of the message |
NULL
on errorDefinition at line 174 of file stasis_message.c.
References ast_eid_default, and stasis_message_create_full().
Referenced by __ast_test_suite_event_notify(), aoc_publish_blob(), ast_bridge_blob_create(), ast_bridge_blob_create_from_snapshots(), ast_bridge_publish_attended_transfer(), ast_bridge_publish_blind_transfer(), ast_bridge_publish_merge(), ast_bridge_publish_state(), ast_cdr_engine_term(), ast_channel_publish_dial_internal(), ast_channel_publish_final_snapshot(), ast_channel_publish_snapshot(), ast_endpoint_blob_create(), ast_manager_publish_event(), ast_multi_object_blob_single_channel_publish(), ast_mwi_blob_create(), ast_rtp_publish_rtcp_message(), ast_system_publish_registry(), AST_TEST_DEFINE(), bridge_publish_state_from_blob(), bridge_topics_destroy(), cc_publish(), cdr_prop_write(), cdr_read(), cdr_write(), create_channel_blob_message(), create_endpoint_snapshot_message(), endpoint_publish_snapshot(), forkcdr_exec(), handle_security_event(), local_optimization_finished_cb(), local_optimization_started_cb(), presence_state_event(), publish_acl_change(), publish_app_cdr_message(), publish_chanspy_message(), publish_cluster_discovery_to_stasis_full(), publish_corosync_ping_to_stasis(), publish_format_update(), publish_hint_change(), publish_hint_remove(), publish_load_message_type(), publish_local_bridge_message(), publish_parked_call(), publish_parked_call_failure(), queue_publish_member_blob(), queue_publish_multi_channel_snapshot_blob(), send_call_pickup_stasis_message(), send_msg(), send_start_msg_snapshots(), send_subscription_subscribe(), send_subscription_unsubscribe(), stasis_app_user_event(), stasis_cache_clear_create(), stasis_test_message_create(), stun_monitor_request(), and update_create().
struct stasis_message* stasis_message_create_full | ( | struct stasis_message_type * | type, |
void * | data, | ||
const struct ast_eid * | eid | ||
) |
Create a new message for an entity.
This message is an ao2
object, and must be ao2_cleanup()'ed when you are done with it. Messages are also immutable, and must not be modified after they are initialized. Especially the data in the message.
type | Type of the message |
data | Immutable data that is the actual contents of the message |
eid | What entity originated this message. (NULL for aggregate) |
New | message |
Definition at line 140 of file stasis_message.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_ref, ao2_t_alloc_options, ast_tvnow(), stasis_message::data, stasis_message::eid, stasis_message::eid_ptr, stasis_message_type::name, NULL, stasis_message_dtor(), stasis_message::timestamp, type, and stasis_message::type.
Referenced by ast_publish_device_state_full(), AST_TEST_DEFINE(), cache_test_message_create_full(), create_foo_type_message(), device_state_aggregate_calc(), mwi_state_create_message(), and stasis_message_create().
void* stasis_message_data | ( | const struct stasis_message * | msg | ) |
Get the data contained in a message.
msg | Message. |
NULL
if msg is NULL
. Definition at line 195 of file stasis_message.c.
References stasis_message::data, and NULL.
Referenced by agent_login_to_ami(), agent_logoff_to_ami(), agi_channel_to_ami(), aoc_to_ami(), appcdr_callback(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bridge_publish_leave(), ast_channel_entered_bridge_to_json(), ast_channel_left_bridge_to_json(), ast_delete_mwi_state_full(), ast_endpoint_latest_snapshot(), ast_mwi_publish_by_mailbox(), AST_TEST_DEFINE(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_ami(), attended_transfer_to_json(), blind_transfer_to_ami(), blind_transfer_to_json(), bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), bridge_merge_cb(), bridge_merge_handler(), bridge_snapshot_update(), cache_test_aggregate_calc_fn(), cache_test_data_id(), cache_update(), cache_update_cb(), caching_topic_exec(), call_forwarded_handler(), call_pickup_to_ami(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write_callback(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_dial_cb(), cel_generic_cb(), cel_local_cb(), cel_parking_cb(), cel_pickup_cb(), cel_snapshot_update_cb(), channel_blob_to_json(), channel_chanspy_start_cb(), channel_chanspy_stop_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_flash_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_leave_cb(), channel_mixmonitor_mute_cb(), channel_mixmonitor_start_cb(), channel_mixmonitor_stop_cb(), channel_moh_start_cb(), channel_moh_stop_cb(), channel_monitor_start_cb(), channel_monitor_stop_cb(), channel_snapshot_update(), channel_unhold_cb(), check_cache_aggregate(), conf_send_event_to_participants(), confbridge_atxfer_cb(), confbridge_publish_manager_event(), confbridge_talking_cb(), consumer_exec(), contactstatus_to_ami(), contactstatus_to_json(), corosync_ping_to_event(), dahdichannel_to_ami(), device_state_aggregate_calc(), device_state_cb(), device_state_get_id(), devstate_cached(), devstate_change_cb(), devstate_to_ami(), devstate_to_event(), dial_to_json(), dtmf_end_to_json(), dump_cache_load(), dump_cache_unload(), dump_consumer(), endpoint_cache_clear(), endpoint_snapshot_get_id(), endpoints_scrape_cb(), explicit_publish_cb(), fake_ami(), fake_json(), find_route(), forkcdr_callback(), generic_agent_devstate_cb(), generic_monitor_devstate_cb(), get_bool_header(), get_cached_mwi(), handle_attended_transfer(), handle_blind_transfer(), handle_bridge_enter(), handle_bridge_enter_message(), handle_bridge_leave_message(), handle_channel_snapshot_update_message(), handle_dial_message(), handle_hangup(), handle_hint_change_message_type(), handle_local_optimization_begin(), handle_local_optimization_end(), handle_masquerade(), handle_mwi_state(), handle_parked_call_message(), has_voicemail(), hold_to_json(), implicit_publish_cb(), is_msg(), local_message_to_ami(), manager_generic_msg_cb(), meetme_stasis_cb(), moh_post_start(), moh_post_stop(), multi_user_event_to_ami(), multi_user_event_to_json(), mwi_app_event_cb(), mwi_event_cb(), mwi_startup_event_cb(), mwi_state_get_id(), mwi_to_event(), mwi_update_cb(), park_announce_update_cb(), parker_update_cb(), parking_event_cb(), peerstatus_to_ami(), peerstatus_to_json(), playback_to_json(), presence_state_cached(), presence_state_cb(), presence_state_get_id(), presence_state_to_ami(), queue_agent_cb(), queue_channel_to_ami(), queue_member_to_ami(), queue_multi_channel_to_ami(), recording_to_json(), refer_progress_bridge(), registry_message_cb(), remove_device_states_cb(), rtcp_report_to_ami(), rtcp_report_to_json(), security_event_to_ami(), security_stasis_cb(), session_timeout_to_ami(), startup_event_cb(), stasis_end_to_json(), stasis_start_to_json(), stasis_state_subscriber_data(), stasis_subscription_final_message(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_endpoint_update_handler(), subscription_persistence_event_cb(), system_registry_to_ami(), talking_start_to_ami(), talking_stop_to_ami(), test_cb(), test_suite_event_to_ami(), unhold_to_json(), unistim_send_mwi_to_peer(), update_registry(), updates(), varset_to_ami(), xmpp_pubsub_devstate_cb(), and xmpp_pubsub_mwi_cb().
const struct ast_eid* stasis_message_eid | ( | const struct stasis_message * | msg | ) |
Get the entity id for a stasis_message.
msg | Message to get eid. |
Entity | id of msg |
Definition at line 179 of file stasis_message.c.
References stasis_message::eid_ptr, and NULL.
Referenced by AST_TEST_DEFINE(), cache_entry_by_eid(), cache_entry_create(), cache_remove(), cache_udpate(), caching_topic_exec(), and clear_node_cache().
const struct timeval* stasis_message_timestamp | ( | const struct stasis_message * | msg | ) |
Get the time when a message was created.
msg | Message. |
NULL
if msg is NULL
. Definition at line 203 of file stasis_message.c.
References NULL, and stasis_message::timestamp.
Referenced by ast_bridge_merge_message_to_json(), ast_channel_entered_bridge_to_json(), ast_channel_left_bridge_to_json(), AST_TEST_DEFINE(), attended_transfer_to_json(), blind_transfer_to_json(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_dial_cb(), cel_generic_cb(), cel_local_cb(), cel_parking_cb(), cel_pickup_cb(), cel_snapshot_update_cb(), channel_blob_to_json(), contactstatus_to_json(), dial_to_json(), dtmf_end_to_json(), handle_bridge_enter_message(), handle_bridge_leave_message(), handle_channel_snapshot_update_message(), handle_dial_message(), handle_parked_call_message(), hold_to_json(), multi_user_event_to_json(), pack_bridge_and_channels(), peerstatus_to_json(), playback_to_json(), recording_to_json(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_endpoint_update_handler(), unhold_to_json(), and updates().
struct ast_manager_event_blob* stasis_message_to_ami | ( | struct stasis_message * | msg | ) |
Build the AMI representation of the message.
May return NULL
, to indicate no representation. The returned object should be ao2_cleanup()'ed.
msg | Message to convert to AMI. |
NULL
on error. NULL
if AMI format is not supported. Definition at line 224 of file stasis_message.c.
References INVOKE_VIRTUAL, and to_ami().
Referenced by action_devicestatelist(), action_presencestatelist(), AST_TEST_DEFINE(), and manager_default_msg_cb().
struct ast_event* stasis_message_to_event | ( | struct stasis_message * | msg | ) |
Build the Generic event system representation of the message.
May return NULL
, to indicate no representation. The returned object should be disposed of via ast_event_destroy.
msg | Message to convert to AMI. |
NULL
on error. NULL
if AMI format is not supported. Definition at line 236 of file stasis_message.c.
References INVOKE_VIRTUAL.
Referenced by publish_to_corosync().
struct ast_json* stasis_message_to_json | ( | struct stasis_message * | msg, |
struct stasis_message_sanitizer * | sanitize | ||
) |
Build the JSON representation of the message.
May return NULL
, to indicate no representation. The returned object should be ast_json_unref()'ed.
msg | Message to convert to JSON string. |
sanitize | Snapshot sanitization callback. |
NULL
on error. NULL
if JSON format is not supported. Definition at line 229 of file stasis_message.c.
References INVOKE_VIRTUAL.
Referenced by AST_TEST_DEFINE(), rtcp_message_handler(), and sub_default_handler().
struct stasis_message_type* stasis_message_type | ( | const struct stasis_message * | msg | ) |
Get the message type for a stasis_message.
msg | Message to type |
NULL
if msg is NULL
. Definition at line 187 of file stasis_message.c.
References NULL, and stasis_message::type.
Referenced by acl_change_stasis_cb(), appcdr_callback(), AST_TEST_DEFINE(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), cache_entry_create(), cache_put(), cache_simple(), cache_test_aggregate_calc_fn(), cache_test_data_id(), cache_update(), caching_topic_exec(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write_callback(), conf_send_event_to_participants(), confbridge_publish_manager_event(), device_state_cb(), device_state_get_id(), devstate_change_cb(), dispatch_message(), dump_consumer(), endpoint_snapshot_get_id(), find_route(), forkcdr_callback(), generic_agent_devstate_cb(), generic_monitor_devstate_cb(), handle_hint_change_message_type(), is_msg(), local_message_to_ami(), meetme_stasis_cb(), message_sink_cb(), mwi_event_cb(), mwi_startup_event_cb(), mwi_stasis_cb(), mwi_state_get_id(), mwi_update_cb(), network_change_stasis_cb(), pack_bridge_and_channels(), park_announce_update_cb(), parker_update_cb(), parking_event_cb(), presence_state_cb(), presence_state_get_id(), publish_msg(), queue_agent_cb(), refer_progress_bridge(), rtcp_report_to_ami(), rtp_topic_handler(), security_event_to_ami(), security_stasis_cb(), startup_event_cb(), stasis_subscription_final_message(), statsmaker(), sub_default_handler(), sub_endpoint_update_handler(), subscription_invoke(), subscription_persistence_event_cb(), test_cb(), update_create(), xmpp_pubsub_devstate_cb(), and xmpp_pubsub_mwi_cb().
enum stasis_subscription_message_formatters stasis_message_type_available_formatters | ( | const struct stasis_message_type * | message_type | ) |
Get a bitmap of available formatters for a message type.
message_type | Message type |
Definition at line 114 of file stasis_message.c.
References stasis_message_type::available_formatters.
Referenced by dispatch_message().
enum stasis_message_type_result stasis_message_type_create | ( | const char * | name, |
struct stasis_message_vtable * | vtable, | ||
struct stasis_message_type ** | result | ||
) |
Create a new message type.
stasis_message_type is an AO2 object, so ao2_cleanup() when you're done with it.
name | Name of the new type. | |
vtable | Virtual table of message methods. May be NULL . | |
[out] | result | The location where the new message type will be placed |
Definition at line 56 of file stasis_message.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_t_alloc_options, ast_atomic_fetchadd_int(), ast_hashtab_hash_string(), ast_strdup, stasis_message_type::available_formatters, stasis_message_type::hash, stasis_message_type::id, message_type_dtor(), message_type_id, stasis_message_type::name, null_vtable, STASIS_MESSAGE_TYPE_DECLINED, stasis_message_type_declined(), STASIS_MESSAGE_TYPE_ERROR, STASIS_MESSAGE_TYPE_SUCCESS, STASIS_SUBSCRIPTION_FORMATTER_AMI, STASIS_SUBSCRIPTION_FORMATTER_EVENT, STASIS_SUBSCRIPTION_FORMATTER_JSON, stasis_message_vtable::to_ami, stasis_message_vtable::to_event, stasis_message_vtable::to_json, type, and stasis_message_type::vtable.
Referenced by AST_TEST_DEFINE(), and create_message_types().
int stasis_message_type_declined | ( | const char * | name | ) |
Check whether a message type is declined.
name | The name of the message type to check |
zero | The message type is not declined |
non-zero | The message type is declined |
Definition at line 2283 of file stasis.c.
References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_ref, ast_log, stasis_declined_config::declined, stasis_config::declined_message_types, globals, LOG_NOTICE, and OBJ_SEARCH_KEY.
Referenced by stasis_log_bad_type_access(), and stasis_message_type_create().
unsigned int stasis_message_type_hash | ( | const struct stasis_message_type * | type | ) |
Gets the hash of a given message type.
type | The type to get the hash of. |
Definition at line 104 of file stasis_message.c.
References stasis_message_type::hash.
Referenced by cache_entry_compute_hash().
int stasis_message_type_id | ( | const struct stasis_message_type * | type | ) |
Gets the id of a given message type.
type | The type to get the id of. |
Definition at line 109 of file stasis_message.c.
References stasis_message_type::id.
Referenced by dispatch_message(), publish_msg(), stasis_subscription_accept_message_type(), stasis_subscription_decline_message_type(), and subscription_invoke().
const char* stasis_message_type_name | ( | const struct stasis_message_type * | type | ) |
Gets the name of a given message type.
type | The type to get. |
NULL
if type is NULL
. Definition at line 99 of file stasis_message.c.
References stasis_message_type::name.
Referenced by AST_TEST_DEFINE(), cache_find(), cache_simple(), cache_test_data_id(), caching_topic_exec(), dump_consumer(), print_cache_entry(), send_msg(), stasis_subscription_accept_message_type(), stasis_subscription_decline_message_type(), statistics_show_messages(), statistics_show_subscription(), and statsmaker().
void stasis_publish | ( | struct stasis_topic * | topic, |
struct stasis_message * | message | ||
) |
Publish a message to a topic's subscribers.
topic | Topic. |
message | Message to publish. |
This call is asynchronous and will return immediately upon queueing the message for delivery to the topic's subscribers.
Definition at line 1511 of file stasis.c.
References NULL, and publish_msg().
Referenced by __ast_test_suite_event_notify(), aoc_publish_blob(), app_send_end_msg(), ast_bridge_publish_attended_transfer(), ast_bridge_publish_blind_transfer(), ast_bridge_publish_enter(), ast_bridge_publish_leave(), ast_bridge_publish_merge(), ast_bridge_publish_state(), ast_cel_publish_event(), ast_channel_publish_blob(), ast_channel_publish_cached_blob(), ast_channel_publish_final_snapshot(), ast_channel_publish_snapshot(), ast_device_state_clear_cache(), ast_endpoint_blob_publish(), ast_endpoint_shutdown(), ast_manager_publish_event(), ast_monitor_start(), ast_monitor_stop(), ast_multi_object_blob_single_channel_publish(), ast_publish_device_state_full(), ast_rtp_publish_rtcp_message(), ast_system_publish_registry(), AST_TEST_DEFINE(), bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), bridge_merge_handler(), bridge_publish_state_from_blob(), bridge_topics_destroy(), cache_test_aggregate_publish_fn(), caching_topic_exec(), cc_publish(), clear_node_cache(), device_state_aggregate_publish(), endpoint_publish_snapshot(), endpoint_state_cb(), handle_security_event(), local_optimization_finished_cb(), local_optimization_started_cb(), manager_mute_mixmonitor(), meetme_stasis_generate_msg(), mixmonitor_exec(), moh_post_start(), moh_post_stop(), notify_new_message(), phase_e_handler(), presence_state_event(), publish_acl_change(), publish_chanspy_message(), publish_cluster_discovery_to_stasis_full(), publish_corosync_ping_to_stasis(), publish_format_update(), publish_hint_change(), publish_hint_remove(), publish_load_message_type(), publish_local_bridge_message(), publish_message_for_channel_topics(), publish_parked_call(), publish_parked_call_failure(), queue_publish_member_blob(), queue_publish_multi_channel_snapshot_blob(), remove_device_states_cb(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), send_call_pickup_stasis_message(), send_conf_stasis(), send_conf_stasis_snapshots(), send_msg(), send_start_msg_snapshots(), send_subscription_subscribe(), send_subscription_unsubscribe(), stasis_app_control_publish(), stasis_app_user_event(), stasis_state_publish(), stasis_state_publish_by_id(), stasis_state_remove_publish_by_id(), stop_mixmonitor_full(), stun_monitor_request(), and talk_detect_audiohook_cb().
void stasis_publish_sync | ( | struct stasis_subscription * | sub, |
struct stasis_message * | message | ||
) |
Publish a message to a topic's subscribers, synchronizing on the specified subscriber.
sub | Subscription to synchronize on. |
message | Message to publish. |
The caller of stasis_publish_sync will block until the specified subscriber completes handling of the message.
All other subscribers to the topic the stasis_subpscription is subscribed to are also delivered the message; this delivery however happens asynchronously.
Definition at line 1516 of file stasis.c.
References ast_assert, NULL, publish_msg(), and stasis_subscription::topic.
Referenced by AST_TEST_DEFINE(), and stasis_message_router_publish_sync().
void stasis_subscription_accept_formatters | ( | struct stasis_subscription * | subscription, |
enum stasis_subscription_message_formatters | formatters | ||
) |
Indicate to a subscription that we are interested in messages with one or more formatters.
subscription | Subscription to alter. |
formatters | A bitmap of stasis_subscription_message_formatters we wish to receive. |
Definition at line 1095 of file stasis.c.
References ao2_lock, ao2_unlock, ast_assert, NULL, and stasis_subscription::topic.
Referenced by AST_TEST_DEFINE(), stasis_message_router_accept_formatters(), and stasis_message_router_set_formatters_default().
int stasis_subscription_accept_message_type | ( | struct stasis_subscription * | subscription, |
const struct stasis_message_type * | type | ||
) |
Indicate to a subscription that we are interested in a message type.
This will cause the subscription to allow the given message type to be raised to our subscription callback. This enables internal filtering in the stasis message bus to reduce messages.
subscription | Subscription to add message type to. |
type | The message type we wish to receive. |
0 | on success |
-1 | failure |
Definition at line 1025 of file stasis.c.
References ao2_lock, ao2_unlock, ast_assert, AST_VECTOR_REPLACE, NULL, stasis_message_type_id(), stasis_message_type_name(), STASIS_SUBSCRIPTION_FILTER_FORCED_NONE, and stasis_subscription::topic.
Referenced by acl_change_stasis_subscribe(), add_peer_mwi_subs(), ast_mwi_subscribe_pool(), ast_res_pjsip_initialize_configuration(), AST_TEST_DEFINE(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), cc_generic_agent_start_monitoring(), create_new_generic_list(), create_parked_subscription_full(), devstate_init(), load_module(), load_pbx(), mwi_stasis_subscription_alloc(), network_change_stasis_subscribe(), park_and_announce_app_exec(), parking_manager_enable_stasis(), refer_blind_callback(), rtp_reload(), stasis_caching_accept_message_type(), stasis_message_router_add(), stasis_message_router_add_cache_update(), stasis_message_router_create_internal(), subscribe_device_state(), and xmpp_init_event_distribution().
void stasis_subscription_cb_noop | ( | void * | data, |
struct stasis_subscription * | sub, | ||
struct stasis_message * | message | ||
) |
Stasis subscription callback function that does nothing.
Definition at line 811 of file stasis.c.
Referenced by build_gateway(), build_peer(), and mkintf().
int stasis_subscription_decline_message_type | ( | struct stasis_subscription * | subscription, |
const struct stasis_message_type * | type | ||
) |
Indicate to a subscription that we are not interested in a message type.
subscription | Subscription to remove message type from. |
type | The message type we don't wish to receive. |
0 | on success |
-1 | failure |
Definition at line 1055 of file stasis.c.
References ao2_lock, ao2_unlock, ast_assert, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, NULL, stasis_message_type_id(), stasis_message_type_name(), and stasis_subscription::topic.
Referenced by AST_TEST_DEFINE().
int stasis_subscription_final_message | ( | struct stasis_subscription * | sub, |
struct stasis_message * | msg | ||
) |
Determine whether a message is the final message to be received on a subscription.
sub | Subscription on which the message was received. |
msg | Message to check. |
Definition at line 1176 of file stasis.c.
References stasis_subscription_change::description, stasis_message_data(), stasis_message_type(), stasis_subscription_change_type(), stasis_subscription_uniqueid(), and stasis_subscription_change::uniqueid.
Referenced by bridge_subscription_change_handler(), caching_topic_exec(), consumer_exec(), consumer_exec_sync(), consumer_finalize(), default_route(), device_state_cb(), dispatch_message(), endpoint_subscription_change(), generic_agent_devstate_cb(), message_sink_cb(), mwi_event_cb(), mwi_stasis_cb(), park_announce_update_cb(), parker_update_cb(), queue_bridge_cb(), queue_channel_cb(), refer_progress_bridge(), router_dispatch(), statsmaker(), sub_subscription_change_handler(), and subscription_invoke().
int stasis_subscription_is_done | ( | struct stasis_subscription * | subscription | ) |
Returns whether subscription has received its final message.
Note that a subscription is considered done even while the stasis_subscription_final_message() is being processed. This allows cleanup routines to check the status of the subscription.
subscription | Subscription. |
Definition at line 1120 of file stasis.c.
References ao2_lock, ao2_unlock, and stasis_subscription::final_message_rxed.
Referenced by router_dtor(), stasis_caching_topic_dtor(), stasis_message_router_is_done(), and subscription_dtor().
int stasis_subscription_is_subscribed | ( | const struct stasis_subscription * | sub | ) |
Returns whether a subscription is currently subscribed.
Note that there may still be messages queued up to be dispatched to this subscription, but the stasis_subscription_final_message() has been enqueued.
sub | Subscription to check |
Definition at line 1152 of file stasis.c.
References ao2_lock, ao2_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, sub, and stasis_subscription::topic.
Referenced by asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), router_dtor(), send_subscription_subscribe(), send_subscription_unsubscribe(), stasis_caching_topic_dtor(), stasis_caching_unsubscribe(), subscription_dtor(), xmpp_pubsub_devstate_cb(), and xmpp_pubsub_mwi_cb().
void stasis_subscription_join | ( | struct stasis_subscription * | subscription | ) |
Block until the last message is processed on a subscription.
This function will not return until the subscription's callback for the stasis_subscription_final_message() completes. This allows cleanup routines to run before unblocking the joining thread.
subscription | Subscription to block on. |
Definition at line 1107 of file stasis.c.
References ao2_lock, ao2_object_get_lockaddr(), ao2_unlock, ast_cond_wait, stasis_subscription::final_message_processed, and stasis_subscription::join_cond.
Referenced by stasis_caching_unsubscribe_and_join(), and stasis_unsubscribe_and_join().
int stasis_subscription_set_congestion_limits | ( | struct stasis_subscription * | subscription, |
long | low_water, | ||
long | high_water | ||
) |
Set the high and low alert water marks of the stasis subscription.
subscription | Pointer to a stasis subscription |
low_water | New queue low water mark. (-1 to set as 90% of high_water) |
high_water | New queue high water mark. |
0 | on success. |
-1 | on error (water marks not changed). |
Definition at line 1013 of file stasis.c.
References ast_taskprocessor_alert_set_levels(), and stasis_subscription::mailbox.
Referenced by stasis_message_router_set_congestion_limits().
int stasis_subscription_set_filter | ( | struct stasis_subscription * | subscription, |
enum stasis_subscription_message_filter | filter | ||
) |
Set the message type filtering level on a subscription.
This will cause the subscription to filter messages according to the provided filter level. For example if selective is used then only messages matching those provided to stasis_subscription_accept_message_type will be raised to the subscription callback.
subscription | Subscription that should receive all messages. |
filter | What filter to use |
0 | on success |
-1 | failure |
Definition at line 1079 of file stasis.c.
References ao2_lock, ao2_unlock, filter(), STASIS_SUBSCRIPTION_FILTER_FORCED_NONE, and stasis_subscription::topic.
Referenced by acl_change_stasis_subscribe(), ast_mwi_subscribe_pool(), ast_res_pjsip_initialize_configuration(), AST_TEST_DEFINE(), asterisk_start_devicestate_publishing(), asterisk_start_mwi_publishing(), cc_generic_agent_start_monitoring(), create_new_generic_list(), create_parked_subscription_full(), devstate_init(), load_module(), load_pbx(), network_change_stasis_subscribe(), park_and_announce_app_exec(), parking_manager_enable_stasis(), refer_blind_callback(), rtp_reload(), stasis_caching_set_filter(), stasis_message_router_add(), stasis_message_router_add_cache_update(), stasis_message_router_set_formatters_default(), subscribe_device_state(), and xmpp_init_event_distribution().
const char* stasis_subscription_uniqueid | ( | const struct stasis_subscription * | sub | ) |
Get the unique ID for the subscription.
sub | Subscription for which to get the unique ID. |
Definition at line 1171 of file stasis.c.
References stasis_subscription::uniqueid.
Referenced by AST_TEST_DEFINE(), stasis_subscription_final_message(), topic_add_subscription(), and topic_remove_subscription().
struct stasis_topic* stasis_topic_create | ( | const char * | name | ) |
Create a new topic.
name | Name of the new topic. |
NULL
on error. Definition at line 618 of file stasis.c.
References stasis_topic_create_with_detail().
Referenced by __init_manager(), app_create(), app_init(), ast_channel_internal_setup_topics(), ast_parking_stasis_init(), ast_presence_state_engine_init(), ast_rtp_engine_init(), ast_security_stasis_init(), ast_stasis_bridging_init(), ast_stasis_channels_init(), ast_stasis_system_init(), AST_TEST_DEFINE(), ast_test_init(), create_cts(), create_subscriptions(), devstate_init(), load_module(), stasis_caching_topic_create(), stasis_cp_all_create(), stasis_cp_sink_create(), stasis_state_manager_create(), stasis_topic_pool_get_topic(), and state_alloc().
struct stasis_topic* stasis_topic_create_with_detail | ( | const char * | name, |
const char * | detail | ||
) |
Create a new topic with given detail.
name | Name of the new topic. |
detail | Detail description of the new topic. i.e. "Queue main topic for subscribing every queue event" |
NULL
on error.Definition at line 569 of file stasis.c.
References ao2_ref, ao2_t_alloc, ast_debug, AST_VECTOR_INIT, INITIAL_SUBSCRIBERS_MAX, link_topic_proxy(), NULL, stasis_topic_get(), stasis_topic_statistics_create(), and topic_dtor().
Referenced by stasis_topic_create().
const char* stasis_topic_detail | ( | const struct stasis_topic * | topic | ) |
struct stasis_topic* stasis_topic_get | ( | const char * | name | ) |
Get a topic of the given name.
name | Topic's name. |
NULL
on error or not exist.Definition at line 623 of file stasis.c.
References ao2_weakproxy_find, and OBJ_SEARCH_KEY.
Referenced by link_topic_proxy(), stasis_show_topic(), and stasis_topic_create_with_detail().
const char* stasis_topic_name | ( | const struct stasis_topic * | topic | ) |
Return the name of a topic.
topic | Topic. |
NULL
if topic is NULL
. Definition at line 628 of file stasis.c.
References NULL.
Referenced by bridge_topics_destroy(), caching_topic_exec(), internal_stasis_subscribe(), stasis_caching_topic_create(), stasis_caching_topic_dtor(), stasis_message_router_create_internal(), stasis_state_add_publisher(), stasis_state_add_subscriber(), stasis_state_manager_create(), stasis_state_subscribe_pool(), stasis_topic_pool_create(), stasis_topic_pool_delete_topic(), stasis_topic_pool_get_topic(), state_alloc(), state_id_by_topic(), state_manager_dtor(), topic_add_subscription(), topic_pool_dtor(), topic_pool_entry_cmp(), and topic_remove_subscription().
struct stasis_topic_pool* stasis_topic_pool_create | ( | struct stasis_topic * | pooled_topic | ) |
Create a topic pool that routes messages from dynamically generated topics to the given topic.
pooled_topic | Topic to which messages will be routed |
NULL
on failure Definition at line 1833 of file stasis.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_container_alloc_hash, ao2_container_register(), ao2_ref, ast_alloca, NULL, pool, stasis_topic_pool::pool_container, stasis_topic_pool::pool_topic, stasis_topic_name(), TOPIC_POOL_BUCKETS, topic_pool_dtor(), topic_pool_entry_cmp(), and topic_pool_entry_hash().
Referenced by app_init(), ast_stasis_bridging_init(), and devstate_init().
void stasis_topic_pool_delete_topic | ( | struct stasis_topic_pool * | pool, |
const char * | topic_name | ||
) |
Delete a topic from the topic pool.
pool | Pool from which to delete the topic |
topic_name | Name of the topic to delete in the form of <pool_topic_name>/<topic_name> or just <topic_name> |
Definition at line 1864 of file stasis.c.
References ao2_find, OBJ_NODATA, OBJ_SEARCH_KEY, OBJ_UNLINK, stasis_topic_pool::pool_container, stasis_topic_pool::pool_topic, and stasis_topic_name().
Referenced by bridge_topics_destroy().
struct stasis_topic* stasis_topic_pool_get_topic | ( | struct stasis_topic_pool * | pool, |
const char * | topic_name | ||
) |
Find or create a topic in the pool.
pool | Pool for which to get the topic |
topic_name | Name of the topic to get |
NULL
if the topic was not found and could not be allocated Definition at line 1884 of file stasis.c.
References ao2_cleanup, ao2_find, ao2_link_flags, ast_asprintf, ast_free, topic_pool_entry::forward, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, stasis_topic_pool::pool_container, stasis_topic_pool::pool_topic, RAII_VAR, SCOPED_AO2LOCK, stasis_forward_all(), stasis_topic_create(), stasis_topic_name(), topic_pool_entry::topic, and topic_pool_entry_alloc().
Referenced by ast_device_state_topic(), ast_queue_topic(), and bridge_topics_init().
int stasis_topic_pool_topic_exists | ( | const struct stasis_topic_pool * | pool, |
const char * | topic_name | ||
) |
Check if a topic exists in a pool.
pool | Pool to check |
topic_name | Name of the topic to check |
1 | exists |
0 | does not exist |
Definition at line 1927 of file stasis.c.
References ao2_find, ao2_ref, OBJ_SEARCH_KEY, and stasis_topic_pool::pool_container.
Referenced by ast_publish_device_state_full().
size_t stasis_topic_subscribers | ( | const struct stasis_topic * | topic | ) |
Return the number of subscribers of a topic.
topic | Topic. |
Definition at line 644 of file stasis.c.
References AST_VECTOR_SIZE.
Referenced by caching_topic_exec(), and publish_msg().
const char* stasis_topic_uniqueid | ( | const struct stasis_topic * | topic | ) |
Return the uniqueid of a topic.
topic | Topic. |
NULL
if topic is NULL
. struct stasis_subscription* stasis_unsubscribe | ( | struct stasis_subscription * | subscription | ) |
Cancel a subscription.
Note that in an asynchronous system, there may still be messages queued or in transit to the subscription's callback. These will still be delivered. There will be a final 'SubscriptionCancelled' message, indicating the delivery of the final message.
subscription | Subscription to cancel. |
NULL
for convenience Definition at line 973 of file stasis.c.
References ao2_bump, ao2_cleanup, ast_log, ast_taskprocessor_push(), LOG_ERROR, stasis_subscription::mailbox, NULL, send_subscription_unsubscribe(), sub_cleanup(), stasis_subscription::topic, and topic_remove_subscription().
Referenced by AST_TEST_DEFINE(), cc_generic_agent_destructor(), destroy_cts(), generic_agent_devstate_cb(), generic_monitor_instance_list_destructor(), mwi_startup_event_cb(), park_and_announce_app_exec(), parked_subscription_datastore_destroy(), refer_progress_bridge(), refer_progress_destroy(), refer_progress_framehook_destroy(), startup_event_cb(), stasis_caching_unsubscribe(), stasis_message_router_unsubscribe(), stasis_state_unsubscribe(), stasis_unsubscribe_and_join(), subscription_persistence_event_cb(), unload_module(), and xmpp_init_event_distribution().
struct stasis_subscription* stasis_unsubscribe_and_join | ( | struct stasis_subscription * | subscription | ) |
Cancel a subscription, blocking until the last message is processed.
While normally it's recommended to stasis_unsubscribe() and wait for stasis_subscription_final_message(), there are times (like during a module unload) where you have to wait for the final message (otherwise you'll call a function in a shared module that no longer exists).
subscription | Subscription to cancel. |
NULL
for convenience Definition at line 1136 of file stasis.c.
References ao2_cleanup, ao2_ref, NULL, stasis_subscription_join(), and stasis_unsubscribe().
Referenced by acl_change_event_stasis_unsubscribe(), acl_change_stasis_unsubscribe(), ast_res_pjsip_destroy_configuration(), AST_TEST_DEFINE(), ast_xmpp_client_disconnect(), asterisk_stop_devicestate_publishing(), asterisk_stop_mwi_publishing(), devstate_cleanup(), network_change_stasis_unsubscribe(), parking_manager_disable_stasis(), presence_change_common(), remove_device_state_subscription(), rtp_reload(), stasis_message_router_unsubscribe_and_join(), stasis_state_unsubscribe_and_join(), unload_module(), and unload_pbx().