[asterisk-commits] branch 1.2 - r7273 in /branches/1.2: ./ apps/ configs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 1 18:42:41 CST 2005


Author: kpfleming
Date: Thu Dec  1 18:42:40 2005
New Revision: 7273

URL: http://svn.digium.com/view/asterisk?rev=7273&view=rev
Log:
allow previous context-searching behavior to be used if desired (issue #5899)

Modified:
    branches/1.2/UPGRADE.txt
    branches/1.2/apps/app_voicemail.c
    branches/1.2/configs/voicemail.conf.sample

Modified: branches/1.2/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/branches/1.2/UPGRADE.txt?rev=7273&r1=7272&r2=7273&view=diff
==============================================================================
--- branches/1.2/UPGRADE.txt (original)
+++ branches/1.2/UPGRADE.txt Thu Dec  1 18:42:40 2005
@@ -133,7 +133,8 @@
 
 * The application VoiceMailMain now only matches the 'default' context if
   none is specified in the arguments.  (This was the previously 
-  documented behavior, however, we didn't follow that behavior.)
+  documented behavior, however, we didn't follow that behavior.)  The old
+  behavior can be restored by setting searchcontexts=yes in voicemail.conf.
 
 Queues:
 

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?rev=7273&r1=7272&r2=7273&view=diff
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Thu Dec  1 18:42:40 2005
@@ -110,6 +110,7 @@
 #define VM_ATTACH		(1 << 11)
 #define VM_DELETE		(1 << 12)
 #define VM_ALLOCED		(1 << 13)
+#define VM_SEARCH		(1 << 14)
 
 #define ERROR_LOCK_PATH		-100
 
@@ -534,12 +535,11 @@
 			ast_set_flag(retval, VM_ALLOCED);	
 		if (mailbox) 
 			ast_copy_string(retval->mailbox, mailbox, sizeof(retval->mailbox));
-		if (context) 
-			ast_copy_string(retval->context, context, sizeof(retval->context));
+		populate_defaults(retval);
+		if (ast_test_flag((&globalflags), VM_SEARCH))
+			var = ast_load_realtime("voicemail", "mailbox", mailbox, NULL);
 		else
-			strcpy(retval->context, "default");
-		populate_defaults(retval);
-		var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", retval->context, NULL);
+			var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", retval->context, NULL);
 		if (var) {
 			tmp = var;
 			while(tmp) {
@@ -554,6 +554,8 @@
 					ast_copy_string(retval->email, tmp->value, sizeof(retval->email));
 				} else if (!strcasecmp(tmp->name, "fullname")) {
 					ast_copy_string(retval->fullname, tmp->value, sizeof(retval->fullname));
+				} else if (!strcasecmp(tmp->name, "context")) {
+					ast_copy_string(retval->context, tmp->value, sizeof(retval->context));
 				} else
 					apply_option(retval, tmp->name, tmp->value);
 				tmp = tmp->next;
@@ -574,13 +576,14 @@
 	ast_mutex_lock(&vmlock);
 	cur = users;
 
-	if (!context)
+	if (!context && !ast_test_flag((&globalflags), VM_SEARCH))
 		context = "default";
 
 	while (cur) {
-		if ((!strcasecmp(context, cur->context)) &&
-			(!strcasecmp(mailbox, cur->mailbox)))
-				break;
+		if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(mailbox, cur->mailbox))
+			break;
+		if ((!strcasecmp(context, cur->context)) && (!strcasecmp(mailbox, cur->mailbox)))
+			break;
 		cur=cur->next;
 	}
 	if (cur) {
@@ -5810,6 +5813,7 @@
 	struct ast_variable *var;
 	char *notifystr = NULL;
 	char *astattach;
+	char *astsearch;
 	char *astsaycid;
 	char *send_voicemail;
 	char *astcallop;
@@ -5862,6 +5866,10 @@
 		if (!(astattach = ast_variable_retrieve(cfg, "general", "attach"))) 
 			astattach = "yes";
 		ast_set2_flag((&globalflags), ast_true(astattach), VM_ATTACH);	
+
+		if (!(astsearch = ast_variable_retrieve(cfg, "general", "searchcontexts")))
+			astsearch = "no";
+		ast_set2_flag((&globalflags), ast_true(astsearch), VM_SEARCH);
 
 #ifdef USE_ODBC_STORAGE
 		strcpy(odbc_database, "asterisk");

Modified: branches/1.2/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.2/configs/voicemail.conf.sample?rev=7273&r1=7272&r2=7273&view=diff
==============================================================================
--- branches/1.2/configs/voicemail.conf.sample (original)
+++ branches/1.2/configs/voicemail.conf.sample Thu Dec  1 18:42:40 2005
@@ -160,6 +160,9 @@
 sendvoicemail=yes	; Context to Send voicemail from [option 5 from the advanced menu]
   			; if not listed, sending messages from inside voicemail will not be 
 			; permitted
+; 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]
 ; callback=fromvm 	; Context to call back from  
 			;     if not listed, calling the sender back will not be permitted
 ; review=yes 		; Allow sender to review/rerecord their message before saving it [OFF by default



More information about the asterisk-commits mailing list