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

Freeswitch SVN mikej at freeswitch.org
Thu Oct 25 22:42:18 EDT 2007


Author: mikej
Date: Thu Oct 25 22:42:18 2007
New Revision: 6062

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

Log:
add conference_add_event_member_data and conference_add_event_data functions to add conference and member headers to events.  Includes adding profile name to conference dtmf (and all the other events) fix for MODAPP-31

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	Thu Oct 25 22:42:18 2007
@@ -334,6 +334,31 @@
 static switch_status_t conf_api_sub_unmute(conference_member_t * member, switch_stream_handle_t *stream, void *data);
 static switch_status_t conf_api_sub_deaf(conference_member_t * member, switch_stream_handle_t *stream, void *data);
 static switch_status_t conf_api_sub_undeaf(conference_member_t * member, switch_stream_handle_t *stream, void *data);
+static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event);
+static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event);
+
+static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Profile-Name", "%s", conference->profile_name);
+
+	return status;
+}
+static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event)
+{
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_channel_t *channel = switch_core_session_get_channel(member->session);
+	switch_channel_event_set_data(channel, event);
+
+	status = conference_add_event_data(member->conference, event);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+
+	return status;
+}
+
 
 /* Return a Distinct ID # */
 static uint32_t next_member_id(void)
@@ -553,13 +578,8 @@
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
 			switch_event_fire(&event);
 		}
 	}
@@ -658,13 +678,8 @@
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
 			switch_event_fire(&event);
 		}
 	}
@@ -1062,11 +1077,7 @@
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 			switch_event_fire(&event);
@@ -1090,11 +1101,7 @@
 		member->energy_level = member->conference->energy_level;
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 			switch_event_fire(&event);
@@ -1120,11 +1127,7 @@
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
 			switch_event_fire(&event);
@@ -1151,11 +1154,7 @@
 
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 			switch_event_fire(&event);
@@ -1180,11 +1179,7 @@
 
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 			switch_event_fire(&event);
@@ -1210,11 +1205,7 @@
 		switch_normalize_volume(member->volume_out_level);
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
 			switch_event_fire(&event);
@@ -1240,11 +1231,7 @@
 
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 			switch_event_fire(&event);
@@ -1270,11 +1257,7 @@
 		member->volume_in_level = 0;
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 			switch_event_fire(&event);
@@ -1301,11 +1284,7 @@
 
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
 			switch_event_fire(&event);
@@ -1324,11 +1303,7 @@
 {
 	switch_event_t *event;
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-		switch_channel_t *channel = switch_core_session_get_channel(member->session);
-
-		switch_channel_event_set_data(channel, event);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+		conference_add_event_member_data(member, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "dtmf");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Key", "%s", action->binded_dtmf);
 		switch_event_fire(&event);
@@ -1407,9 +1382,7 @@
 						talking = 1;
 						switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 						if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-							switch_channel_event_set_data(channel, event);
-							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+							conference_add_event_member_data(member, event);
 							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
 							switch_event_fire(&event);
 						}
@@ -1426,9 +1399,7 @@
 						talking = 0;
 
 						if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-							switch_channel_event_set_data(channel, event);
-							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+							conference_add_event_member_data(member, event);
 							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "stop-talking");
 							switch_event_fire(&event);
 						}
@@ -2502,11 +2473,7 @@
 			stream->write_function(stream, "OK mute %u\n", member->id);
 		}
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
 			switch_event_fire(&event);
 		}
@@ -2537,11 +2504,7 @@
 			conference_member_say(member, msg, 0);
 		}
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
 			switch_event_fire(&event);
 		}
@@ -2564,11 +2527,7 @@
 			stream->write_function(stream, "OK deaf %u\n", member->id);
 		}
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
 			switch_event_fire(&event);
 		}
@@ -2591,11 +2550,7 @@
 			stream->write_function(stream, "OK undeaf %u\n", member->id);
 		}
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
 			switch_event_fire(&event);
 		}
@@ -2624,11 +2579,7 @@
 		}
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_t *channel = switch_core_session_get_channel(member->session);
-			switch_channel_event_set_data(channel, event);
-
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
 			switch_event_fire(&event);
 		}
@@ -2667,11 +2618,7 @@
 	}
 
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-		switch_channel_t *channel = switch_core_session_get_channel(member->session);
-		switch_channel_event_set_data(channel, event);
-
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+		conference_add_event_member_data(member, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "dtmf-member");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Digits", "%s", dtmf);
 		switch_event_fire(&event);
@@ -2699,11 +2646,7 @@
 
 		if (data) {
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
-
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+				conference_add_event_member_data(member, event);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
 
@@ -2736,11 +2679,7 @@
 		}
 		if (data) {
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
-
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+				conference_add_event_member_data(member, event);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
 
@@ -2774,11 +2713,7 @@
 
 		if (data) {
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_t *channel = switch_core_session_get_channel(member->session);
-				switch_channel_event_set_data(channel, event);
-
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+				conference_add_event_member_data(member, event);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
 
@@ -2866,7 +2801,7 @@
 		if (conference_play_file(conference, argv[2], 0, NULL, async) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+				conference_add_event_data(conference, event);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", "%s", argv[2]);
 				switch_event_fire(&event);
@@ -2883,8 +2818,7 @@
 			if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
 				stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
-					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+					conference_add_event_member_data(member, event);
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", "%s", argv[2]);
 					switch_event_fire(&event);
@@ -2915,7 +2849,7 @@
 
 		stream->write_function(stream, "(say) OK\n");
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+			conference_add_event_data(conference, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
 			switch_event_fire(&event);
@@ -2975,9 +2909,8 @@
 
 		stream->write_function(stream, "(saymember) OK\n");
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+			conference_add_event_member_data(member, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
 			switch_event_fire(&event);
 		}
@@ -3112,7 +3045,7 @@
 	switch_set_flag_locked(conference, CFLAG_LOCKED);
 	stream->write_function(stream, "OK %s locked\n", argv[0]);
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+		conference_add_event_data(conference, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
 		switch_event_fire(&event);
 	}
@@ -3134,7 +3067,7 @@
 	switch_clear_flag_locked(conference, CFLAG_LOCKED);
 	stream->write_function(stream, "OK %s unlocked\n", argv[0]);
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
+		conference_add_event_data(conference, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
 		switch_event_fire(&event);
 	}
@@ -3295,8 +3228,7 @@
 			
 			/* tell them what happened */
 			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-				switch_channel_event_set_data(channel, event);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+				conference_add_event_member_data(member, event);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", "%s", conference->name);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", "%s", argv[3]);
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
@@ -3780,7 +3712,7 @@
 						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
 
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", call->conference->name);
+			conference_add_event_data(call->conference, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "bgdial-result");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Result", "%s", switch_channel_cause2str(cause));
 			switch_event_fire(&event);
@@ -4753,6 +4685,7 @@
 
 	/* initialize the conference object with settings from the specified profile */
 	conference->pool = pool;
+	conference->profile_name = switch_core_strdup(conference->pool, switch_xml_attr_soft(cfg.profile, "name"));
 	conference->timer_name = switch_core_strdup(conference->pool, timer_name);
 	conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
 	conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);



More information about the Freeswitch-svn mailing list