[svn-commits] pabelanger: trunk r268690 - /trunk/main/dsp.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jun 7 12:34:49 CDT 2010
Author: pabelanger
Date: Mon Jun 7 12:34:45 2010
New Revision: 268690
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=268690
Log:
Set threshold for silence detection defaults to 256
(closes issue #15685)
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/
Modified:
trunk/main/dsp.c
Modified: trunk/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/dsp.c?view=diff&rev=268690&r1=268689&r2=268690
==============================================================================
--- trunk/main/dsp.c (original)
+++ trunk/main/dsp.c Mon Jun 7 12:34:45 2010
@@ -212,6 +212,12 @@
#define DTMF_HITS_TO_BEGIN 2
/* How many successive misses needed to consider end of a digit */
#define DTMF_MISSES_TO_END 3
+
+/*!
+ * \brief The default silence threshold we will use if an alternate
+ * configured value is not present or is invalid.
+ */
+static const int DEFAULT_SILENCE_THRESHOLD = 256;
#define CONFIG_FILE_NAME "dsp.conf"
@@ -1674,19 +1680,25 @@
struct ast_config *cfg;
cfg = ast_config_load2(CONFIG_FILE_NAME, "dsp", config_flags);
- if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
+ if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
+ ast_verb(5, "Can't find dsp config file %s. Assuming default silencethreshold of %d.\n", CONFIG_FILE_NAME, DEFAULT_SILENCE_THRESHOLD);
+ thresholds[THRESHOLD_SILENCE] = DEFAULT_SILENCE_THRESHOLD;
return 0;
}
- if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED) {
+ if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
+ return 0;
+ }
+
+ if (cfg) {
const char *value;
value = ast_variable_retrieve(cfg, "default", "silencethreshold");
if (value && sscanf(value, "%30d", &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;
+ ast_verb(5, "%s: '%s' is not a valid silencethreshold value\n", CONFIG_FILE_NAME, value);
+ thresholds[THRESHOLD_SILENCE] = DEFAULT_SILENCE_THRESHOLD;
} else if (!value) {
- thresholds[THRESHOLD_SILENCE] = 256;
+ thresholds[THRESHOLD_SILENCE] = DEFAULT_SILENCE_THRESHOLD;
}
ast_config_destroy(cfg);
More information about the svn-commits
mailing list