summaryrefslogtreecommitdiff
path: root/apps/app_minivm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_minivm.c')
-rw-r--r--apps/app_minivm.c13
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);