[asterisk-commits] jpeeler: branch 1.4 r173696 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 5 14:47:51 CST 2009


Author: jpeeler
Date: Thu Feb  5 14:47:51 2009
New Revision: 173696

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=173696
Log:
Add new configuration option to make shared IMAP mailboxes function as expected.

The new option is "imapvmshareid" which is an ID to tag multiple mailboxes
using the same IMAP storage location to function as one mailbox. This allows
all messages to be retrieved for any user in the group. The patch alters the
'X-Asterisk-VM-Extension' header that is responsible for matching voicemails
for a given user.

(closes issue #13673)
Reported by: howardwilkinson


Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=173696&r1=173695&r2=173696
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Thu Feb  5 14:47:51 2009
@@ -350,6 +350,7 @@
 #ifdef IMAP_STORAGE
 	char imapuser[80];	/* IMAP server login */
 	char imappassword[80];	/* IMAP server password if authpassword not defined */
+	char imapvmshareid[80]; /* Shared mailbox ID to use rather than the dialed one */
 #endif
 	double volgain;		/*!< Volume gain for voicemails sent via email */
 	AST_LIST_ENTRY(ast_vm_user) list;
@@ -627,6 +628,8 @@
 		ast_copy_string(vmu->imapuser, value, sizeof(vmu->imapuser));
 	} else if (!strcasecmp(var, "imappassword") || !strcasecmp(var, "imapsecret")) {
 		ast_copy_string(vmu->imappassword, value, sizeof(vmu->imappassword));
+	} else if (!strcasecmp(var, "imapvmshareid")) {
+		ast_copy_string(vmu->imapvmshareid, value, sizeof(vmu->imapvmshareid));
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_DELETE);	
@@ -731,6 +734,8 @@
 			ast_copy_string(retval->imapuser, tmp->value, sizeof(retval->imapuser));
 		} else if (!strcasecmp(tmp->name, "imappassword") || !strcasecmp(tmp->name, "imapsecret")) {
 			ast_copy_string(retval->imappassword, tmp->value, sizeof(retval->imappassword));
+		} else if (!strcasecmp(tmp->name, "imapvmshareid")) {
+			ast_copy_string(retval->imapvmshareid, tmp->value, sizeof(retval->imapvmshareid));
 #endif
 		} else
 			apply_option(retval, tmp->name, tmp->value);
@@ -1219,7 +1224,7 @@
 	if (ret == 0) {
 		ast_mutex_lock(&vms_p->lock);
 		pgm = mail_newsearchpgm ();
-		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailbox);
+		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)(!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : mailbox));
 		pgm->header = hdr;
 		if (fold != 1) {
 			pgm->unseen = 1;
@@ -1563,7 +1568,7 @@
 	pgm = mail_newsearchpgm();
 
 	/* Check IMAP folder for Asterisk messages only... */
-	hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", vmu->mailbox);
+	hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : vmu->mailbox));
 	pgm->header = hdr;
 	pgm->deleted = 0;
 	pgm->undeleted = 1;
@@ -3214,7 +3219,11 @@
 		/* fprintf(p, "X-Asterisk-VM-Orig-Mailbox: %s" ENDL, ext); */
 		fprintf(p, "X-Asterisk-VM-Server-Name: %s" ENDL, fromstring);
 		fprintf(p, "X-Asterisk-VM-Context: %s" ENDL, context);
+#ifdef IMAP_STORAGE
+		fprintf(p, "X-Asterisk-VM-Extension: %s" ENDL, (!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : mailbox));
+#else
 		fprintf(p, "X-Asterisk-VM-Extension: %s" ENDL, mailbox);
+#endif
 		fprintf(p, "X-Asterisk-VM-Priority: %d" ENDL, chan->priority);
 		fprintf(p, "X-Asterisk-VM-Caller-channel: %s" ENDL, chan->name);
 		fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s" ENDL, enc_cidnum);




More information about the asterisk-commits mailing list