[svn-commits] russell: branch russell/iax2_ff r70810 - in /team/russell/iax2_ff: ./ apps/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 21 14:58:57 CDT 2007


Author: russell
Date: Thu Jun 21 14:58:57 2007
New Revision: 70810

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70810
Log:
Merged revisions 70808 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r70808 | mmichelson | 2007-06-21 14:49:44 -0500 (Thu, 21 Jun 2007) | 4 lines

When volgain is used don't leave a temporary file behind.
(Closes Issue 8514, Reported and patched by ulogic, code reviewed by Jason Parker)


........

Modified:
    team/russell/iax2_ff/   (props changed)
    team/russell/iax2_ff/apps/app_voicemail.c

Propchange: team/russell/iax2_ff/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun 21 14:58:57 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-70764
+/branches/1.4:1-70809

Modified: team/russell/iax2_ff/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_ff/apps/app_voicemail.c?view=diff&rev=70810&r1=70809&r2=70810
==============================================================================
--- team/russell/iax2_ff/apps/app_voicemail.c (original)
+++ team/russell/iax2_ff/apps/app_voicemail.c Thu Jun 21 14:58:57 2007
@@ -1964,19 +1964,21 @@
 		/* Eww. We want formats to tell us their own MIME type */
 		char *ctype = (!strcasecmp(format, "ogg")) ? "application/" : "audio/x-";
 		char tmpdir[256], newtmp[256];
-		int tmpfd;
+		int tmpfd = -1;
 	
-		create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
-		snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir);
-		tmpfd = mkstemp(newtmp);
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp);
 		if (vmu->volgain < -.001 || vmu->volgain > .001) {
-			snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, attach, format, newtmp, format);
-			ast_safe_system(tmpcmd);
-			attach = newtmp;
+			create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
+			snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir);
+			tmpfd = mkstemp(newtmp);
 			if (option_debug > 2)
-				ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
+				ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp);
+			if (tmpfd > -1) {
+				snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, attach, format, newtmp, format);
+				ast_safe_system(tmpcmd);
+				attach = newtmp;
+				if (option_debug > 2)
+					ast_log(LOG_DEBUG, "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);
@@ -1986,9 +1988,11 @@
 		snprintf(fname, sizeof(fname), "%s.%s", attach, format);
 		base_encode(fname, p);
 		fprintf(p, ENDL "--%s--" ENDL "." ENDL, bound);
-		if (tmpfd > -1)
+		if (tmpfd > -1) {
+			unlink(fname);
 			close(tmpfd);
-		unlink(newtmp);
+			unlink(newtmp);
+		}
 	}
 #undef ENDL
 }




More information about the svn-commits mailing list