[Freeswitch-branches] [commit] r3677 - in freeswitch/branches/knhor/trunk: . src/mod/applications/mod_conference

Freeswitch SVN knhor at freeswitch.org
Sat Dec 16 17:04:02 EST 2006


Author: knhor
Date: Sat Dec 16 17:04:00 2006
New Revision: 3677

Modified:
   freeswitch/branches/knhor/trunk/   (props changed)
   freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c

Log:
 merged 3646 from trunk and hand merged 3643

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	Sat Dec 16 17:04:00 2006
@@ -1236,7 +1236,7 @@
 		if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			/* test to see if outbound channel has answered */
 			if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound conference channel answered, setting CFLAG_ANSWERED");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound conference channel answered, setting CFLAG_ANSWERED\n");
 				switch_set_flag(member->conference, CFLAG_ANSWERED);
 			}
 		} else {
@@ -2461,91 +2461,95 @@
 	int err = 0;
 
 	if (argc > 3) {
-		conference_member_t *member = NULL;
-		uint32_t id = atoi(argv[2]);
-		conference_obj_t *new_conference = NULL;
-		switch_channel_t *channel;
-		switch_event_t *event;
-		char *profile_name;
-		switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+		int x;
 
-		if (!(member = conference_member_get(conference, id))) {								
-			stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
-			goto done;
-		}
+		for (x=3; x<argc; x++) {
+			conference_member_t *member = NULL;
+			uint32_t id = atoi(argv[x]);
+			conference_obj_t *new_conference = NULL;
+			switch_channel_t *channel;
+			switch_event_t *event;
+			char *profile_name;
+			switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
 
-		channel = switch_core_session_get_channel(member->session);
-
-		/* build a new conference if it doesn't exist */
-		if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[3]))) {
-			switch_memory_pool_t *pool;
-			char *conf_name;
-			conf_xml_cfg_t xml_cfg;
-
-			/* 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");
-				goto done;
+			if (!(member = conference_member_get(conference, id))) {								
+				stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
+				continue;
 			}
 
-			conf_name = switch_core_strdup(pool, argv[3]);
+			channel = switch_core_session_get_channel(member->session);
 
-			if ((profile_name = strchr(conf_name, '@'))) {
-				*profile_name++ = '\0';
+			/* build a new conference if it doesn't exist */
+			if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
+				switch_memory_pool_t *pool;
+				char *conf_name;
+				conf_xml_cfg_t xml_cfg;
 
-				/* Open the config from the xml registry  */
-				if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+				/* 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");
 					goto done;
 				}
 
-				if ((profiles = switch_xml_child(cfg, "profiles"))) {
-					xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
-				}
-				xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+				conf_name = switch_core_strdup(pool, argv[2]);
+
+				if ((profile_name = strchr(conf_name, '@'))) {
+					*profile_name++ = '\0';
+
+					/* Open the config from the xml registry  */
+					if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+						goto done;
+					}
+
+					if ((profiles = switch_xml_child(cfg, "profiles"))) {
+						xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+					}
+					xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
 #ifdef OPTION_IVR_MENU_SUPPORT
-				xml_cfg.menus = switch_xml_child(cfg, "menus");
+					xml_cfg.menus = switch_xml_child(cfg, "menus");
 #endif
-			} 
+				} 
 
-			/* Release the config registry handle */
-			if (cxml) {
-				switch_xml_free(cxml);
-				cxml = NULL;
-			}
+				/* Release the config registry handle */
+				if (cxml) {
+					switch_xml_free(cxml);
+					cxml = NULL;
+				}
 
-			/* Create the conference object. */
-			new_conference = conference_new(conf_name, xml_cfg, pool);
+				/* Create the conference object. */
+				new_conference = conference_new(conf_name, xml_cfg, pool);
 
-			if (!new_conference) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-				goto done;
-			}
+				if (!new_conference) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+					goto done;
+				}
 
-			/* Set the minimum number of members (once you go above it you cannot go below it) */
-			new_conference->min = 1;
+				/* Set the minimum number of members (once you go above it you cannot go below it) */
+				new_conference->min = 1;
 
-			/* Indicate the conference is dynamic */
-			switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+				/* Indicate the conference is dynamic */
+				switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
 
-			/* Start the conference thread for this conference */
-			launch_conference_thread(new_conference);
-		}
+				/* Start the conference thread for this conference */
+				launch_conference_thread(new_conference);
+			}
 
-		/* move the member from the old conference to the new one */
-		conference_del_member(member->last_conference, member);
-		conference_add_member(new_conference, member);
+			/* move the member from the old conference to the new one */
+			conference_del_member(member->last_conference, member);
+			conference_add_member(new_conference, member);
 
-		stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[3]);
+			stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[2]);
 
-		/* 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);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
-			switch_event_fire(&event);
+			/* 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);
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+				switch_event_fire(&event);
+			}
 		}
 	} else {
 		err = 1;
@@ -2609,7 +2613,7 @@
 	{"lock",	&conf_api_sub_lock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> lock"},
 	{"unlock",	&conf_api_sub_unlock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> unlock"},
 	{"dial",	&conf_api_sub_dial,		CONF_API_SUB_ARGS_SPLIT,	"<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"transfer",	&conf_api_sub_transfer,		CONF_API_SUB_ARGS_SPLIT,	"<confname> transfer <member_id> <conference_name>"},
+	{"transfer",	&conf_api_sub_transfer,		CONF_API_SUB_ARGS_SPLIT,	"<confname> transfer <conference_name> <member id> [...<member id>]"},
 	{"record",	&conf_api_sub_record,		CONF_API_SUB_ARGS_SPLIT,	"<confname> record <filename>"},
 	{"norecord",	&conf_api_sub_norecord,		CONF_API_SUB_ARGS_SPLIT,	"<confname> norecord <[filename|all]>"},
 };
@@ -2862,7 +2866,7 @@
 			goto done;
 		}
 		/* add them to the conference */
-		if (flags) {
+		if (flags && strcasecmp(flags, "none")) {
 			snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
 			switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
 		} else {



More information about the Freeswitch-branches mailing list