Bug # 1247: Add patch to specify minimum vmail length and discard that

which does not meet the minimum


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Malcolm Davenport 22 years ago
parent d3b2cb19e4
commit 264bfb7121

@ -190,6 +190,7 @@ static char serveremail[80];
static char mailcmd[160]; /* Configurable mail cmd */ static char mailcmd[160]; /* Configurable mail cmd */
static char vmfmts[80]; static char vmfmts[80];
static int vmminmessage;
static int vmmaxmessage; static int vmmaxmessage;
static int maxgreet; static int maxgreet;
static int skipms; static int skipms;
@ -1484,6 +1485,10 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
} else } else
close(fd); close(fd);
} }
if (end - start < vmminmessage) {
ast_filedelete(fn, NULL);
goto leave_vm_out;
}
stringp = fmt; stringp = fmt;
strsep(&stringp, "|"); strsep(&stringp, "|");
/* Send e-mail if applicable */ /* Send e-mail if applicable */
@ -1510,6 +1515,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
} }
} else } else
ast_log(LOG_WARNING, "No format for saving voicemail?\n"); ast_log(LOG_WARNING, "No format for saving voicemail?\n");
leave_vm_out:
free_user(vmu); free_user(vmu);
} else { } else {
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext); ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
@ -3242,6 +3248,15 @@ static int load_config(void)
ast_log(LOG_WARNING, "Invalid max message time length\n"); ast_log(LOG_WARNING, "Invalid max message time length\n");
} }
} }
vmminmessage = 0;
if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
if (sscanf(s, "%d", &x) == 1) {
vmminmessage = x;
} else {
ast_log(LOG_WARNING, "Invalid min message time length\n");
}
}
fmt = ast_variable_retrieve(cfg, "general", "format"); fmt = ast_variable_retrieve(cfg, "general", "format");
if (!fmt) if (!fmt)
fmt = "wav"; fmt = "wav";

@ -12,6 +12,8 @@ serveremail=asterisk
attach=yes attach=yes
; Maximum length of a voicemail message ; Maximum length of a voicemail message
;maxmessage=180 ;maxmessage=180
; Minimum length of a voicemail message
;minmessage=3
; Maximum length of greetings ; Maximum length of greetings
;maxgreet=60 ;maxgreet=60
; How many miliseconds to skip forward/back when rew/ff in message playback ; How many miliseconds to skip forward/back when rew/ff in message playback

Loading…
Cancel
Save