[asterisk-commits] mmichelson: branch mmichelson/trunk-vm-imap r70532 - in /team/mmichelson/trun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 20 16:52:31 CDT 2007


Author: mmichelson
Date: Wed Jun 20 16:52:31 2007
New Revision: 70532

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70532
Log:
Changed the automerge property on the branch so trunk will get automerged


Modified:
    team/mmichelson/trunk-vm-imap/   (props changed)
    team/mmichelson/trunk-vm-imap/apps/app_voicemail.c
    team/mmichelson/trunk-vm-imap/channels/chan_sip.c

Propchange: team/mmichelson/trunk-vm-imap/
------------------------------------------------------------------------------
    automerge = *

Modified: team/mmichelson/trunk-vm-imap/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/trunk-vm-imap/apps/app_voicemail.c?view=diff&rev=70532&r1=70531&r2=70532
==============================================================================
--- team/mmichelson/trunk-vm-imap/apps/app_voicemail.c (original)
+++ team/mmichelson/trunk-vm-imap/apps/app_voicemail.c Wed Jun 20 16:52:31 2007
@@ -116,10 +116,12 @@
 static char imapport[8];
 static char imapflags[128];
 static char imapfolder[64];
+static char greetingfolder[64];
 static char authuser[32];
 static char authpassword[42];
 
 static int expungeonhangup = 1;
+static int imapgreetings = 0;
 AST_MUTEX_DEFINE_STATIC(delimiter_lock);
 static char delimiter = '\0';
 
@@ -150,6 +152,9 @@
 
 
 
+static int imap_remove_file (char *dir, int msgnum);
+static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *context);
+static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
 struct vmstate {
 	struct vm_state *vms;
 	AST_LIST_ENTRY(vmstate) list;
@@ -157,6 +162,7 @@
 
 static AST_LIST_HEAD_STATIC(vmstates, vmstate);
 
+#define GREETING_FOLDER		2
 #endif
 
 #define SMDI_MWI_WAIT_TIMEOUT 1000 /* 1 second */
@@ -394,7 +400,7 @@
 #ifdef ODBC_STORAGE
 static char odbc_database[80];
 static char odbc_table[80];
-#define RETRIEVE(a,b) 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) store_file(a,b,c,d)
 #define EXISTS(a,b,c,d) (message_exists(a,b))
@@ -403,8 +409,8 @@
 #define DELETE(a,b,c) (delete_file(a,b))
 #else
 #ifdef IMAP_STORAGE
-#define RETRIEVE(a,b)
-#define DISPOSE(a,b)
+#define RETRIEVE(a,b,c,d) (imap_retrieve_file(a,b,c,d ))
+#define DISPOSE(a,b) (imap_remove_file(a,b))
 #define STORE(a,b,c,d,e,f,g,h,i) (imap_store_file(a,b,c,d,e,f,g,h,i))
 #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));
@@ -412,7 +418,7 @@
 #define IMAP_DELETE(a,b,c,d) (vm_imap_delete(b,d))
 #define DELETE(a,b,c) (vm_delete(c))
 #else
-#define RETRIEVE(a,b)
+#define RETRIEVE(a,b,c,d)
 #define DISPOSE(a,b)
 #define STORE(a,b,c,d,e,f,g,h,i)
 #define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
@@ -1975,6 +1981,8 @@
 	struct tm tm;
 	char *passdata2;
 	size_t len_passdata;
+	char *greeting_attachment;
+
 #ifdef IMAP_STORAGE
 #define ENDL "\r\n"
 #else
@@ -1986,6 +1994,11 @@
 		ast_copy_string(who, srcemail, sizeof(who));
 	else 
 		snprintf(who, sizeof(who), "%s@%s", srcemail, host);
+	
+	greeting_attachment = strrchr(ast_strdupa(attach), '/');
+	if (greeting_attachment)
+		*greeting_attachment++ = '\0';
+
 	snprintf(dur, sizeof(dur), "%d:%02d", duration / 60, duration % 60);
 	strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", vmu_tm(vmu, &tm));
 	fprintf(p, "Date: %s" ENDL, date);
@@ -2050,8 +2063,9 @@
 		fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s" ENDL, cidnum);
 		fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s" ENDL, cidname);
 		fprintf(p, "X-Asterisk-VM-Duration: %d" ENDL, duration);
-		if (!ast_strlen_zero(category))
+		if (!ast_strlen_zero(category)) 
 			fprintf(p, "X-Asterisk-VM-Category: %s" ENDL, category);
+		fprintf(p, "X-Asterisk-VM-Message-Type: %s\n", msgnum > -1 ? "Message" : greeting_attachment);
 		fprintf(p, "X-Asterisk-VM-Orig-date: %s" ENDL, date);
 		fprintf(p, "X-Asterisk-VM-Orig-time: %ld" ENDL, (long)time(NULL));
 	}
@@ -2084,12 +2098,15 @@
 			ast_channel_free(ast);
 		} else
 			ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
-	} else {
+	} else if (msgnum > -1){
 		fprintf(p, "Dear %s:" ENDL ENDL "\tJust wanted to let you know you were just left a %s long message (number %d)" ENDL
 
 		"in mailbox %s from %s, on %s so you might" ENDL
 		"want to check it when you get a chance.  Thanks!" ENDL ENDL "\t\t\t\t--Asterisk" ENDL ENDL, vmu->fullname, 
 		dur, msgnum + 1, mailbox, (cidname ? cidname : (cidnum ? cidnum : "an unknown caller")), date);
+	} else {
+		fprintf(p, "This message is to let you know that your greeting was changed on %s." ENDL
+				"Please do not delete this message, lest your greeting vanish with it." ENDL ENDL, date);
 	}
 	if (attach_user_voicemail) {
 		/* Eww. We want formats to tell us their own MIME type */
@@ -2108,10 +2125,16 @@
 			ast_debug(3, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
 		}
 		fprintf(p, "--%s" ENDL, bound);
-		fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"" ENDL, ctype, format, msgnum + 1, format);
+		if (msgnum > -1)
+			fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"" ENDL, ctype, format, msgnum + 1, format);
+		else
+			fprintf(p, "Content-Type: %s%s; name=\"%s.%s\"" ENDL, ctype, format, greeting_attachment, format);
 		fprintf(p, "Content-Transfer-Encoding: base64" ENDL);
 		fprintf(p, "Content-Description: Voicemail sound attachment." ENDL);
-		fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.%s\"" ENDL ENDL, msgnum + 1, format);
+		if (msgnum > -1)
+			fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.%s\"" ENDL ENDL, msgnum + 1, format);
+		else
+			fprintf(p, "Content-Disposition: attachment; filename=\"%s.%s\"" ENDL ENDL, greeting_attachment, format);
 		snprintf(fname, sizeof(fname), "%s.%s", attach, format);
 		base_encode(fname, p);
 		fprintf(p, ENDL "--%s--" ENDL "." ENDL, bound);
@@ -2240,7 +2263,7 @@
 	struct tm tm;
 	time_t t;
 	t = time(0);
-	ast_localtime(&t, &tm, NULL);
+	ast_localtime(&t,&tm, NULL);
 	return strftime(s, len, "%a %b %e %r %Z %Y", &tm);
 }
 
@@ -2257,7 +2280,7 @@
 		return -1;
 	}
 
-	RETRIEVE(fn, -1);
+	RETRIEVE(fn, -1, ext, context);
 	if (ast_fileexists(fn, NULL, NULL) > 0) {
 		res = ast_stream_and_wait(chan, fn, ecodes);
 		if (res) {
@@ -2518,8 +2541,11 @@
 	if (!ast_strlen_zero(vmu->serveremail))
 		myserveremail = vmu->serveremail;
 
-	make_file(fn, sizeof(fn), dir, msgnum);
-
+	if (msgnum > -1)
+		make_file(fn, sizeof(fn), dir, msgnum);
+	else
+		ast_copy_string (fn, dir, sizeof(fn));
+	
 	if (ast_strlen_zero(vmu->email))
 		ast_copy_string(vmu->email, vmu->imapuser, sizeof(vmu->email));
 
@@ -2532,6 +2558,12 @@
 	if (!(p = vm_mkftemp(tmp))) {
 		ast_log(LOG_WARNING, "Unable to store '%s' (can't create temporary file)\n", fn);
 		return -1;
+
+	}
+
+	if (msgnum < 0 && imapgreetings) {
+		init_mailstream(vms, GREETING_FOLDER);
+		imap_delete_old_greeting(fn, vms);
 	}
 	
 	make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), fn, fmt, duration, 1, chan, NULL, 1);
@@ -3002,7 +3034,7 @@
 		ast_log(LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
 		return -1;
 	}
-	RETRIEVE(tempfile, -1);
+	RETRIEVE(tempfile, -1, ext, context);
 	if (ast_fileexists(tempfile, NULL, NULL) > 0)
 		ast_copy_string(prefile, tempfile, sizeof(prefile));
 	DISPOSE(tempfile, -1);
@@ -3039,7 +3071,7 @@
 
 	/* Play the beginning intro if desired */
 	if (!ast_strlen_zero(prefile)) {
-		RETRIEVE(prefile, -1);
+		RETRIEVE(prefile, -1, ext, context);
 		if (ast_fileexists(prefile, NULL, NULL) > 0) {
 			if (ast_streamfile(chan, prefile, chan->language) > -1) 
 				res = ast_waitstream(chan, ecodes);
@@ -4240,7 +4272,7 @@
 		char buf[1024] = "";
 		int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
 #endif
- 		RETRIEVE(dir, curmsg);
+ 		RETRIEVE(dir, curmsg, sender->mailbox, context);
 		cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, S_OR(context, "default"), record_gain, &duration, vms);
 		if (!cmd) {
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
@@ -4384,7 +4416,7 @@
 	ast_localtime(&t, &time_now, NULL);
 	tv_now = ast_tvnow();
 	tnow = tv_now.tv_sec;
-	ast_localtime(&tnow, &time_then, NULL);
+	ast_localtime(&tnow,&time_then, NULL);
 
 	/* Day difference */
 	if (time_now.tm_year == time_then.tm_year)
@@ -4581,6 +4613,7 @@
 		ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n");
 		return -1;
 	}
+	
 	
 	/* Find the format of the attached file */
 
@@ -4718,7 +4751,7 @@
 	/* Retrieve info from VM attribute file */
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
 	snprintf(filename, sizeof(filename), "%s.txt", vms->fn2);
-	RETRIEVE(vms->curdir, vms->curmsg);
+	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
 	msg_cfg = ast_config_load(filename);
 	if (!msg_cfg) {
 		ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
@@ -4792,6 +4825,8 @@
 
 	if(box == 0 || box == 1)
 		sprintf(spec, "%s%s", tmp, use_folder? imapfolder: "INBOX");
+	else if (box == GREETING_FOLDER)
+		sprintf(spec, "%s%s", tmp, greetingfolder);
 	else
 		sprintf(spec, "%s%s%c%s", tmp, imapfolder, delimiter, mbox(box));
 }
@@ -4888,6 +4923,182 @@
 	mail_free_searchpgm(&pgm);
 
 	return 0;
+}
+
+static int imap_remove_file(char *dir, int msgnum)
+{
+	char fn[PATH_MAX];
+	char full_fn[PATH_MAX];
+	char msgnums[80];
+	
+	if (msgnum > -1) {
+		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
+		make_file(fn, sizeof(fn), dir, msgnum);
+	} else
+		ast_copy_string(fn, dir, sizeof(fn));
+	
+	if ((msgnum < 0 && imapgreetings) || msgnum > -1) {
+		ast_filedelete(fn, NULL);	
+		snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
+		unlink(full_fn);
+	}
+	return 0;
+}
+
+static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *context)
+{
+	struct ast_vm_user *vmu;
+	struct vm_state *vms_p;
+	char *file, *filename;
+	char *attachment;
+	/*char *mb, *cur;*/
+	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! */
+	/* ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
+	vmu = find_user(NULL, context, mailbox);
+	if (!vmu) {
+		ast_log (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 (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_imapuser(vmu->imapuser,1);
+	if (!vms_p) {
+		vms_p = get_vm_state_by_mailbox(mailbox,1);
+	}
+	if (!vms_p){
+		/* add one if not there... */
+		vms_p = get_vm_state_by_imapuser(vmu->imapuser,0);
+		if (!vms_p) {
+			vms_p = get_vm_state_by_mailbox(mailbox,0);
+		}
+
+		if (!vms_p) {
+			ast_debug (3,"Adding new vmstate for %s\n",vmu->imapuser);
+			if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
+				free_user(vmu);
+				return -1;
+			}
+			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 */
+			vms_p->mailstream = NIL; /* save for access from interactive entry point */
+			ast_debug (3,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+			vms_p->updated = 1;
+			/* set mailbox to INBOX! */
+			ast_copy_string(vms_p->curbox, mbox(0), sizeof(vms_p->curbox));
+			init_vm_state(vms_p);
+			vmstate_insert(vms_p);
+		}
+	}
+	
+	ret = init_mailstream(vms_p, GREETING_FOLDER);
+	if (!vms_p->mailstream) {
+		ast_log (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->next && body->nested.part->next->body.parameter->value) {
+			attachment = 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;
+		}
+		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);
+			free_user(vmu);
+			return 0;
+		}
+	}
+	
+
+/*	pgm = mail_newsearchpgm ();
+	hdr = mail_newsearchheader ("X-Asterisk-VM-Message-Type", file);
+	pgm->header = hdr;
+	pgm->unseen = 1;
+	pgm->seen = 0;
+	pgm->undeleted = 1;
+	pgm->deleted = 0;
+
+	vms_p->vmArrayIndex = 0;
+	
+	mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
+	vms_p->newmessages = vms_p->vmArrayIndex;
+	mail_free_searchpgm(&pgm);*/
+
+
+	free_user(vmu);
+	return 0;
+}
+
+static int imap_delete_old_greeting (char *dir, struct vm_state *vms)
+{
+	char *file, *filename;
+	char *attachment;
+	char arg[10];
+	int i;
+	BODY* body;
+
+	
+	file = strrchr(ast_strdupa(dir), '/');
+	if (file)
+		*file++ = '\0';
+	else {
+		ast_log (LOG_ERROR, "Failed to procure file name from directory passed. You should never see this.\n");
+		return -1;
+	}
+	
+	for (i = 0; i < vms->mailstream->nmsgs; i++) {
+		mail_fetchstructure(vms->mailstream, i + 1, &body);
+		/* We have the body, now we extract the file name of the first attachment. */
+		if (body->nested.part->next && body->nested.part->next->body.parameter->value) {
+			attachment = 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;
+		}
+		filename = strsep(&attachment, ".");
+		if (!strcmp(filename, file))
+		{
+			sprintf (arg,"%d", i+1);
+			mail_setflag (vms->mailstream,arg,"\\DELETED");
+			mail_expunge_full(vms->mailstream, NIL, EX_UID);
+			return 0;
+		}
+	}	
+	ast_debug (2, "Unable to find greeting\n");
+	return -1;
 }
 #else
 static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
@@ -5057,7 +5268,7 @@
 {
 	int cmd;
 
-	if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French or Portuguese syntax */
+	if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "fr") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French or Portuguese syntax */
 		cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
 		return cmd ? cmd : ast_play_and_wait(chan, mbox);
 	} else if (!strcasecmp(chan->language, "gr")){
@@ -5530,14 +5741,14 @@
 		}
 		if (!res && vms->oldmessages) {
 			res = say_and_wait(chan, vms->oldmessages, chan->language);
-			if (!res)
-				res = ast_play_and_wait(chan, "vm-Old");
 			if (!res) {
 				if (vms->oldmessages == 1)
 					res = ast_play_and_wait(chan, "vm-message");
 				else
 					res = ast_play_and_wait(chan, "vm-messages");
 			}
+			if (!res)
+				res = ast_play_and_wait(chan, "vm-Old");
 		}
 		if (!res) {
 			if (!vms->oldmessages && !vms->newmessages) {
@@ -6202,7 +6413,7 @@
 	while((cmd >= 0) && (cmd != 't')) {
 		if (cmd)
 			retries = 0;
-		RETRIEVE(prefile, -1);
+		RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
 		if (ast_fileexists(prefile, NULL, NULL) <= 0) {
 #ifndef IMAP_STORAGE
 			play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
@@ -7788,6 +7999,20 @@
 		} else {
 			ast_copy_string(imapfolder,"INBOX", sizeof(imapfolder));
 		}
+		if ((val = ast_variable_retrieve(cfg, "general", "imapgreetings"))) {
+			if(ast_false(val))
+				imapgreetings = 0;
+			else
+				imapgreetings = 1;
+		} else {
+			imapgreetings = 0;
+		}
+		if ((val = ast_variable_retrieve(cfg, "general", "greetingfolder"))) {
+			ast_copy_string(greetingfolder, val, sizeof(greetingfolder));
+		}
+		else {
+			ast_copy_string(greetingfolder, imapfolder, sizeof(greetingfolder));
+		}
 #endif
 		/* External voicemail notify application */
 		if ((val = ast_variable_retrieve(cfg, "general", "externnotify"))) {
@@ -8378,7 +8603,7 @@
 
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
 	snprintf(filename,sizeof(filename), "%s.txt", vms->fn2);
-	RETRIEVE(vms->curdir, vms->curmsg);
+	RETRIEVE(vms->curdir, vms->curms, vmu->mailbox, vmu->context);
 	msg_cfg = ast_config_load(filename);
 	DISPOSE(vms->curdir, vms->curmsg);
 	if (!msg_cfg) {
@@ -8579,11 +8804,6 @@
 		return -1;
 	}
 
-	if (!outsidecaller)
-		snprintf(tempfile, sizeof(tempfile), "%s.tmp", recordfile);
-	else
-		ast_copy_string(tempfile, recordfile, sizeof(tempfile));
-
 	cmd = '3';  /* Want to start by recording */
 
 	while ((cmd >= 0) && (cmd != 't')) {
@@ -8597,7 +8817,7 @@
 				/* Otherwise 1 is to save the existing message */
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
-				if (!outsidecaller)
+				if (!outsidecaller) 
 					ast_filerename(tempfile, recordfile, NULL);
 				ast_stream_and_wait(chan, "vm-msgsaved", "");
 				if (!outsidecaller) {
@@ -8633,15 +8853,11 @@
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
 			if (ast_test_flag(vmu, VM_OPERATOR))
 				canceldtmf = "0";
-			cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
+			cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
 			if (record_gain)
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
 			if (cmd == -1) {
-				/* User has hung up, no options to give */
-				if (!outsidecaller) {
-					/* user was recording a greeting and they hung up, so let's delete the recording. */
-					vm_delete(tempfile);
-				}
+			/* User has hung up, no options to give */
 				return cmd;
 			}
 			if (cmd == '0') {
@@ -8655,14 +8871,14 @@
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Message too short\n");
 				cmd = ast_play_and_wait(chan, "vm-tooshort");
-				cmd = vm_delete(tempfile);
+				cmd = vm_delete(recordfile);
 				break;
 			}
 			else if (vmu->review && (cmd == 2 && *duration < (maxsilence + 3))) {
 				/* Message is all silence */
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Nothing recorded\n");
-				cmd = vm_delete(tempfile);
+				cmd = vm_delete(recordfile);
 				cmd = ast_play_and_wait(chan, "vm-nothingrecorded");
 				if (!cmd)
 					cmd = ast_play_and_wait(chan, "vm-speakup");
@@ -8691,7 +8907,7 @@
 		case '*':
 			/* Cancel recording, delete message, offer to take another message*/
 			cmd = ast_play_and_wait(chan, "vm-deleted");
-			cmd = vm_delete(tempfile);
+			cmd = vm_delete(recordfile);
 			if (outsidecaller) {
 				res = vm_exec(chan, NULL);
 				return res;

Modified: team/mmichelson/trunk-vm-imap/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/trunk-vm-imap/channels/chan_sip.c?view=diff&rev=70532&r1=70531&r2=70532
==============================================================================
--- team/mmichelson/trunk-vm-imap/channels/chan_sip.c (original)
+++ team/mmichelson/trunk-vm-imap/channels/chan_sip.c Wed Jun 20 16:52:31 2007
@@ -1646,7 +1646,6 @@
 	.send_digit_end = sip_senddigit_end,
 	.bridge = ast_rtp_bridge,
 	.send_text = sip_sendtext,
-	.func_channel_read = acf_channel_read,
 };
 
 /**--- some list management macros. **/
@@ -3028,7 +3027,7 @@
 		ast_rtp_set_rtpkeepalive(dialog->trtp, peer->rtpkeepalive);
 	}
 
-	ast_string_field_set(dialog, peername, peer->name);
+	ast_string_field_set(dialog, peername, peer->username);
 	ast_string_field_set(dialog, authname, peer->username);
 	ast_string_field_set(dialog, username, peer->username);
 	ast_string_field_set(dialog, peersecret, peer->secret);
@@ -14993,12 +14992,6 @@
 	if (ast_strlen_zero(args.param) || strcasecmp(args.param, "rtpqos"))
 		return -1;
 
-	/* Default arguments of audio,all */
-	if (ast_strlen_zero(args.type))
-		args.type = "audio";
-	if (ast_strlen_zero(args.field))
-		args.field = "all";
-
 	memset(buf, 0, buflen);
 	memset(&qos, 0, sizeof(qos));
 




More information about the asterisk-commits mailing list