19 #ifndef _ASTERISK_MWI_H 20 #define _ASTERISK_MWI_H 94 #if defined(__cplusplus) || defined(c_plusplus) 380 #define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \ 381 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL, NULL) 397 #define ast_publish_mwi_state_channel(mailbox, context, new_msgs, old_msgs, channel_id) \ 398 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, channel_id, NULL) 420 const char *channel_id,
433 #define ast_delete_mwi_state(mailbox, context) \ 434 ast_delete_mwi_state_full(mailbox, context, NULL) 574 #define AST_MAX_MAILBOX_UNIQUEID (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2) 576 #if defined(__cplusplus) || defined(c_plusplus) void(* on_unsubscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being unsubscribed.
struct ast_mwi_state * mwi_state
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.
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
struct ast_mwi_state * ast_mwi_create(const char *mailbox, const char *context)
Create a ast_mwi_state object.
int mwi_init(void)
Initialize the mwi core.
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.
void(* on_subscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being subscribed.
struct stasis_subscription * ast_mwi_subscriber_subscription(struct ast_mwi_subscriber *sub)
Retrieve the stasis MWI topic subscription if available.
Structure representing a snapshot of channel state.
struct stasis_topic * ast_mwi_subscriber_topic(struct ast_mwi_subscriber *sub)
Retrieves the MWI subscriber's topic.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
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 stasis_topic * ast_mwi_topic_all(void)
Get the Stasis Message Bus API topic for MWI messages.
struct ast_mwi_state * ast_mwi_subscriber_data(struct ast_mwi_subscriber *sub)
Retrieves the state data object associated with the MWI subscriber.
int ast_mwi_add_observer(struct ast_mwi_observer *observer)
Add an observer to receive MWI state related events.
An Entity ID is essentially a MAC address, brief and unique.
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
#define AST_STRING_FIELD(name)
Declare a string field.
int(* on_mwi_state)(struct ast_mwi_state *mwi_state, void *data)
The delegate called for each managed mailbox state.
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 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.
struct ast_mwi_subscriber * ast_mwi_add_subscriber(const char *mailbox)
Add an MWI state subscriber to the mailbox.
void ast_mwi_remove_observer(struct ast_mwi_observer *observer)
Remove an MWI state observer.
void(* stasis_subscription_cb)(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Callback function type for Stasis subscriptions.
void ast_mwi_state_callback_all(on_mwi_state handler, void *data)
For each managed mailbox call the given handler.
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 ast_channel_snapshot * snapshot
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
Object that represents an MWI update with some additional application defined data.
struct ast_mwi_publisher * ast_mwi_add_publisher(const char *mailbox)
Add an MWI state publisher to the mailbox.
struct stasis_topic * ast_mwi_topic_cached(void)
Get the Stasis Message Bus API caching topic for MWI messages.
MWI state event interface.
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)
struct ast_sorcery_instance_observer observer
struct stasis_forward * sub
Abstract JSON element (object, array, string, int, ...).
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.
static char context[AST_MAX_CONTEXT]
The structure that contains MWI state.
struct stasis_topic * ast_mwi_topic(const char *uniqueid)
Get the Stasis Message Bus API topic for MWI messages on a unique ID.
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.
struct stasis_message_type * ast_mwi_vm_app_type(void)
Get the Stasis Message Bus API message type for voicemail application specific messages.