[Asterisk-cvs] asterisk/apps app_voicemail.c,1.213,1.214

kpfleming at lists.digium.com kpfleming at lists.digium.com
Mon May 16 09:31:15 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv24168/apps

Modified Files:
	app_voicemail.c 
Log Message:
clean up message duration writing code (bug #4285)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- app_voicemail.c	15 May 2005 17:03:08 -0000	1.213
+++ app_voicemail.c	16 May 2005 13:36:35 -0000	1.214
@@ -1988,7 +1988,6 @@
 	FILE *txt;
 	int res = 0;
 	int msgnum;
-	int fd;
 	int duration = 0;
 	int ausemacro = 0;
 	int ousemacro = 0;
@@ -2192,24 +2191,22 @@
 	chan->name,
 	ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
 	date, (long)time(NULL),
-	category ? category : "");
-					fclose(txt);
+	category ? category : ""); 
 				} else
 					ast_log(LOG_WARNING, "Error opening text file for output\n");
 				res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir);
-				if (res == '0')
+				if (res == '0') {
+					if (txt)
+						fclose(txt);
 					goto transfer;
+				}
 				if (res > 0)
 					res = 0;
-				fd = open(txtfile, O_APPEND | O_WRONLY);
-				if (fd > -1) {
-					txt = fdopen(fd, "a");
-					if (txt) {
-						fprintf(txt, "duration=%d\n", duration);
-						fclose(txt);
-					} else
-						close(fd);
+				if (txt) {
+					fprintf(txt, "duration=%d\n", duration);
+					fclose(txt);
 				}
+				
 				if (duration < vmminmessage) {
 					if (option_verbose > 2) 
 						ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);




More information about the svn-commits mailing list