[Freeswitch-svn] [commit] r13440 - freeswitch/trunk/src/mod/applications/mod_conference

FreeSWITCH SVN anthm at freeswitch.org
Tue May 26 15:48:43 PDT 2009


Author: anthm
Date: Tue May 26 17:48:43 2009
New Revision: 13440

Log:
update

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Tue May 26 17:48:43 2009
@@ -148,7 +148,8 @@
 	MFLAG_RESTART = (1 << 12),
 	MFLAG_MINTWO = (1 << 13),
 	MFLAG_MUTE_DETECT = (1 << 14),
-	MFLAG_DIST_DTMF = (1 << 15)
+	MFLAG_DIST_DTMF = (1 << 15),
+	MFLAG_MOD = (1 << 16)
 } member_flag_t;
 
 typedef enum {
@@ -159,6 +160,7 @@
 	CFLAG_LOCKED = (1 << 4),
 	CFLAG_ANSWERED = (1 << 5),
 	CFLAG_BRIDGE_TO = (1 << 6),
+	CFLAG_WAIT_MOD = (1 << 7)
 } conf_flag_t;
 
 typedef enum {
@@ -621,7 +623,11 @@
 			switch_event_fire(&event);
 		}
 
-		if (conference->count > 1) {
+		if (switch_test_flag(conference, CFLAG_WAIT_MOD) && switch_test_flag(member, MFLAG_MOD)) {
+			switch_clear_flag(conference, CFLAG_WAIT_MOD);
+		}
+
+		if (conference->count > 1 && (!switch_test_flag(conference, CFLAG_WAIT_MOD))) {
 			if (conference->moh_sound) {
 				/* stop MoH if any */
 				conference_stop_file(conference, FILE_STOP_ASYNC);
@@ -1853,7 +1859,8 @@
 		}
 
 		/* skip frames that are not actual media or when we are muted or silent */
-		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) && 
+			!switch_test_flag(member->conference, CFLAG_WAIT_MOD)) {
 			switch_audio_resampler_t *read_resampler = member->read_resampler;
 			void *data;
 			uint32_t datalen;
@@ -4578,6 +4585,8 @@
 				*f |= MFLAG_MUTE_DETECT;
 			} else if (!strcasecmp(argv[i], "dist-dtmf")) {
 				*f |= MFLAG_DIST_DTMF;
+			} else if (!strcasecmp(argv[i], "moderator")) {
+				*f |= MFLAG_MOD;
 			} else if (!strcasecmp(argv[i], "endconf")) {
 				*f |= MFLAG_ENDCONF;
 			} else if (!strcasecmp(argv[i], "mintwo")) {
@@ -4589,6 +4598,35 @@
 	}
 }
 
+
+
+static void set_cflags(char *flags, member_flag_t *f)
+{
+	if (flags) {
+		char *dup = strdup(flags);
+		char *p;
+		char *argv[10] = { 0 };
+		int i, argc = 0;
+
+		for(p = dup; p && *p; p++) {
+			if (*p == ',') {
+				*p = '|';
+			}
+		}
+
+		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+
+		for(i = 0; i < argc && argv[i]; i++) {
+			if (!strcasecmp(argv[i], "wait-mod")) {
+				*f |= CFLAG_WAIT_MOD;
+			}
+		}
+
+		free(dup);
+	}
+}
+
+
 static void clear_eflags(char *events, uint32_t *f)
 {
 	char buf[512] = "";
@@ -5483,6 +5521,7 @@
 	char *caller_id_number = NULL;
 	char *caller_controls = NULL;
 	char *member_flags = NULL;
+	char *conference_flags = NULL;
 	char *perpetual_sound = NULL;
 	char *moh_sound = NULL;
 	uint32_t max_members = 0;
@@ -5570,6 +5609,8 @@
 			is_unlocked_sound = val;
 		} else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
 			member_flags = val;
+		} else if (!strcasecmp(var, "conference-flags") && !switch_strlen_zero(val)) {
+			conference_flags = val;
 		} else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
 			kicked_sound = val;
 		} else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
@@ -5691,6 +5732,10 @@
 		set_mflags(member_flags, &conference->mflags);
 	}
 
+	if (conference_flags) {
+		set_cflags(conference_flags, &conference->flags);
+	}
+
 	if (sound_prefix) {
 		conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
 	}



More information about the Freeswitch-svn mailing list