mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 19:16:46 +00:00
Voicemail: Remove mailbox identifier format (box@context) assumptions in the system.
This change is in preparation for external MWI support. Removed code from the system for normal mailbox handling that appends @default to the mailbox identifier if it does not have a context. The only exception is the legacy hasvoicemail users.conf option. The legacy option will only work for app_voicemail mailboxes. The system cannot make any assumptions about the format of the mailbox identifer used by app_voicemail. chan_sip and chan_dahdi/sig_pri had the most changes because they both tried to interpret the mailbox identifier. chan_sip just stored and compared the two components. chan_dahdi actually used the box information. The ISDN MWI support configuration options had to be reworked because chan_dahdi was parsing the box@context format to get the box number. As a result the mwi_vm_boxes chan_dahdi.conf option was added and is documented in the chan_dahdi.conf.sample file. Review: https://reviewboard.asterisk.org/r/3072/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
15
main/app.c
15
main/app.c
@@ -587,11 +587,11 @@ int ast_app_sayname(struct ast_channel *chan, const char *mailbox, const char *c
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_app_messagecount(const char *context, const char *mailbox, const char *folder)
|
||||
int ast_app_messagecount(const char *mailbox_id, const char *folder)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
VM_API_CALL(res, messagecount, (context, mailbox, folder));
|
||||
VM_API_CALL(res, messagecount, (mailbox_id, folder));
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -2800,10 +2800,8 @@ struct stasis_topic *ast_mwi_topic(const char *uniqueid)
|
||||
struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
|
||||
{
|
||||
RAII_VAR(struct ast_mwi_state *, mwi_state, NULL, ao2_cleanup);
|
||||
struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
|
||||
|
||||
ast_assert(!ast_strlen_zero(mailbox));
|
||||
ast_assert(!ast_strlen_zero(context));
|
||||
|
||||
mwi_state = ao2_alloc(sizeof(*mwi_state), mwi_state_dtor);
|
||||
if (!mwi_state) {
|
||||
@@ -2813,10 +2811,11 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
|
||||
if (ast_string_field_init(mwi_state, 256)) {
|
||||
return NULL;
|
||||
}
|
||||
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
|
||||
ast_string_field_set(mwi_state, uniqueid, ast_str_buffer(uniqueid));
|
||||
ast_string_field_set(mwi_state, mailbox, mailbox);
|
||||
ast_string_field_set(mwi_state, context, context);
|
||||
if (!ast_strlen_zero(context)) {
|
||||
ast_string_field_build(mwi_state, uniqueid, "%s@%s", mailbox, context);
|
||||
} else {
|
||||
ast_string_field_set(mwi_state, uniqueid, mailbox);
|
||||
}
|
||||
|
||||
ao2_ref(mwi_state, +1);
|
||||
return mwi_state;
|
||||
|
Reference in New Issue
Block a user