Summary:ASTERISK-10641: Silence detector not working
Reporter:Ubiarajara Cortes (birajr)Labels:
Date Opened:2007-10-29 13:02:23Date Closed:2011-06-07 14:03:07
Versions:Frequency of
Description:The Silence detector is not working in the app record.
Comments:By: Jason Parker (jparker) 2007-10-29 14:17:22

I think I can reproduce.  Sort of.

Can you check and see if this works as expected if the destination file does not exist?  If I have Record(blah.gsm,5) and remove blah.gsm before running it, it works fine.  If blah.gsm exists, I don't even get the beep played.  It also appears to deadlock when this happens.

By: Ubiarajara Cortes (birajr) 2007-10-29 14:49:13

I tried as you discribed but no success.

In my test I put my softphone in mute to ensure that no sound is been send to Asterisk.

I´m running Asterisk with debug on to CLI in /etc/asterisk/logger.conf and starting it with "asterisk -vvvvvdc", I put log debug in the app_record.c in the part of the silence detector but no message about the silence detector activite is diplayed.

By: Jason Parker (jparker) 2007-10-29 14:54:09

I don't believe there are any debug messages if the silence detector is being used.

The bug I found was only happening in svn trunk - are you sure you're running 1.4.13?

Can you explain how you're calling app_record, and what exactly happens?

By: Ubiarajara Cortes (birajr) 2007-10-29 15:04:47

I´m running the 1.4.13 version

My extention is:

exten => 123,1,Answer()
exten => 123,2,Record(/testrec.gsm|5|100)
exten => 123,3,hangup()

The record do not stop with silence after 5 seconds, it only stop with a DTMF key.

In the oficial app_record.c dont have any debug message, I put the debug code as bellow (ast_log(LOG_DEBUG, "Got silence %d\n", totalsilence);):

 if (f->frametype == AST_FRAME_VOICE) {
  res = ast_writestream(s, f);
  if (res) {
   ast_log(LOG_WARNING, "Problem writing frame\n");
  if (silence > 0) {
   dspsilence = 0;
   ast_dsp_silence(sildet, f, &dspsilence);
   if (dspsilence) {
    totalsilence = dspsilence;
    ast_log(LOG_DEBUG, "Got silence %d\n", totalsilence);
   } else {
    totalsilence = 0;
   if (totalsilence > silence) {
    /* Ended happily with silence */
    gotsilence = 1;

By: Jason Parker (jparker) 2007-10-29 17:51:24

I have a feeling that when muted or silent, your phone isn't sending any audio frames at all.  Could you try turning VAD/silence suppression off?

By: Ubiarajara Cortes (birajr) 2007-10-30 08:07:48

I tried VAD off (SIP call) and over ISDN ( with normal telephone line and TE410p card ) but I got the same problem. No silence detected at all.

By: Joshua C. Colp (jcolp) 2007-10-31 19:33:45

I can confirm that the silence detector *does* work, the threshold just requires that you be very quiet. The only reason that I can think of for it not working would be if there was some background noise that was high enough to trip it...

By: Joshua C. Colp (jcolp) 2007-12-18 10:15:17.000-0600

I would suggest playing with the value given to ast_dsp_set_threshold in app_record and seeing if that changes the end result. If it does then there is something in the audio causing the silence detector to not trip.

By: Tilghman Lesher (tilghman) 2008-01-04 10:15:00.000-0600

No response from reporter, closing.