35 #define MAILBOX_BUCKETS 37
37 static struct ast_json *mailbox_to_json(
47 const char *name,
struct ast_json **json)
57 mailbox_json = mailbox_to_json(mailbox);
87 struct ast_json *appending = mailbox_to_json(mailbox);
102 const char *name,
int old_messages,
int new_messages)
144 static int load_module(
void)
149 static int unload_module(
void)
154 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
"Stasis application mailbox support",
155 .support_level = AST_MODULE_SUPPORT_CORE,
157 .unload = unload_module,
158 .requires =
"res_stasis,res_mwi_external"
enum stasis_mailbox_result stasis_app_mailbox_to_json(const char *name, struct ast_json **json)
Convert mailbox to JSON.
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_mwi_mailbox_get_id(const struct ast_mwi_mailbox_object *mailbox)
Get mailbox id.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ao2_container * ast_mwi_mailbox_get_all(void)
Get all external MWI objects.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_mwi_mailbox_object * ast_mwi_mailbox_alloc(const char *mailbox_id)
Allocate an external MWI object.
static struct stasis_rest_handlers mailboxes
REST handler for /api-docs/mailboxes.json.
void ast_mwi_mailbox_set_msgs_new(struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs)
Set the number of new messages.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
Core external MWI support.
int ast_mwi_mailbox_update(struct ast_mwi_mailbox_object *mailbox)
Update the external MWI counts with the given object.
enum stasis_mailbox_result stasis_app_mailbox_delete(const char *name)
Delete a mailbox controlled by ARI.
const struct ast_mwi_mailbox_object * ast_mwi_mailbox_get(const char *mailbox_id)
Get matching external MWI object.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
struct ast_json * stasis_app_mailboxes_to_json(void)
Convert mailboxes to json array.
Backend API for implementing components of res_stasis.
int ast_mwi_mailbox_delete(const char *mailbox_id)
Delete matching external MWI object.
unsigned int ast_mwi_mailbox_get_msgs_new(const struct ast_mwi_mailbox_object *mailbox)
Get the number of new messages.
#define ast_mwi_mailbox_unref(mailbox)
Convenience unref function for mailbox object.
void ast_mwi_mailbox_set_msgs_old(struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs)
Set the number of old messages.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Abstract JSON element (object, array, string, int, ...).
Stasis Application Mailbox API. See StasisApplication API" for detailed documentation.
unsigned int ast_mwi_mailbox_get_msgs_old(const struct ast_mwi_mailbox_object *mailbox)
Get the number of old messages.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Persistent data storage (akin to *doze registry)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
int stasis_app_mailbox_update(const char *name, int old_messages, int new_messages)
Changes the state of a mailbox.