aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-05 21:04:57 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-05 21:04:57 +0000
commit8f3a875db178ffcbff3db7c1a316354394aaad05 (patch)
tree02191bccaf7279cc05d505c5678ed34c7df7a439
parent7b4d5cb8355e5926d6b284ec58f3ac3fbe416e28 (diff)
Merged revisions 173697 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r173697 | jpeeler | 2009-02-05 15:00:26 -0600 (Thu, 05 Feb 2009) | 18 lines Merged revisions 173696 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r173696 | jpeeler | 2009-02-05 14:47:51 -0600 (Thu, 05 Feb 2009) | 12 lines 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 ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@173698 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index f0f97b6d7..c49d3c6fa 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -384,6 +384,7 @@ struct ast_vm_user {
#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;
@@ -723,6 +724,8 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
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);
@@ -853,6 +856,8 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
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);
@@ -1522,7 +1527,7 @@ static int messagecount(const char *context, const char *mailbox, const char *fo
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;
@@ -1819,7 +1824,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
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;
@@ -3531,7 +3536,11 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
/* 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);