Fix silence detection in app_record (bug #2883)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2004-11-17 03:34:56 +00:00
parent 387fbae462
commit d1f802d254
1 changed files with 38 additions and 39 deletions

View File

@ -114,13 +114,13 @@ static int record_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "No extension specified to filename!\n");
return -1;
}
if (silstr) {
if ((sscanf(silstr, "%d", &i) == 1) && (i > -1))
silence = i;
else if (!ast_strlen_zero(silstr))
if ((sscanf(silstr, "%d", &i) == 1) && (i > -1)) {
silence = i * 1000;
} else if (!ast_strlen_zero(silstr)) {
ast_log(LOG_WARNING, "'%s' is not a valid silence duration\n", silstr);
}
}
if (maxstr) {
if ((sscanf(maxstr, "%d", &i) == 1) && (i > -1))
@ -185,7 +185,6 @@ static int record_exec(struct ast_channel *chan, void *data)
/* The end of beep code. Now the recording starts */
if (silence > 0) {
rfmt = chan->readformat;
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);