[Home]

Summary:ASTERISK-14622: [patch] WaitForSilence never exits - no dsp.conf
Reporter:Davi Sidrane (david_s5)Labels:
Date Opened:2009-08-09 12:38:06Date Closed:2010-06-07 12:36:39
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_waitforsilence
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) dsp-silence-threshold-init.diff
( 1) issue15685.patch.v5
Description:WaitForSilence to anything other than 1, WaitForSilence never exits

It is a bug in dsp.c. It does not properly init thresholds[THRESHOLD_SILENCE]
if the conf file is missing and does not warn if the file is missing..

I found that because I did not have a dsp.conf file in /etc/asterisk the dialplan entry exten => s,1,WaitForSilence(4000,1,60) would be stuck.



****** ADDITIONAL INFORMATION ******

URL: http://svn.digium.com/svn/asterisk/branches/1.6.1
Revision: 211031

The following code does not init the defualt value of
thresholds[THRESHOLD_SILENCE] to 256 if the conf file is missing.


static int _dsp_init(int reload)
{
       struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
       struct ast_config *cfg;

       cfg = ast_config_load2(CONFIG_FILE_NAME, "dsp", config_flags);

       if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED) {
               const char *value;

               value = ast_variable_retrieve(cfg, "default", "silencethreshold");
               if (value && sscanf(value, "%d", &thresholds[THRESHOLD_SILENCE]) != 1) {
                       ast_log(LOG_WARNING, "%s: '%s' is not a valid silencethreshold value\n", CONFIG_FILE_NAME, value);
                       thresholds[THRESHOLD_SILENCE] = 256;
               } else if (!value)
                       thresholds[THRESHOLD_SILENCE] = 256;

               ast_config_destroy(cfg);
       }
       return 0;
}
Comments:By: dant (dant) 2009-08-09 14:44:08

Patch to trunk attached...
* Defines a default silence threshold constant set to the current default of 256
* If the config file is not present, issues a warning saying that it will use the default silence threshold and applies the default silence threshold
* Where the variable was set to a static value, i.e. in the event that the config existed but didn't define the variable or if it was set to an invalid value, it now uses the constant to apply the default value.

By: Digium Subversion (svnbot) 2010-06-07 12:34:45

Repository: asterisk
Revision: 268690

U   trunk/main/dsp.c

------------------------------------------------------------------------
r268690 | pabelanger | 2010-06-07 12:34:44 -0500 (Mon, 07 Jun 2010) | 11 lines

Set threshold for silence detection defaults to 256

(closes issue ASTERISK-14622)
Reported by: david_s5
Patches:
     dsp-silence-threshold-init.diff uploaded by dant (license 670)
     issue15685.patch.v5 uploaded by pabelanger (license 224)
Tested by: danti

Review: https://reviewboard.asterisk.org/r/670/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=268690

By: Digium Subversion (svnbot) 2010-06-07 12:36:38

Repository: asterisk
Revision: 268691

_U  branches/1.6.2/
U   branches/1.6.2/main/dsp.c

------------------------------------------------------------------------
r268691 | pabelanger | 2010-06-07 12:36:38 -0500 (Mon, 07 Jun 2010) | 18 lines

Merged revisions 268690 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r268690 | pabelanger | 2010-06-07 13:34:45 -0400 (Mon, 07 Jun 2010) | 11 lines
 
 Set threshold for silence detection defaults to 256
 
 (closes issue ASTERISK-14622)
 Reported by: david_s5
 Patches:
       dsp-silence-threshold-init.diff uploaded by dant (license 670)
       issue15685.patch.v5 uploaded by pabelanger (license 224)
 Tested by: danti
 
 Review: https://reviewboard.asterisk.org/r/670/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=268691