Asterisk - The Open Source Telephony Project
18.5.0
|
Core external MWI support. More...
Go to the source code of this file.
Macros | |
#define | ast_mwi_mailbox_unref(mailbox) ao2_ref((struct ast_mwi_mailbox_object *) mailbox, -1) |
Convienience unref function for mailbox object. More... | |
Functions | |
struct ast_mwi_mailbox_object * | ast_mwi_mailbox_alloc (const char *mailbox_id) |
Allocate an external MWI object. More... | |
struct ast_mwi_mailbox_object * | ast_mwi_mailbox_copy (const struct ast_mwi_mailbox_object *mailbox) |
Copy the external MWI counts object. More... | |
int | ast_mwi_mailbox_delete (const char *mailbox_id) |
Delete matching external MWI object. More... | |
int | ast_mwi_mailbox_delete_all (void) |
Delete all external MWI objects. More... | |
int | ast_mwi_mailbox_delete_by_regex (const char *regex) |
Delete all external MWI objects selected by the regular expression. More... | |
const struct ast_mwi_mailbox_object * | ast_mwi_mailbox_get (const char *mailbox_id) |
Get matching external MWI object. More... | |
struct ao2_container * | ast_mwi_mailbox_get_all (void) |
Get all external MWI objects. More... | |
struct ao2_container * | ast_mwi_mailbox_get_by_regex (const char *regex) |
Get all external MWI objects selected by the regular expression. More... | |
const char * | ast_mwi_mailbox_get_id (const struct ast_mwi_mailbox_object *mailbox) |
Get mailbox id. More... | |
unsigned int | ast_mwi_mailbox_get_msgs_new (const struct ast_mwi_mailbox_object *mailbox) |
Get the number of new messages. More... | |
unsigned int | ast_mwi_mailbox_get_msgs_old (const struct ast_mwi_mailbox_object *mailbox) |
Get the number of old messages. More... | |
void | ast_mwi_mailbox_set_msgs_new (struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs) |
Set the number of new messages. More... | |
void | ast_mwi_mailbox_set_msgs_old (struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs) |
Set the number of old messages. More... | |
int | ast_mwi_mailbox_update (struct ast_mwi_mailbox_object *mailbox) |
Update the external MWI counts with the given object. More... | |
#define ast_mwi_mailbox_unref | ( | mailbox | ) | ao2_ref((struct ast_mwi_mailbox_object *) mailbox, -1) |
Convienience unref function for mailbox object.
Definition at line 42 of file res_mwi_external.h.
Referenced by ast_mwi_mailbox_delete(), ast_mwi_mailbox_update(), mwi_has_voicemail(), mwi_inboxcount(), mwi_initial_events(), mwi_mailbox_delete_all(), mwi_mailbox_get(), mwi_mailbox_update(), mwi_messagecount(), stasis_app_mailbox_delete(), stasis_app_mailbox_to_json(), stasis_app_mailbox_update(), and stasis_app_mailboxes_to_json().
struct ast_mwi_mailbox_object* ast_mwi_mailbox_alloc | ( | const char * | mailbox_id | ) |
Allocate an external MWI object.
mailbox_id | Name of mailbox. |
object | on success. The object is an ao2 object. |
NULL | on error. |
Definition at line 196 of file res_mwi_external.c.
References ast_sorcery_alloc(), ast_strlen_zero, MWI_MAILBOX_TYPE, and NULL.
Referenced by mwi_mailbox_update(), and stasis_app_mailbox_update().
struct ast_mwi_mailbox_object* ast_mwi_mailbox_copy | ( | const struct ast_mwi_mailbox_object * | mailbox | ) |
Copy the external MWI counts object.
mailbox | What to copy. |
copy | on success. The object is an ao2 object. |
NULL | on error. |
Definition at line 205 of file res_mwi_external.c.
References ast_sorcery_copy().
int ast_mwi_mailbox_delete | ( | const char * | mailbox_id | ) |
Delete matching external MWI object.
mailbox_id | Name of mailbox to delete. |
0 | on success. |
-1 | on error. |
Definition at line 310 of file res_mwi_external.c.
References ast_mwi_mailbox_get(), ast_mwi_mailbox_unref, ast_strlen_zero, mailbox, and mwi_mailbox_delete().
Referenced by mwi_mailbox_delete(), and stasis_app_mailbox_delete().
int ast_mwi_mailbox_delete_all | ( | void | ) |
Delete all external MWI objects.
0 | on success. |
-1 | on error. |
Definition at line 286 of file res_mwi_external.c.
References ao2_ref, ast_mwi_mailbox_get_all(), mailboxes, and mwi_mailbox_delete_all().
int ast_mwi_mailbox_delete_by_regex | ( | const char * | regex | ) |
Delete all external MWI objects selected by the regular expression.
regex | Regular expression in extended syntax. (NULL is same as "") |
0 | on success. |
-1 | on error. |
Definition at line 298 of file res_mwi_external.c.
References ao2_ref, ast_mwi_mailbox_get_by_regex(), mailboxes, and mwi_mailbox_delete_all().
Referenced by mwi_mailbox_delete().
const struct ast_mwi_mailbox_object* ast_mwi_mailbox_get | ( | const char * | mailbox_id | ) |
Get matching external MWI object.
mailbox_id | Name of mailbox to retrieve. |
requested | mailbox on success. The object is an ao2 object. |
NULL | on error or no mailbox. |
Definition at line 187 of file res_mwi_external.c.
References ast_sorcery_retrieve_by_id(), ast_strlen_zero, MWI_MAILBOX_TYPE, and NULL.
Referenced by ast_mwi_mailbox_delete(), mwi_has_voicemail(), mwi_inboxcount(), mwi_mailbox_get(), mwi_messagecount(), stasis_app_mailbox_delete(), and stasis_app_mailbox_to_json().
struct ao2_container* ast_mwi_mailbox_get_all | ( | void | ) |
Get all external MWI objects.
container | of struct ast_mwi_mailbox_object on success. |
NULL | on error. |
Definition at line 176 of file res_mwi_external.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), MWI_MAILBOX_TYPE, and NULL.
Referenced by ast_mwi_mailbox_delete_all(), mwi_initial_events(), and stasis_app_mailboxes_to_json().
struct ao2_container* ast_mwi_mailbox_get_by_regex | ( | const char * | regex | ) |
Get all external MWI objects selected by the regular expression.
regex | Regular expression in extended syntax. (NULL is same as "") |
container | of struct ast_mwi_mailbox_object on success. |
NULL | on error. |
Definition at line 182 of file res_mwi_external.c.
References ast_sorcery_retrieve_by_regex(), and MWI_MAILBOX_TYPE.
Referenced by ast_mwi_mailbox_delete_by_regex(), and mwi_mailbox_get().
const char* ast_mwi_mailbox_get_id | ( | const struct ast_mwi_mailbox_object * | mailbox | ) |
Get mailbox id.
mailbox | Object to get id. |
Definition at line 210 of file res_mwi_external.c.
References ast_sorcery_object_get_id().
Referenced by mailbox_to_json(), and mwi_mailbox_get().
unsigned int ast_mwi_mailbox_get_msgs_new | ( | const struct ast_mwi_mailbox_object * | mailbox | ) |
Get the number of new messages.
mailbox | Object to get number of new messages. |
Definition at line 215 of file res_mwi_external.c.
References ast_mwi_mailbox_object::msgs_new.
Referenced by mailbox_to_json(), and mwi_mailbox_get().
unsigned int ast_mwi_mailbox_get_msgs_old | ( | const struct ast_mwi_mailbox_object * | mailbox | ) |
Get the number of old messages.
mailbox | Object to get number of old messages. |
Definition at line 220 of file res_mwi_external.c.
References ast_mwi_mailbox_object::msgs_old.
Referenced by mailbox_to_json(), and mwi_mailbox_get().
void ast_mwi_mailbox_set_msgs_new | ( | struct ast_mwi_mailbox_object * | mailbox, |
unsigned int | num_msgs | ||
) |
Set the number of new messages.
mailbox | Object to set number of new messages. |
num_msgs | Number of messages to set. |
Definition at line 225 of file res_mwi_external.c.
References ast_mwi_mailbox_object::msgs_new.
Referenced by mwi_mailbox_update(), and stasis_app_mailbox_update().
void ast_mwi_mailbox_set_msgs_old | ( | struct ast_mwi_mailbox_object * | mailbox, |
unsigned int | num_msgs | ||
) |
Set the number of old messages.
mailbox | Object to set number of old messages. |
num_msgs | Number of messages to set. |
Definition at line 230 of file res_mwi_external.c.
References ast_mwi_mailbox_object::msgs_old.
Referenced by mwi_mailbox_update(), and stasis_app_mailbox_update().
int ast_mwi_mailbox_update | ( | struct ast_mwi_mailbox_object * | mailbox | ) |
Update the external MWI counts with the given object.
mailbox | What to update. |
0 | on success. |
-1 | on error. |
Definition at line 235 of file res_mwi_external.c.
References ast_mwi_mailbox_unref, ast_sorcery_create(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), ast_sorcery_update(), exists(), and MWI_MAILBOX_TYPE.
Referenced by mwi_mailbox_update(), and stasis_app_mailbox_update().