diff options
author | Matthew Jordan <mjordan@digium.com> | 2011-09-20 23:02:25 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2011-09-20 23:02:25 +0000 |
commit | e218748ac1ef5158b110e7549152ab11e1418273 (patch) | |
tree | 2101d23bfa882dd05e93a448cbd188aafccae752 /apps/app_minivm.c | |
parent | 1313c1284700f2cb9882b4390989e10a4b51df00 (diff) |
Merged revisions 337120 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10
................
r337120 | mjordan | 2011-09-20 17:49:36 -0500 (Tue, 20 Sep 2011) | 28 lines
Merged revisions 337118 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r337118 | mjordan | 2011-09-20 17:38:54 -0500 (Tue, 20 Sep 2011) | 21 lines
Fix for incorrect voicemail duration in external notifications
This patch fixes an issue where the voicemail duration was being reported
with a duration significantly less than the actual sound file duration.
Voicemails that contained mostly silence were reporting the duration of
only the sound in the file, as opposed to the duration of the file with
the silence. This patch fixes this by having two durations reported in
the __ast_play_and_record family of functions - the sound_duration and the
actual duration of the file. The sound_duration, which is optional, now
reports the duration of the sound in the file, while the actual full duration
of the file is reported in the duration parameter. This allows the voicemail
applications to use the sound_duration for minimum duration checking, while
reporting the full duration to external parties if the voicemail is kept.
(issue ASTERISK-2234)
(closes issue ASTERISK-16981)
Reported by: Mary Ciuciu, Byron Clark, Brad House, Karsten Wemheuer, KevinH
Tested by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1443
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_minivm.c')
-rw-r--r-- | apps/app_minivm.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 3445b7ec6..993a5a366 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1603,7 +1603,7 @@ static int vm_delete(char *file) /*!\internal * \brief Record voicemail message & let caller review or re-record it, or set options if applicable */ static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, - int outsidecaller, struct minivm_account *vmu, int *duration, const char *unlockdir, + int outsidecaller, struct minivm_account *vmu, int *duration, int *sound_duration, const char *unlockdir, signed char record_gain) { int cmd = 0; @@ -1653,7 +1653,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0); if (ast_test_flag(vmu, MVM_OPERATOR)) canceldtmf = "0"; - cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, global_silencethreshold, global_maxsilence, unlockdir, acceptdtmf, canceldtmf); + cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, global_silencethreshold, global_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 */ @@ -1842,6 +1842,7 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav FILE *txt; int res = 0, txtdes; int duration = 0; + int sound_duration = 0; char date[256]; char tmpdir[PATH_MAX]; char ext_context[256] = ""; @@ -1917,7 +1918,7 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav /* Store information */ ast_debug(2, "Open file for metadata: %s\n", tmptxtfile); - res = play_record_review(chan, NULL, tmptxtfile, global_vmmaxmessage, fmt, 1, vmu, &duration, NULL, options->record_gain); + res = play_record_review(chan, NULL, tmptxtfile, global_vmmaxmessage, fmt, 1, vmu, &duration, &sound_duration, NULL, options->record_gain); txt = fdopen(txtdes, "w+"); if (!txt) { @@ -1958,8 +1959,8 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav ast_mutex_unlock(&minivmloglock); } - if (duration < global_vmminmessage) { - ast_verb(3, "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, global_vmminmessage); + if (sound_duration < global_vmminmessage) { + ast_verb(3, "Recording was %d seconds long but needs to be at least %d - abandoning\n", sound_duration, global_vmminmessage); fclose(txt); ast_filedelete(tmptxtfile, NULL); unlink(tmptxtfile); @@ -2536,7 +2537,7 @@ static int minivm_accmess_exec(struct ast_channel *chan, const char *data) } snprintf(filename,sizeof(filename), "%s%s/%s/%s", MVM_SPOOL_DIR, vmu->domain, vmu->username, message); /* Maybe we should check the result of play_record_review ? */ - play_record_review(chan, prompt, filename, global_maxgreet, default_vmformat, 0, vmu, &duration, NULL, FALSE); + play_record_review(chan, prompt, filename, global_maxgreet, default_vmformat, 0, vmu, &duration, NULL, NULL, FALSE); ast_debug(1, "Recorded new %s message in %s (duration %d)\n", message, filename, duration); |