[Freeswitch-trunk] [commit] r3803 - freeswitch/trunk/src
Freeswitch SVN
mikej at freeswitch.org
Fri Dec 22 16:10:22 EST 2006
Author: mikej
Date: Fri Dec 22 16:10:20 2006
New Revision: 3803
Modified:
freeswitch/trunk/src/switch_ivr.c
Log:
default timeout on record to 3 seconds, reset timeout when we hear sound above the threshold, change terms of silence timeout to be seconds.
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri Dec 22 16:10:20 2006
@@ -346,6 +346,7 @@
char *p;
const char *vval;
time_t start = 0;
+ int org_silence_hits = 0;
if (!fh) {
fh = &lfh;
@@ -432,10 +433,13 @@
}
if (fh->thresh) {
- if (!fh->silence_hits) {
- fh->silence_hits = 20;
+ if (fh->silence_hits) {
+ fh->silence_hits = fh->samplerate * fh->silence_hits;
+ } else {
+ fh->silence_hits = fh->samplerate * 3;
}
- }
+ org_silence_hits = fh->silence_hits;
+ }
while(switch_channel_ready(channel)) {
switch_size_t len;
@@ -500,10 +504,13 @@
score = (uint32_t)(energy / samples);
if (score < fh->thresh) {
- if (!--fh->silence_hits) {
+ fh->silence_hits -= fh->samplerate;
+ if (fh->silence_hits <= 0) {
break;
}
- }
+ } else {
+ fh->silence_hits = org_silence_hits;
+ }
}
if (!switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
More information about the Freeswitch-trunk
mailing list