mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
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) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2095,17 +2095,19 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
|
||||
/* 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);
|
||||
ast_debug(3, "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;
|
||||
ast_debug(3, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
|
||||
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
|
||||
snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir);
|
||||
tmpfd = mkstemp(newtmp);
|
||||
ast_debug(3, "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;
|
||||
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);
|
||||
@@ -2115,9 +2117,11 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user