From e4803bbd9eba2705615e2495de0ed0c35051dd45 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 19 Dec 2013 16:52:43 +0000 Subject: 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 --- funcs/func_vmcount.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'funcs') diff --git a/funcs/func_vmcount.c b/funcs/func_vmcount.c index c4d80d499..6c98e72f6 100644 --- a/funcs/func_vmcount.c +++ b/funcs/func_vmcount.c @@ -49,27 +49,21 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") Count the voicemails in a specified mailbox. - - - - If not specified, defaults to default. - - + If not specified, defaults to INBOX Count the number of voicemails in a specified mailbox, you could also specify - the context and the mailbox folder. - Example: exten => s,1,Set(foo=${VMCOUNT(125)}) + the mailbox folder. + Example: exten => s,1,Set(foo=${VMCOUNT(125@default)}) ***/ static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len) { - char *context; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(vmbox); AST_APP_ARG(folder); @@ -82,18 +76,15 @@ static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *arg AST_STANDARD_APP_ARGS(args, argsstr); - if (strchr(args.vmbox, '@')) { - context = args.vmbox; - args.vmbox = strsep(&context, "@"); - } else { - context = "default"; + if (ast_strlen_zero(args.vmbox)) { + return -1; } if (ast_strlen_zero(args.folder)) { args.folder = "INBOX"; } - snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder)); + snprintf(buf, len, "%d", ast_app_messagecount(args.vmbox, args.folder)); return 0; } -- cgit v1.2.3