[asterisk-commits] mmichelson: branch mmichelson/imap_consistency_trunk r134924 - /team/mmichels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 31 14:56:39 CDT 2008


Author: mmichelson
Date: Thu Jul 31 14:56:38 2008
New Revision: 134924

URL: http://svn.digium.com/view/asterisk?view=rev&rev=134924
Log:
Committing this just because it actually compiles. Implementationally,
it's not right yet, though. Message retrieval is mostly correct, but
I removed the "altfile" functionality at least temporarily from save_body.

I'll have to comb through the code for IMAP-specific places to be sure the
logic is correct everywhere and then test.


Modified:
    team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c

Modified: team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c?view=diff&rev=134924&r1=134923&r2=134924
==============================================================================
--- team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c Thu Jul 31 14:56:38 2008
@@ -149,8 +149,7 @@
 static void vmstate_delete(struct vm_state *vms);
 static void set_update(MAILSTREAM * stream);
 static void init_vm_state(struct vm_state *vms);
-static void copy_msgArray(struct vm_state *dst, struct vm_state *src);
-static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, char *altfile);
+static int save_body(BODY *body, struct vm_state *vms, char *section, char *format);
 static void get_mailbox_delimiter(MAILSTREAM *stream);
 static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
 static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int box, int target);
@@ -158,7 +157,7 @@
 static void update_messages_by_imapuser(const char *user, unsigned long number);
 
 static int imap_remove_file (char *dir, int msgnum);
-static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, const char *context);
+static int imap_retrieve_file (const char *dir, const int msgnum, const char *mailbox, const char *context);
 static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
 static void check_quota(struct vm_state *vms, char *mailbox);
 static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
@@ -445,7 +444,7 @@
 #ifdef ODBC_STORAGE
 static char odbc_database[80];
 static char odbc_table[80];
-#define RETRIEVE(a,b,c) retrieve_file(a,b)
+#define RETRIEVE(a,b,c,d) retrieve_file(a,b)
 #define DISPOSE(a,b) remove_file(a,b)
 #define STORE(a,b,c,d,e,f,g,h,i,j,k) store_file(a,b,c,d)
 #define EXISTS(a,b,c,d) (message_exists(a,b))
@@ -456,13 +455,13 @@
 #ifdef IMAP_STORAGE
 #define DISPOSE(a,b) (imap_remove_file(a,b))
 #define STORE(a,b,c,d,e,f,g,h,i,j,k) (imap_store_file(a,b,c,d,e,f,g,h,i,j,k))
-#define RETRIEVE(a,b,c) imap_retrieve_file(a,b,c)
+#define RETRIEVE(a,b,c,d) imap_retrieve_file(a,b,c,d)
 #define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
 #define DELETE(a,b,c,d) (vm_imap_delete(b,d))
 #else
-#define RETRIEVE(a,b,c)
+#define RETRIEVE(a,b,c,d)
 #define DISPOSE(a,b)
 #define STORE(a,b,c,d,e,f,g,h,i,j,k)
 #define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
@@ -1251,7 +1250,7 @@
  */
 static int make_file(char *dest, const int len, const char *dir, const int num)
 {
-	return snprintf(dest, len, "%s/%s%04d", dir, prefix, num);
+	return snprintf(dest, len, "%s/msg%04d", dir, num);
 }
 
 /* same as mkstemp, but return a FILE * */
@@ -1353,33 +1352,92 @@
 	mail_setflag (vms->mailstream,arg,"\\DELETED");
 }
 
-/* XXX BIG inconsistency between trunk and 1.4 be incredibly careful here */
-static int imap_retrieve_file(const char *dir, const int msgnum, const 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;
+	char *attachment;
+	int ret = 0, i;
+	BODY *body;
+
+	/* This function is only used for retrieval of IMAP greetings
+	 * regular messages are not retrieved this way, nor are greetings
+	 * if they are stored locally*/
+	if (msgnum > -1 || !imapgreetings) {
+		return 0;
+	} else {
+		file = strrchr(ast_strdupa(dir), '/');
+		if (file)
+			*file++ = '\0';
+		else {
+			ast_debug (1, "Failed to procure file name from directory passed.\n");
+			return -1;
+		}
+	}
+
+	/* 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(AST_LOG_ERROR, "Voicemail state not found!\n");
+		return -1;
+	}
+	
+	ret = init_mailstream(vms_p, GREETINGS_FOLDER);
+	if (!vms_p->mailstream) {
+		ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL\n");
+		return -1;
+	}
+
+	/*XXX Yuck, this could probably be done a lot better */
+	for (i = 0; i < vms_p->mailstream->nmsgs; i++) {
+		mail_fetchstructure(vms_p->mailstream, i + 1, &body);
+		/* We have the body, now we extract the file name of the first attachment. */
+		if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) {
+			attachment = ast_strdupa(body->nested.part->next->body.parameter->value);
+		} else {
+			ast_log(AST_LOG_ERROR, "There is no file attached to this IMAP message.\n");
+			return -1;
+		}
+		filename = strsep(&attachment, ".");
+		if (!strcmp(filename, file)) {
+			ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));
+			vms_p->msgArray[vms_p->curmsg] = i + 1;
+			save_body(body, vms_p, "2", attachment);
+			return 0;
+		}
+	}
+
+	return -1;
+}
+
+static int imap_retrieve_file(const char *dir, const int msgnum, const char *mailbox, const char *context)
 {
 	BODY *body;
 	char *header_content;
 	char *attachedfilefmt;
-	const char *cid_num;
-	const char *cid_name;
-	const char *duration;
-	const char *context;
-	const char *category;
-	const char *origtime;
+	char buf[80];
 	struct vm_state *vms;
 	char text_file[PATH_MAX];
 	FILE *text_file_ptr;
-
-	/* Greetings are not stored on the IMAP server, so we should not
-	 * attempt to retrieve them.
-	 */
+	int res = 0;
+	struct ast_vm_user *vmu;
+
+	vmu = find_user(NULL, mailbox, context); 
+	
 	if (msgnum < 0) {
-		return 0;
-	}
-	
+		if (imapgreetings) {
+			res = imap_retrieve_greeting(dir, msgnum, vmu);
+			goto exit;
+		} else {
+			res = 0;
+			goto exit;
+		}
+	}
+
+	vmu = find_user(NULL, mailbox, context); 
 	/* Before anything can happen, we need a vm_state so that we can
 	 * actually access the imap server through the vms->mailstream
 	 */
-	if(!(vms = get_vm_state_by_mailbox(vmu->mailbox, 1)) && !(vms = get_vm_state_by_mailbox(vmu->mailbox, 0))) {
+	if (!(vms = get_vm_state_by_mailbox(vmu->mailbox, 1)) && !(vms = get_vm_state_by_mailbox(vmu->mailbox, 0))) {
 		/* This should not happen. If it does, then I guess we'd
 		 * need to create the vm_state, extract which mailbox to
 		 * open, and then set up the msgArray so that the correct
@@ -1388,20 +1446,24 @@
 		 * and should have its msgArray properly set up.
 		 */
 		ast_log(LOG_ERROR, "Couldn't find a vm_state for mailbox %s!!! Oh no!\n", vmu->mailbox);
+		res = -1;
+		goto exit;
 	}
 	
 	make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
 
 	/* Don't try to retrieve a message from IMAP if it already is on the file system */
 	if (ast_fileexists(vms->fn, NULL, NULL) > 0) {
-		return 0;
+		res = 0;
+		goto exit;
 	}
 
 	if (option_debug > 2)
 		ast_log (LOG_DEBUG,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
 	if (vms->msgArray[msgnum] == 0) {
 		ast_log (LOG_WARNING,"Trying to access unknown message\n");
-		return -1;
+		res = -1;
+		goto exit;
 	}
 
 	/* This will only work for new messages... */
@@ -1409,7 +1471,8 @@
 	/* empty string means no valid header */
 	if (ast_strlen_zero(header_content)) {
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[msgnum]);
-		return -1;
+		res = -1;
+		goto exit;
 	}
 
 	mail_fetchstructure (vms->mailstream,vms->msgArray[msgnum],&body);
@@ -1419,7 +1482,8 @@
 		attachedfilefmt = ast_strdupa(body->nested.part->next->body.parameter->value);
 	} else {
 		ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n");
-		return -1;
+		res = -1;
+		goto exit;
 	}
 	
 	/* Find the format of the attached file */
@@ -1427,7 +1491,8 @@
 	strsep(&attachedfilefmt, ".");
 	if (!attachedfilefmt) {
 		ast_log(LOG_ERROR, "File format could not be obtained from IMAP message attachment\n");
-		return -1;
+		res = -1;
+		goto exit;
 	}
 	
 	save_body(body, vms, "2", attachedfilefmt);
@@ -1441,20 +1506,23 @@
 
 	fprintf(text_file_ptr, "%s\n", "[message]");
 
-	cid_num = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
-	cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:");
-	fprintf(text_file_ptr, "callerid=\"%s\" <%s>\n", S_OR(cid_name, ""), S_OR(cid_num, ""));
-	context = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
-	fprintf(text_file_ptr, "context=%s\n", S_OR(context, ""));
-	origtime = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
-	fprintf(text_file_ptr, "origtime=%s\n", S_OR(origtime, ""));
-	duration = get_header_by_tag(header_content, "X-Asterisk-VM-Duration:");
-	fprintf(text_file_ptr, "duration=%s\n", S_OR(origtime, ""));
-	category = get_header_by_tag(header_content, "X-Asterisk-VM-Category:");
-	fprintf(text_file_ptr, "category=%s\n", S_OR(category, ""));
-	
+	get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "callerid=\"%s\" ", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "<%s>\n", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "context=%s\n", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "origtime=%s\n", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Duration:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "duration=%s\n", S_OR(buf, ""));
+	get_header_by_tag(header_content, "X-Asterisk-VM-Category:", buf, sizeof(buf));
+	fprintf(text_file_ptr, "category=%s\n", S_OR(buf, ""));
 	fclose(text_file_ptr);
-	return 0;
+
+exit:
+	free_user(vmu);
+	return res;
 }
 
 static int folder_int(const char *folder)
@@ -1860,7 +1928,7 @@
  *
  * \return zero on success, -1 on error.
  */
-static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir)
+static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir, char *flag)
 {
 	struct vm_state *sendvms = NULL, *destvms = NULL;
 	char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/
@@ -2333,7 +2401,7 @@
 	}
 }
 
-static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu, char *mailbox)
+static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu)
 {
 	struct vm_state *vms_p;
 
@@ -2341,8 +2409,8 @@
 		ast_log(AST_LOG_DEBUG,"Adding new vmstate for %s\n",vmu->imapuser);
 	if (!(vms_p = ast_calloc(1, sizeof(*vms_p))))
 		return NULL;
-	ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
-	ast_copy_string(vms_p->username, mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
+	ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
+	ast_copy_string(vms_p->username, vmu->mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
 	vms_p->mailstream = NIL; /* save for access from interactive entry point */
 	if (option_debug > 4)
 		ast_log(AST_LOG_DEBUG,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
@@ -2426,12 +2494,6 @@
 			ast_debug(3, "Duplicate mailbox %s, copying message info...\n",vms->username);
 			vms->newmessages = altvms->newmessages;
 			vms->oldmessages = altvms->oldmessages;
-			ast_debug(3, "check_msgArray before memcpy\n");
-			check_msgArray(vms);
-			/* memcpy(vms->msgArray, altvms->msgArray, sizeof(long)*256); */
-			copy_msgArray(vms, altvms);
-			ast_debug(3, "check_msgArray after memcpy\n");
-			check_msgArray(vms);
 			vms->vmArrayIndex = altvms->vmArrayIndex;
 			vms->lastmsg = altvms->lastmsg;
 			vms->curmsg = altvms->curmsg;
@@ -2516,36 +2578,10 @@
 	ast_mutex_init(&vms->lock);
 }
 
-static void check_msgArray(struct vm_state *vms) 
-{
-	int x;
-	for (x = 0; x < VMSTATE_MAX_MSG_ARRAY; x++) {
-		if (vms->msgArray[x] != 0) {
-			ast_debug(1, "Item %d set to %ld\n", x, vms->msgArray[x]);
-		}
-	}
-}
-
-/*!
- * \brief Copies the msgArray property from one vm_state to another.
- * \param dst
- * \param src
- *
- * Goes over each element in the msgArray array property and copies the value from the source to the destination vm_state.
- */
-static void copy_msgArray(struct vm_state *dst, struct vm_state *src)
-{
-	int x;
-	for (x = 0; x < VMSTATE_MAX_MSG_ARRAY; x++) {
-		dst->msgArray[x] = src->msgArray[x];
-	}
-}
-
-static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, char *altfile) 
+static int save_body(BODY *body, struct vm_state *vms, char *section, char *format) 
 {
 	char *body_content;
 	char *body_decoded;
-	char *fn = S_OR(altfile, vms->fn);
 	unsigned long len;
 	unsigned long newlen;
 	char filename[256];
@@ -2555,7 +2591,7 @@
 
 	body_content = mail_fetchbody(vms->mailstream, vms->msgArray[vms->curmsg], section, &len);
 	if (body_content != NIL) {
-		snprintf(filename, sizeof(filename), "%s.%s", fn, format);
+		snprintf(filename, sizeof(filename), "%s.%s", vms->fn, format);
 		/* ast_debug(1,body_content); */
 		body_decoded = rfc822_base64((unsigned char *)body_content, len, &newlen);
  		/* If the body of the file is empty, return an error */
@@ -3458,7 +3494,7 @@
 
 #endif /* #ifndef IMAP_STORAGE */
 #endif /* #else of #ifdef ODBC_STORAGE */
-#ifndef ODBC_STORAGE
+#if (!defined(ODBC_STORAGE) && !defined(IMAP_STORAGE))
 /*! 
  * \brief Removes the voicemail sound and information file.
  * \param file The path to the sound file. This will be the the folder and message index, without the extension.
@@ -4651,7 +4687,7 @@
 		ast_log(AST_LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
 		return -1;
 	}
-	RETRIEVE(tempfile, -1, vmu);
+	RETRIEVE(tempfile, -1, vmu->mailbox, vmu->context);
 	if (ast_fileexists(tempfile, NULL, NULL) > 0)
 		ast_copy_string(prefile, tempfile, sizeof(prefile));
 
@@ -5868,7 +5904,7 @@
 			attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
 
 		if (attach_user_voicemail)
-			RETRIEVE(todir, msgnum, vmu);
+			RETRIEVE(todir, msgnum, vmu->mailbox, vmu->context);
 
 		/* XXX possible imap issue, should category be NULL XXX */
 		sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, NULL, fmt, duration, attach_user_voicemail, chan, category, flag);
@@ -6090,7 +6126,6 @@
 		struct vm_state vmstmp;
 #ifdef IMAP_STORAGE
 		char *myserveremail = serveremail;
-		char buf[1024] = "";
 		/* create tempfile for forwarding intro */
 		create_dirpath(tmpdir, sizeof(tmpdir), receiver->context, receiver->mailbox, "tmp");
 		snprintf(tmptxtfile, sizeof(tmptxtfile), "%s/msgintro%04d", tmpdir, curmsg);
@@ -6102,7 +6137,7 @@
 		create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
 		make_file(msgfile, sizeof(msgfile), vmstmp.curdir, curmsg);
 
- 		RETRIEVE(dir, curmsg, sender);
+ 		RETRIEVE(dir, curmsg, sender->mailbox, sender->context);
 
 		make_file(origmsgfile, sizeof(origmsgfile), dir, curmsg);
 		create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
@@ -6113,14 +6148,7 @@
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
 #ifdef IMAP_STORAGE
 				int attach_user_voicemail;
-				/* If there are two parts to the existing 
-				 * message, merge them together into one message before sending */
-				if (two_part == 0) {
-					snprintf(tmpcmd, sizeof(tmpcmd), "sox %s.%s %s.%s %smerge.%s ; mv -f %smerge.%s %s/msg%04d.%s", vms->fn, fmt, introtmp, fmt, vms->fn, fmt, vms->fn, fmt, tmpdir, curmsg, fmt);
-					ast_debug(5,"about to execute system command %s\n",tmpcmd);
-					ast_safe_system(tmpcmd);
-				} /* by now vms->fn should have merged audio */
-
+				
 				/* get destination mailbox */
 				dstvms = get_vm_state_by_mailbox(vmtmp->mailbox,0);
 				if (!dstvms) {
@@ -6471,7 +6499,7 @@
 	}
 
 	/* Retrieve info from VM attribute file */
-	RETRIEVE(vms->curdir, vms->curmsg, vmu);
+	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
 	msg_cfg = ast_config_load(filename, config_flags);
 	if (!msg_cfg) {
 		ast_log(AST_LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
@@ -6538,79 +6566,7 @@
 	return 0;
 }
 
-static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, const char *context)
-{
-	struct ast_vm_user *vmu;
-	struct vm_state *vms_p;
-	char *file, *filename;
-	char *attachment;
-	int ret = 0, i;
-	BODY *body;
-
-	/* This function is only used for retrieval of IMAP greetings
-	 * regular messages are not retrieved this way, nor are greetings
-	 * if they are stored locally*/
-	if (msgnum > -1 || !imapgreetings) {
-		return 0;
-	} else {
-		file = strrchr(ast_strdupa(dir), '/');
-		if (file)
-			*file++ = '\0';
-		else {
-			ast_debug (1, "Failed to procure file name from directory passed.\n");
-			return -1;
-		}
-	}
-	/* We have to get the user before we can open the stream! */
-	vmu = find_user(NULL, context, mailbox);
-	if (!vmu) {
-		ast_log(AST_LOG_ERROR, "Couldn't find mailbox %s in context %s\n", mailbox, context);
-		return -1;
-	} else {
-		/* No IMAP account available */
-		if (vmu->imapuser[0] == '\0') {
-			ast_log(AST_LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
-			free_user(vmu);
-			return -1;
-		}
-	}
-
-	/* check if someone is accessing this box right now... */
-	vms_p = get_vm_state_by_mailbox(mailbox,0);
-	if (!vms_p) {
-		ast_log(AST_LOG_ERROR, "Voicemail state not found!\n");
-		return -1;
-	}
-	
-	ret = init_mailstream(vms_p, GREETINGS_FOLDER);
-	if (!vms_p->mailstream) {
-		ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL\n");
-		free_user(vmu);
-		return -1;
-	}
-
-	for (i = 0; i < vms_p->mailstream->nmsgs; i++) {
-		mail_fetchstructure(vms_p->mailstream, i + 1, &body);
-		/* We have the body, now we extract the file name of the first attachment. */
-		if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) {
-			attachment = ast_strdupa(body->nested.part->next->body.parameter->value);
-		} else {
-			ast_log(AST_LOG_ERROR, "There is no file attached to this IMAP message.\n");
-			return -1;
-		}
-		filename = strsep(&attachment, ".");
-		if (!strcmp(filename, file)) {
-			ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));
-			vms_p->msgArray[vms_p->curmsg] = i + 1;
-			save_body(body, vms_p, "2", attachment, vms_p->fn);
-			free_user(vmu);
-			return 0;
-		}
-	}
-
-	free_user(vmu);
-	return -1;
-}
+
 
 static int imap_delete_old_greeting (char *dir, struct vm_state *vms)
 {
@@ -6690,6 +6646,7 @@
 
 	return 0;
 }
+#endif
 #endif
 
 static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
@@ -8168,7 +8125,7 @@
 	while ((cmd >= 0) && (cmd != 't')) {
 		if (cmd)
 			retries = 0;
-		RETRIEVE(prefile, -1, vmu);
+		RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
 		if (ast_fileexists(prefile, NULL, NULL) <= 0) {
 			play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms, NULL);
 			cmd = 't';	
@@ -10747,6 +10704,8 @@
 	const char *origtime, *context;
 	char *name, *num;
 	int retries = 0;
+	char *cid;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE, };
 
 	vms->starting = 0; 
 
@@ -10754,7 +10713,7 @@
 
 	/* Retrieve info from VM attribute file */
 	snprintf(filename,sizeof(filename), "%s.txt", vms->fn);
-	RETRIEVE(vms->curdir, vms->curmsg, vmu);
+	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
 	msg_cfg = ast_config_load(filename, config_flags);
 	DISPOSE(vms->curdir, vms->curmsg);
 	if (!msg_cfg) {




More information about the asterisk-commits mailing list