[asterisk-commits] mmichelson: branch jrothenberger/asterisk-urgent r106498 - /team/jrothenberge...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 6 17:47:25 CST 2008


Author: mmichelson
Date: Thu Mar  6 17:47:25 2008
New Revision: 106498

URL: http://svn.digium.com/view/asterisk?view=rev&rev=106498
Log:
There were flaws when attempting to forward urgent messages. This is because the messages were
not being saved in the recipient's URGENT folder, but in their INBOX. This fix complements the
fix made in svn revision 106434. The logic regarding forwarding messages is now proper.


Modified:
    team/jrothenberger/asterisk-urgent/apps/app_voicemail.c

Modified: team/jrothenberger/asterisk-urgent/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/apps/app_voicemail.c?view=diff&rev=106498&r1=106497&r2=106498
==============================================================================
--- team/jrothenberger/asterisk-urgent/apps/app_voicemail.c (original)
+++ team/jrothenberger/asterisk-urgent/apps/app_voicemail.c Thu Mar  6 17:47:25 2008
@@ -4351,7 +4351,7 @@
 	return 0;
 }
 
-static int forward_message(struct ast_channel *chan, char *context, struct vm_state *vms, struct ast_vm_user *sender, char *fmt, int flag, signed char record_gain)
+static int forward_message(struct ast_channel *chan, char *context, struct vm_state *vms, struct ast_vm_user *sender, char *fmt, int flag, signed char record_gain, int urgent)
 {
 #ifdef IMAP_STORAGE
 	BODY *body;
@@ -4373,6 +4373,12 @@
 	int valid_extensions = 0;
 	char *dir;
 	int curmsg;
+	char urgent_str[80];
+
+	if (urgent)
+		snprintf(urgent_str, sizeof(urgent_str) - 1, "%s", "URGENT");
+	else
+		*urgent_str = 0;
 
 	if (vms == NULL) return -1;
 	dir = vms->curdir;
@@ -4586,8 +4592,8 @@
 					if (!dstvms->mailstream) {
 						ast_log (LOG_ERROR,"IMAP mailstream for %s is NULL\n",vmtmp->mailbox);
 					} else {
-						STORE(todir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms, "");
-						run_externnotify(vmtmp->context, vmtmp->mailbox, ""); 
+						STORE(todir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms, urgent_str);
+						run_externnotify(vmtmp->context, vmtmp->mailbox, urgent_str); 
 					}
 				} else {
 					ast_log (LOG_ERROR,"Could not find state information for mailbox %s\n",vmtmp->mailbox);
@@ -4597,10 +4603,10 @@
 					myserveremail = vmtmp->serveremail;
 				attach_user_voicemail = ast_test_flag(vmtmp, VM_ATTACH);
 				/* NULL category for IMAP storage */
-				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), vms->fn, fmt, duration, attach_user_voicemail, chan, NULL, "");
+				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), vms->fn, fmt, duration, attach_user_voicemail, chan, NULL, urgent_str);
 
 #else
-				copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt, dir, "");
+				copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt, dir, urgent_str);
 #endif
 				saved_messages++;
 				AST_LIST_REMOVE_CURRENT(list);
@@ -7402,7 +7408,7 @@
 
 				case '5': /* Leave VoiceMail */
 					if (ast_test_flag(vmu, VM_SVMAIL)) {
-						cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain);
+						cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain, 0);
 						if (cmd == ERROR_LOCK_PATH) {
 							res = cmd;
 							ast_log(LOG_WARNING, "forward_message failed to lock path.\n");
@@ -7556,7 +7562,7 @@
 	
 		case '8': /* forward */
 			if (vms.lastmsg > -1) {
-				cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain);
+				cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
 				if (cmd == ERROR_LOCK_PATH) {
 					res = cmd;
 					goto out;




More information about the asterisk-commits mailing list