diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-12-19 16:52:43 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-12-19 16:52:43 +0000 |
commit | e4803bbd9eba2705615e2495de0ed0c35051dd45 (patch) | |
tree | fe8787ab22e2c694e93c4ec2757e3d8ca4c681dc /channels/chan_skinny.c | |
parent | 2882c5f9f1f1c81a5a2bae35825d81070bb10164 (diff) |
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/
........
Merged revisions 404348 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index e54108c3b..c78a04782 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1429,7 +1429,7 @@ struct skinny_subchannel { char call_forward_all[AST_MAX_EXTENSION]; \ char call_forward_busy[AST_MAX_EXTENSION]; \ char call_forward_noanswer[AST_MAX_EXTENSION]; \ - char mailbox[AST_MAX_EXTENSION]; \ + char mailbox[AST_MAX_MAILBOX_UNIQUEID]; \ char vmexten[AST_MAX_EXTENSION]; \ char regexten[AST_MAX_EXTENSION]; \ char regcontext[AST_MAX_CONTEXT]; \ @@ -8017,7 +8017,16 @@ static void config_parse_variables(int type, void *item, struct ast_variable *vp } else if (!strcasecmp(v->name, "hasvoicemail")) { if (type & (TYPE_LINE)) { if (ast_true(v->value) && ast_strlen_zero(CLINE->mailbox)) { - ast_copy_string(CLINE->mailbox, CLINE->name, sizeof(CLINE->mailbox)); + /* + * hasvoicemail is a users.conf legacy voicemail enable method. + * hasvoicemail is only going to work for app_voicemail mailboxes. + */ + if (strchr(CLINE->name, '@')) { + ast_copy_string(CLINE->mailbox, CLINE->name, sizeof(CLINE->mailbox)); + } else { + snprintf(CLINE->mailbox, sizeof(CLINE->mailbox), "%s@default", + CLINE->name); + } } continue; } @@ -8297,20 +8306,11 @@ static struct skinny_line *config_line(const char *lname, struct ast_variable *v config_parse_variables(TYPE_LINE, l, v); if (!ast_strlen_zero(l->mailbox)) { - char *cfg_mailbox, *cfg_context; - struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID); struct stasis_topic *mailbox_specific_topic; - cfg_context = cfg_mailbox = ast_strdupa(l->mailbox); - ast_verb(3, "Setting mailbox '%s' on line %s\n", cfg_mailbox, l->name); - strsep(&cfg_context, "@"); - if (ast_strlen_zero(cfg_context)) { - cfg_context = "default"; - } - - ast_str_set(&uniqueid, 0, "%s@%s", cfg_mailbox, cfg_context); + ast_verb(3, "Setting mailbox '%s' on line %s\n", l->mailbox, l->name); - mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid)); + mailbox_specific_topic = ast_mwi_topic(l->mailbox); if (mailbox_specific_topic) { l->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, l); } |