From: Tilghman Lesher Date: Mon, 28 Jul 2008 21:50:50 +0000 (+0000) Subject: Detect when sox fails to raise the volume, because sox can't read the file. X-Git-Tag: 1.4.22-rc1~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0b2e2334793e82d5325fdbeac294452b1a997305;p=thirdparty%2Fasterisk.git Detect when sox fails to raise the volume, because sox can't read the file. (closes issue #12939) Reported by: rickbradley Patches: 20080728__bug12939.diff.txt uploaded by Corydon76 (license 14) Tested by: rickbradley git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@134161 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index cf71c5f8a7..09c90e5887 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1994,11 +1994,18 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in if (option_debug > 2) ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp); if (tmpfd > -1) { + int soxstatus; 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); + if ((soxstatus = ast_safe_system(tmpcmd)) == 0) { + 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); + } + } else { + ast_log(LOG_WARNING, "Sox failed to reencode %s.%s: %s (have you installed support for all sox file formats?)\n", attach, format, + soxstatus == 1 ? "Problem with command line options" : "An error occurred during file processing"); + ast_log(LOG_WARNING, "Voicemail attachment will have no volume gain.\n"); + } } } fprintf(p, "--%s" ENDL, bound);