19#ifndef _ASTERISK_MWI_H
20#define _ASTERISK_MWI_H
94#if defined(__cplusplus) || defined(c_plusplus)
378#define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \
379 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL, NULL)
395#define ast_publish_mwi_state_channel(mailbox, context, new_msgs, old_msgs, channel_id) \
396 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, channel_id, NULL)
418 const char *channel_id,
431#define ast_delete_mwi_state(mailbox, context) \
432 ast_delete_mwi_state_full(mailbox, context, NULL)
572#define AST_MAX_MAILBOX_UNIQUEID (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2)
574#if defined(__cplusplus) || defined(c_plusplus)
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
struct ast_mwi_subscriber * ast_mwi_add_subscriber(const char *mailbox)
Add an MWI state subscriber to the mailbox.
struct stasis_subscription * ast_mwi_subscriber_subscription(struct ast_mwi_subscriber *sub)
Retrieve the stasis MWI topic subscription if available.
struct stasis_message_type * ast_mwi_vm_app_type(void)
Get the Stasis Message Bus API message type for voicemail application specific messages.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
struct stasis_message * ast_mwi_blob_create(struct ast_mwi_state *mwi_state, struct stasis_message_type *message_type, struct ast_json *blob)
Creates a ast_mwi_blob message.
int mwi_init(void)
Initialize the mwi core.
struct stasis_topic * ast_mwi_topic(const char *uniqueid)
Get the Stasis Message Bus API topic for MWI messages on a unique ID.
int ast_publish_mwi_state_full(const char *mailbox, const char *context, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish a MWI state update via stasis with all parameters.
int(* on_mwi_state)(struct ast_mwi_state *mwi_state, void *data)
The delegate called for each managed mailbox state.
void ast_mwi_state_callback_all(on_mwi_state handler, void *data)
For each managed mailbox call the given handler.
void ast_mwi_state_callback_subscribed(on_mwi_state handler, void *data)
For each managed mailbox that has a subscriber call the given handler.
struct ast_mwi_publisher * ast_mwi_add_publisher(const char *mailbox)
Add an MWI state publisher to the mailbox.
int ast_mwi_add_observer(struct ast_mwi_observer *observer)
Add an observer to receive MWI state related events.
struct ast_mwi_state * ast_mwi_create(const char *mailbox, const char *context)
Create a ast_mwi_state object.
int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid)
Delete MWI state cached by stasis with all parameters.
int ast_mwi_publish(struct ast_mwi_publisher *publisher, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
void ast_mwi_remove_observer(struct ast_mwi_observer *observer)
Remove an MWI state observer.
struct stasis_topic * ast_mwi_topic_cached(void)
Get the Stasis Message Bus API caching topic for MWI messages.
void * ast_mwi_unsubscribe_and_join(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic, block until the final message is received, and then unsubscribe fr...
struct stasis_topic * ast_mwi_topic_all(void)
Get the Stasis Message Bus API topic for MWI messages.
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
int ast_mwi_publish_by_mailbox(const char *mailbox, const char *context, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
struct stasis_topic * ast_mwi_subscriber_topic(struct ast_mwi_subscriber *sub)
Retrieves the MWI subscriber's topic.
struct ast_mwi_state * ast_mwi_subscriber_data(struct ast_mwi_subscriber *sub)
Retrieves the state data object associated with the MWI subscriber.
struct stasis_forward * sub
struct ast_sorcery_instance_observer observer
void(* stasis_subscription_cb)(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Callback function type for Stasis subscriptions.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
Structure representing a snapshot of channel state.
An Entity ID is essentially a MAC address, brief and unique.
Abstract JSON element (object, array, string, int, ...).
Object that represents an MWI update with some additional application defined data.
struct ast_mwi_state * mwi_state
MWI state event interface.
void(* on_subscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being subscribed.
void(* on_unsubscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being unsubscribed.
The structure that contains MWI state.
struct ast_channel_snapshot * snapshot
const ast_string_field uniqueid
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)