From 46064642ba82ece5f06566af7c82fe2d81565642 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Mon, 28 Jun 2010 08:37:11 -0500
Subject: [PATCH] update

---
 src/mod/applications/mod_conference/mod_conference.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c
index 883d7e088a..74a662811a 100644
--- a/src/mod/applications/mod_conference/mod_conference.c
+++ b/src/mod/applications/mod_conference/mod_conference.c
@@ -1951,7 +1951,11 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
 			goto do_continue;
 		}
 
-			/* Check for input volume adjustments */
+		/* Check for input volume adjustments */
+		if (!switch_test_flag(member->conference, CFLAG_GAIN_CONTROL)) {
+			member->agc_volume_in_level = 0;
+		}
+
 		if (switch_test_flag(member->conference, CFLAG_GAIN_CONTROL) && member->agc_volume_in_level) {
 			switch_change_sln_volume(read_frame->data, read_frame->datalen / 2, member->agc_volume_in_level);
 		} else if (member->volume_in_level) {
@@ -2004,11 +2008,11 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
 					member->agc_concur = 0;
 				}
 				
-				if (member->agc_concur >= one_sec / 2) {
+				if (member->agc_concur >= one_sec) {
 					if (diff > 200) {
 						member->agc_volume_in_level++;
 						
-						if (diff > 200) {
+						if (diff > 400) {
 							member->agc_volume_in_level++;
 						}
 
@@ -3400,7 +3404,7 @@ static switch_status_t conf_api_sub_agc_on(conference_obj_t *conference, switch_
 static switch_status_t conf_api_sub_agc_off(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
 	switch_clear_flag(conference, CFLAG_GAIN_CONTROL);
-
+	
 	if (stream) {
 		stream->write_function(stream, "OK AGC DISABLED\n");
 	}