[asterisk-commits] jpeeler: branch 1.6.0 r213411 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 20 16:37:33 CDT 2009


Author: jpeeler
Date: Thu Aug 20 16:37:28 2009
New Revision: 213411

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213411
Log:
Merged revisions 213404 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r213404 | jpeeler | 2009-08-20 16:33:11 -0500 (Thu, 20 Aug 2009) | 12 lines
  
  Fix greeting retrieval from IMAP
  
  Properly check for the current voicemail state and if it doesn't exist,
  create it.
  
  (closes issue #14597)
  Reported by: wtca
  Patches:
        14597_v2.patch uploaded by mmichelson (license 60)
  Tested by: jpeeler
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=213411&r1=213410&r2=213411
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Thu Aug 20 16:37:28 2009
@@ -1163,7 +1163,7 @@
 	ast_mutex_unlock(&vms->lock);
 }
 
-static int imap_retrieve_greeting (const char *dir, const int msgnum, struct ast_vm_user *vmu)
+static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_vm_user *vmu)
 {
 	struct vm_state *vms_p;
 	char *file, *filename;
@@ -1187,9 +1187,16 @@
 	}
 
 	/* check if someone is accessing this box right now... */
-	if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 1)) ||!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 0))) {
-		ast_log(LOG_ERROR, "Voicemail state not found!\n");
-		return -1;
+	if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 1)) && 
+		!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, 0))) {
+		/* Unlike when retrieving a message, it is reasonable not to be able to find a 
+		* vm_state for a mailbox when trying to retrieve a greeting. Just create one,
+		* that's all we need to do.
+		*/
+		if (!(vms_p = create_vm_state_from_user(vmu))) {
+			ast_log(LOG_NOTICE, "Unable to create vm_state object!\n");
+			return -1;
+		}
 	}
 	
 	ast_mutex_lock(&vms_p->lock);
@@ -1725,7 +1732,11 @@
 		ast_build_string(&t, &left, "/%s", imapflags);
 
 	/* End with username */
+#if 1
 	ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
+#else
+	ast_build_string(&t, &left, "/user=%s/novalidate-cert}", vms->imapuser);
+#endif
 	if (box == NEW_FOLDER || box == OLD_FOLDER)
 		snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
 	else if (box == GREETINGS_FOLDER)




More information about the asterisk-commits mailing list