[Freeswitch-svn] [commit] r11401 - in freeswitch/branches/1.0/src: . include mod/applications/mod_conference

FreeSWITCH SVN mikej at freeswitch.org
Thu Jan 22 13:45:54 PST 2009


Author: mikej
Date: Thu Jan 22 15:45:53 2009
New Revision: 11401

Log:
mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077)

Modified:
   freeswitch/branches/1.0/src/include/switch_channel.h
   freeswitch/branches/1.0/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/1.0/src/switch_channel.c

Modified: freeswitch/branches/1.0/src/include/switch_channel.h
==============================================================================
--- freeswitch/branches/1.0/src/include/switch_channel.h	(original)
+++ freeswitch/branches/1.0/src/include/switch_channel.h	Thu Jan 22 15:45:53 2009
@@ -472,6 +472,9 @@
 */
 SWITCH_DECLARE(void) switch_channel_event_set_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event);
 
+SWITCH_DECLARE(void) switch_channel_event_set_basic_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event);
+SWITCH_DECLARE(void) switch_channel_event_set_extended_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event);
+
 /*!
   \brief Expand varaibles in a string based on the variables in a paticular channel
   \param channel channel to expand the variables from

Modified: freeswitch/branches/1.0/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/1.0/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/1.0/src/mod/applications/mod_conference/mod_conference.c	Thu Jan 22 15:45:53 2009
@@ -264,6 +264,7 @@
 	int comfort_noise_level;
 	int video_running;
 	uint32_t eflags;
+	uint32_t verbose_events;
 } conference_obj_t;
 
 /* Relationship with another member */
@@ -308,6 +309,7 @@
 	switch_ivr_digit_stream_t *digit_stream;
 	switch_speech_handle_t lsh;
 	switch_speech_handle_t *sh;
+	uint32_t verbose_events;
 	struct conference_member *next;
 };
 
@@ -401,15 +403,21 @@
 	if (!member)
 		return status;
 
-	if (member->session) {
-		switch_channel_t *channel = switch_core_session_get_channel(member->session);
-		switch_channel_event_set_data(channel, event);
-	}
-
 	if (member->conference) {
 		status = conference_add_event_data(member->conference, event);
 	}
 
+	if (member->session) {
+		switch_channel_t *channel = switch_core_session_get_channel(member->session);
+		
+		if (member->verbose_events) {
+			switch_channel_event_set_data(channel, event);
+		} else {
+			switch_channel_event_set_basic_data(channel, event);
+		}
+		
+	}
+
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
 
 	return status;
@@ -572,6 +580,7 @@
 	member->conference = conference;
 	member->next = conference->members;
 	member->energy_level = conference->energy_level;
+	member->verbose_events = conference->verbose_events;
 	conference->members = member;
 	switch_set_flag(member, MFLAG_INTREE);
 	switch_mutex_unlock(conference->member_mutex);
@@ -5018,6 +5027,7 @@
 	switch_status_t status;
 	int comfort_noise_level = 0;
 	char *suppress_events = NULL;
+	char *verbose_events = NULL;
 	char *auto_record = NULL;
 
 	/* Validate the conference name */
@@ -5137,6 +5147,8 @@
 			}
 		} else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) {
 			suppress_events = val;
+		} else if (!strcasecmp(var, "verbose-events") && !switch_strlen_zero(val)) {
+			verbose_events = val;
 		} else if (!strcasecmp(var, "auto-record") && !switch_strlen_zero(val)) {
 			auto_record = val;
 		}
@@ -5296,6 +5308,10 @@
 	if (!switch_strlen_zero(auto_record)) {
 		conference->auto_record = switch_core_strdup(conference->pool, auto_record);
 	}
+
+	if (!switch_strlen_zero(verbose_events) && switch_true(verbose_events)) {
+		conference->verbose_events = 1;
+	}
 	
 	/* caller control configuration chores */
 	if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/1.0/src/switch_channel.c
==============================================================================
--- freeswitch/branches/1.0/src/switch_channel.c	(original)
+++ freeswitch/branches/1.0/src/switch_channel.c	Thu Jan 22 15:45:53 2009
@@ -1140,13 +1140,12 @@
 	return channel->state;
 }
 
-SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, switch_event_t *event)
+SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *channel, switch_event_t *event)
 {
 	switch_caller_profile_t *caller_profile, *originator_caller_profile = NULL, *originatee_caller_profile = NULL;
-	switch_event_header_t *hi;
 	switch_codec_t *codec;
 	char state_num[25];
-	int x;
+
 	switch_mutex_lock(channel->profile_mutex);
 
 	if ((caller_profile = switch_channel_get_caller_profile(channel))) {
@@ -1178,7 +1177,7 @@
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", switch_str_nil(codec->implementation->iananame));
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
 	}
-	
+
 	/* Index Caller's Profile */
 	if (caller_profile) {
 		switch_caller_profile_event_set_data(caller_profile, "Caller", event);
@@ -1199,7 +1198,16 @@
 		}
 	}
 
+	switch_mutex_unlock(channel->profile_mutex);
+}
+
+SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *channel, switch_event_t *event)
+{
+	switch_event_header_t *hi;
+	int x;
 
+	switch_mutex_lock(channel->profile_mutex);
+	
 	if (switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) || 
 		event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE ||
 		event->event_id == SWITCH_EVENT_CHANNEL_UUID ||
@@ -1235,6 +1243,17 @@
 	switch_mutex_unlock(channel->profile_mutex);
 }
 
+
+SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, switch_event_t *event)
+{
+	switch_mutex_lock(channel->profile_mutex);
+	switch_channel_event_set_basic_data(channel, event);
+	switch_channel_event_set_extended_data(channel, event);
+	switch_mutex_unlock(channel->profile_mutex);
+}
+
+
+
 SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
 {
 	char *uuid = NULL;



More information about the Freeswitch-svn mailing list