[Freeswitch-branches] [commit] r3546 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference

Freeswitch SVN mikej at freeswitch.org
Tue Dec 5 16:29:14 EST 2006


Author: mikej
Date: Tue Dec  5 16:29:14 2006
New Revision: 3546

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

Log:
manually merge r3544-3545 from trunk

Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	Tue Dec  5 16:29:14 2006
@@ -252,7 +252,7 @@
 static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj);
 static void conference_loop_output(conference_member_t *member);
 static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
-static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin);
+static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel);
 static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin);
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
 static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
@@ -448,11 +448,11 @@
 
 
 		if (conference->enter_sound) {
-			conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN);
+			conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
 		}
 
 		if (conference->count == 1 && conference->alone_sound) {
-			conference_play_file(conference, conference->alone_sound, 0);
+			conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
 		}
 
 		if (conference->min && conference->count >= conference->min) {
@@ -521,10 +521,10 @@
 				switch_set_flag(conference, CFLAG_DESTRUCT);
 		} else { 
 			if (conference->exit_sound) {
-				conference_play_file(conference, conference->exit_sound, 0);
+				conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
 			}
 			if (conference->count == 1 && conference->alone_sound) {
-				conference_play_file(conference, conference->alone_sound, 0);
+				conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
 			} 
 		}
 
@@ -1550,11 +1550,14 @@
 }
 
 /* Play a file in the conference room */
-static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin)
+static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel)
 {
 	confernce_file_node_t *fnode, *nptr;
 	switch_memory_pool_t *pool;
 	uint32_t count;
+    char *expanded = NULL;
+    uint8_t frexp = 0;
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	switch_mutex_lock(conference->mutex);
 	switch_mutex_lock(conference->member_mutex);
@@ -1566,25 +1569,36 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (channel) {
+		if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
+			file = expanded;
+			frexp = 1;
+		}
+	}
+
+
 #ifdef WIN32
 	if (*(file +1) != ':' && *file != '/') {
 #else
 	if (*file != '/') {
 #endif
-		return conference_say(conference, file, leadin);
+		status = conference_say(conference, file, leadin);
+		goto done;
 	}
 
 	/* Setup a memory pool to use. */
 	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
-		return SWITCH_STATUS_MEMERR;
+		status = SWITCH_STATUS_MEMERR;
+		goto done;
 	}
 
 	/* Create a node object*/
 	if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
 		switch_core_destroy_memory_pool(&pool);
-		return SWITCH_STATUS_MEMERR;
+		status = SWITCH_STATUS_MEMERR;
+		goto done;
 	}
 
 	fnode->type = NODE_TYPE_FILE;
@@ -1596,7 +1610,8 @@
 							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
 							  pool) != SWITCH_STATUS_SUCCESS) {
 		switch_core_destroy_memory_pool(&pool);
-		return SWITCH_STATUS_NOTFOUND;
+		status = SWITCH_STATUS_NOTFOUND;
+		goto done;
 	}
 
 	fnode->pool = pool;
@@ -1612,7 +1627,13 @@
 	}
 	switch_mutex_unlock(conference->mutex);
 
-	return SWITCH_STATUS_SUCCESS;
+    done:
+
+    if (frexp) {
+        switch_safe_free(expanded);
+    }
+
+	return status;
 }
 
 /* Play a file in the conference room to a member */
@@ -2166,7 +2187,7 @@
 	switch_event_t *event;
 
 	if (argc == 3) {
-		if (conference_play_file(conference, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
+		if (conference_play_file(conference, argv[2], 0, NULL) == 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", conference->name);



More information about the Freeswitch-branches mailing list