[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311663 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 24 13:15:41 CDT 2011


Author: dvossel
Date: Thu Mar 24 13:15:34 2011
New Revision: 311663

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311663
Log:
Introduction of silence/talking detection dsp options

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311663&r1=311662&r2=311663
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Thu Mar 24 13:15:34 2011
@@ -212,9 +212,6 @@
 /* Number of buckets our conference bridges container can have */
 #define CONFERENCE_BRIDGE_BUCKETS 53
 
-#define DEFAULT_TALKING_THRESHOLD 160
-#define DEFAULT_SILENCE_THRESHOLD 2500
-
 /*! \brief Container to hold all conference bridges in progress */
 static struct ao2_container *conference_bridges;
 
@@ -1117,6 +1114,7 @@
 	if (args.argc > 2 && !ast_strlen_zero(args.u_profile_name)) {
 		u_profile_name = args.u_profile_name;
 	}
+
 	conf_find_user_profile(chan, u_profile_name, &conference_bridge_user.u_profile);
 	quiet = ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_QUIET);
 
@@ -1148,6 +1146,14 @@
 	/* Set if DTMF should pass through for this user or not */
 	if (ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_DTMF_PASS)) {
 		conference_bridge_user.features.dtmf_passthrough = 1;
+	}
+
+	/* Set dsp threshold values if present */
+	if (conference_bridge_user.u_profile.talking_threshold) {
+		conference_bridge_user.tech_args.talking_threshold = conference_bridge_user.u_profile.talking_threshold;
+	}
+	if (conference_bridge_user.u_profile.silence_threshold) {
+		conference_bridge_user.tech_args.silence_threshold = conference_bridge_user.u_profile.silence_threshold;
 	}
 
 	/* Set a talker indicate call back if talking detection is requested */

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=311663&r1=311662&r2=311663
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Thu Mar 24 13:15:34 2011
@@ -213,7 +213,15 @@
 		u_profile->flags = ast_true(value) ?
 			u_profile->flags | USER_OPT_DENOISE :
 			u_profile->flags & ~USER_OPT_DENOISE;
-	} else if (!strcasecmp(name, "drop_silence")) {
+	} else if (!strcasecmp(name, "dsp_talking_threshold")) {
+		if (sscanf(value, "%30u", &u_profile->talking_threshold) != 1) {
+			return -1;
+		}
+	} else if (!strcasecmp(name, "dsp_silence_threshold")) {
+		if (sscanf(value, "%30u", &u_profile->silence_threshold) != 1) {
+			return -1;
+		}
+	} else if (!strcasecmp(name, "dsp_drop_silence")) {
 		u_profile->flags = ast_true(value) ?
 			u_profile->flags | USER_OPT_DROP_SILENCE :
 			u_profile->flags & ~USER_OPT_DROP_SILENCE;
@@ -505,6 +513,8 @@
 	/* set defaults */
 	u_profile->flags = 0;
 	u_profile->announce_user_count_all_after = 0;
+	u_profile->silence_threshold = DEFAULT_SILENCE_THRESHOLD;
+	u_profile->talking_threshold = DEFAULT_TALKING_THRESHOLD;
 	memset(u_profile->pin, 0, sizeof(u_profile->pin));
 	memset(u_profile->moh_class, 0, sizeof(u_profile->moh_class));
 	for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
@@ -765,51 +775,55 @@
 	}
 
 	ast_cli(a->fd,"--------------------------------------------\n");
-	ast_cli(a->fd,"Name:                %s\n",
+	ast_cli(a->fd,"Name:                    %s\n",
 		u_profile.name);
-	ast_cli(a->fd,"Admin:               %s\n",
+	ast_cli(a->fd,"Admin:                   %s\n",
 		u_profile.flags & USER_OPT_ADMIN ?
 		"true" : "false");
-	ast_cli(a->fd,"Marked User:         %s\n",
+	ast_cli(a->fd,"Marked User:             %s\n",
 		u_profile.flags & USER_OPT_MARKEDUSER ?
 		"true" : "false");
-	ast_cli(a->fd,"Start Muted:         %s\n",
+	ast_cli(a->fd,"Start Muted:             %s\n",
 		u_profile.flags & USER_OPT_STARTMUTED?
 		"true" : "false");
-	ast_cli(a->fd,"MOH When Empty:      %s\n",
+	ast_cli(a->fd,"MOH When Empty:          %s\n",
 		u_profile.flags & USER_OPT_MUSICONHOLD ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"MOH Class:           %s\n",
+	ast_cli(a->fd,"MOH Class:               %s\n",
 		ast_strlen_zero(u_profile.moh_class) ?
 		"default" : u_profile.moh_class);
-	ast_cli(a->fd,"Quiet:               %s\n",
+	ast_cli(a->fd,"Quiet:                   %s\n",
 		u_profile.flags & USER_OPT_QUIET ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Wait Marked:         %s\n",
+	ast_cli(a->fd,"Wait Marked:             %s\n",
 		u_profile.flags & USER_OPT_WAITMARKED ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"END Marked:          %s\n",
+	ast_cli(a->fd,"END Marked:              %s\n",
 		u_profile.flags & USER_OPT_ENDMARKED ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Drop_silence:        %s\n",
+	ast_cli(a->fd,"Drop_silence:            %s\n",
 		u_profile.flags & USER_OPT_DROP_SILENCE ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Denoise:             %s\n",
+	ast_cli(a->fd,"Silence Threshold:       %dms\n",
+		u_profile.silence_threshold);
+	ast_cli(a->fd,"Talking Threshold:       %dms\n",
+		u_profile.talking_threshold);
+	ast_cli(a->fd,"Denoise:                 %s\n",
 		u_profile.flags & USER_OPT_DENOISE ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Talk Detect Events:  %s\n",
+	ast_cli(a->fd,"Talk Detect Events:      %s\n",
 		u_profile.flags & USER_OPT_TALKER_DETECT ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"DTMF Pass Through:   %s\n",
+	ast_cli(a->fd,"DTMF Pass Through:       %s\n",
 		u_profile.flags & USER_OPT_DTMF_PASS ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"PIN:                 %s\n",
+	ast_cli(a->fd,"PIN:                     %s\n",
 		ast_strlen_zero(u_profile.pin) ?
 		"None" : u_profile.pin);
-	ast_cli(a->fd,"Announce User Count: %s\n",
+	ast_cli(a->fd,"Announce User Count:     %s\n",
 		u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Announce join/leave: %s\n",
+	ast_cli(a->fd,"Announce join/leave:     %s\n",
 		u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE ?
 		"enabled" : "disabled");
 	ast_cli(a->fd,"Announce User Count all: %s\n",

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=311663&r1=311662&r2=311663
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Thu Mar 24 13:15:34 2011
@@ -36,6 +36,9 @@
 
 #define DEFAULT_USER_PROFILE "default_user"
 #define DEFAULT_BRIDGE_PROFILE "default_bridge"
+
+#define DEFAULT_TALKING_THRESHOLD 160
+#define DEFAULT_SILENCE_THRESHOLD 2500
 
 enum user_profile_flags {
 	USER_OPT_ADMIN =        (1 << 0), /*!< Set if the caller is an administrator */
@@ -118,6 +121,10 @@
 	char moh_class[128];
 	unsigned int flags;
 	unsigned int announce_user_count_all_after;
+	/*! The time in ms of talking before a user is considered to be talking by the dsp. */
+	unsigned int talking_threshold;
+	/*! The time in ms of silence before a user is considered to be silent by the dsp. */
+	unsigned int silence_threshold;
 	int delme;
 };
 

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=311663&r1=311662&r2=311663
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Thu Mar 24 13:15:34 2011
@@ -38,11 +38,71 @@
                    ; joining the conference. Off by default.
 ;end_marked=yes ; This option will kick every user with this option set in their
                 ; user profile after the last Marked user exists the conference.
-;drop_silence=yes  ; This option drops what Asterisk detects as silence from
-                   ; entering into the bridge.  Enabling this option will drastically
-                   ; improve performance and help remove the buildup of background
-                   ; noise from the conference. Highly recommended for large conferences
-                   ; due to its performance enhancements.
+
+;dsp_drop_silence=yes  ; This option drops what Asterisk detects as silence from
+                       ; entering into the bridge.  Enabling this option will drastically
+                       ; improve performance and help remove the buildup of background
+                       ; noise from the conference. Highly recommended for large conferences
+                       ; due to its performance enhancements.
+
+;dsp_talking_threshold=128  ; The time in milliseconds of sound above what the dsp has
+                            ; established as base line silence for a user before a user
+                            ; is considered to be talking.  This value affects several
+                            ; operations and should not be changed unless the impact on
+                            ; call quality is fully understood.
+                            ;
+                            ; What this value affects internally:
+                            ;
+                            ; 1. Audio is only mixed out of a user's incoming audio stream
+                            ;    if talking is detected.  If this value is set too
+                            ;    loose the user will hear themselves briefly each
+                            ;    time they begin talking until the dsp has time to
+                            ;    establish that they are in fact talking.
+                            ; 2. When talk detection AMI events are enabled, this value 
+                            ;    determines when talking has begun which results in
+                            ;    an AMI event to fire.  If this value is set too tight
+                            ;    AMI events may be falsely triggered by variants in
+                            ;    room noise.
+                            ; 3. The drop_silence option depends on this value to determine
+                            ;    when the user's audio should be mixed into the bridge
+                            ;    after periods of silence.  If this value is too loose
+                            ;    the beginning of a user's speech will get cut off as they
+                            ;    transition from silence to talking.
+                            ;
+                            ; By default this value is 160 ms. Valid values are 1 through 2^31
+
+;dsp_silence_threshold=2000 ; The time in milliseconds of sound falling within the what
+                            ; the dsp has established as baseline silence before a user
+                            ; is considered be silent.  This value affects several
+                            ; operations and should not be changed unless the impact
+                            ; on call quality is fully understood.
+                            ;
+                            ; What this value affects internally:
+                            ;
+                            ; 1. When talk detection AMI events are enabled, this value
+                            ;    determines when the user has stopped talking after a
+                            ;    period of talking.  If this value is set too low
+                            ;    AMI events indicating the user has stopped talking
+                            ;    may get falsely sent out when the user briefly pauses
+                            ;    during mid sentence.
+                            ; 2. The drop_silence option depends on this value to
+                            ;    determine when the user's audio should begin to be
+                            ;    dropped from the conference bridge after the user
+                            ;    stops talking.  If this value is set too low the user's
+                            ;    audio stream may sound choppy to the other participants.
+                            ;    This is caused by the user transitioning constantly from
+                            ;    silence to talking during mid sentence.
+                            ;
+                            ; The best way to approach this option is to set it slightly above
+                            ; the maximum amount of ms of silence a user may generate during
+                            ; natural speech.
+                            ;
+                            ; By default this value is 2500ms. Valid values are 1 through 2^31
+
+;talk_detection_events=yes ; This option sets whether or not notifications of when a user
+                           ; begins and ends talking should be sent out as events over AMI.
+                           ; By default this option is off.
+
 ;denoise=yes ; Sets whether or not a denoise filter should be applied
              ; to the audio before mixing or not.  Off by default. Requires
              ; codec_speex to be built and installed.  Do not confuse this option
@@ -56,9 +116,6 @@
                          ; name when entering the conference.  After the name is
                          ; recorded, it will be played as the user enters and exists
                          ; the conference. This option is off by default.
-;talk_detection_events=yes ; This option sets whether or not notifications of when a user
-                           ; begins and ends talking should be sent out as events over AMI.
-                           ; By default this option is off.
 ;dtmf_passthrough=yes  ; Sets whether or not DTMF should pass through the conference.
                        ; This option is off by default.
 




More information about the asterisk-commits mailing list