[svn-commits] mmichelson: trunk r180383 - in /trunk: ./ apps/ configs/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Mar 5 13:14:18 CST 2009
Author: mmichelson
Date: Thu Mar 5 13:14:14 2009
New Revision: 180383
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=180383
Log:
Merged revisions 180380 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r180380 | mmichelson | 2009-03-05 12:58:48 -0600 (Thu, 05 Mar 2009) | 25 lines
Fix broken mailbox parsing when searchcontexts option is enabled.
When using the searchcontexts option in voicemail.conf, the code
made the assumption that all mailbox names defined were unique across
all contexts. However, the code did nothing to actually enforce this
assumption, nor did it do anything to alert a user that he may have
created an ambiguity in his voicemail.conf file by defining the same
mailbox name in multiple contexts.
With this change, we now will issue a nice long warning if searchcontexts
is on and we encounter the same mailbox name in multiple contexts and ignore
any duplicates after the first box. Whether searchcontexts is enabled or not,
if we come across a duplicate mailbox in the same context, then we will issue
a warning and ignore the duplicated mailbox. I have also added a small note
to voicemail.conf.sample in the explanation for searchcontexts explaining
that you cannot define the same mailbox in multiple contexts if you have
enabled the option.
(closes issue #14599)
Reported by: lmadsen
Patches:
14599.patch uploaded by mmichelson (license 60) (with slight modification)
Tested by: lmadsen
........
Modified:
trunk/ (props changed)
trunk/apps/app_voicemail.c
trunk/configs/voicemail.conf.sample
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=180383&r1=180382&r2=180383
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Mar 5 13:14:14 2009
@@ -9584,14 +9584,21 @@
struct ast_vm_user *vmu;
AST_LIST_TRAVERSE(&users, vmu, list) {
- if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(box, vmu->mailbox))
- break;
- if (context && (!strcasecmp(context, vmu->context)) && (!strcasecmp(box, vmu->mailbox)))
- break;
- }
-
- if (vmu)
- return vmu;
+ if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(box, vmu->mailbox)) {
+ if (strcasecmp(vmu->context, context)) {
+ ast_log(LOG_WARNING, "\nIt has been detected that you have defined mailbox '%s' in separate\
+ \n\tcontexts and that you have the 'searchcontexts' option on. This type of\
+ \n\tconfiguration creates an ambiguity that you likely do not want. Please\
+ \n\tamend your voicemail.conf file to avoid this situation.\n", box);
+ }
+ ast_log(LOG_WARNING, "Ignoring duplicated mailbox %s\n", box);
+ return NULL;
+ }
+ if (!strcasecmp(context, vmu->context) && !strcasecmp(box, vmu->mailbox)) {
+ ast_log(LOG_WARNING, "Ignoring duplicated mailbox %s in context %s\n", box, context);
+ return NULL;
+ }
+ }
if (!(vmu = ast_calloc(1, sizeof(*vmu))))
return NULL;
Modified: trunk/configs/voicemail.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/trunk/configs/voicemail.conf.sample?view=diff&rev=180383&r1=180382&r2=180383
==============================================================================
--- trunk/configs/voicemail.conf.sample (original)
+++ trunk/configs/voicemail.conf.sample Thu Mar 5 13:14:14 2009
@@ -232,6 +232,9 @@
; searchcontexts=yes ; Current default behavior is to search only the default context
; if one is not specified. The older behavior was to search all contexts.
; This option restores the old behavior [DEFAULT=no]
+ ; Note: If you have this option enabled, then you will be required to have
+ ; unique mailbox names across all contexts. Otherwise, an ambiguity is created
+ ; since it is impossible to know which mailbox to retrieve when one is requested.
; callback=fromvm ; Context to call back from
; if not listed, calling the sender back will not be permitted
; exitcontext=fromvm ; Context to go to on user exit such as * or 0
More information about the svn-commits
mailing list