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

Freeswitch SVN knhor at freeswitch.org
Fri Nov 24 14:34:39 EST 2006


Author: knhor
Date: Fri Nov 24 14:34:38 2006
New Revision: 3454

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

Log:
change caller control mute, to only be mute, not deaf and mute. add the ability to operate on the last (oldest) member of the conference.

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	Fri Nov 24 14:34:38 2006
@@ -795,7 +795,7 @@
 {
 	if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
 		conf_api_sub_mute(member, NULL, NULL);
-		conf_api_sub_deaf(member, NULL, NULL);
+//		conf_api_sub_deaf(member, NULL, NULL);
 	} else {
 		conf_api_sub_unmute(member, NULL, NULL);
 	}
@@ -2373,18 +2373,18 @@
 /* API Interface Function sub-commands */
 static api_command_t conf_api_sub_commands[] = {
 	{"list",	&conf_api_sub_list,		0, "<confname> list [delim <string>]"},
-	{"energy",	&conf_api_sub_energy,		1, "<confname> energy <member_id|all> [<newval>]"},
-	{"volume in",	&conf_api_sub_volume_in,	1, "<confname> volume_in <member_id|all> [<newval>]"},
-	{"volume out",	&conf_api_sub_volume_out,	1, "<confname> volume_out <member_id|all> [<newval>]"},
+	{"energy",	&conf_api_sub_energy,		1, "<confname> energy <member_id|all|last> [<newval>]"},
+	{"volume in",	&conf_api_sub_volume_in,	1, "<confname> volume_in <member_id|all|last> [<newval>]"},
+	{"volume out",	&conf_api_sub_volume_out,	1, "<confname> volume_out <member_id|all|last> [<newval>]"},
 	{"play",	&conf_api_sub_play,		0, "<confname> play <file_path> [<member_id>]"},
 	{"say",		&conf_api_sub_say,		2, "<confname> say <text>"},
 	{"saymember",	&conf_api_sub_saymember,	2, "<confname> saymember <member_id><text>"},
-	{"stop",	&conf_api_sub_stop,		1, "<confname> stop <[current|all]> [<member_id>]"},
-	{"kick",	&conf_api_sub_kick,		1, "<confname> kick <[member_id|all]>"},
-	{"mute",	&conf_api_sub_mute,		1, "<confname> mute <[member_id|all]>"},
-	{"unmute",	&conf_api_sub_unmute,		1, "<confname> unmute <[member_id|all]>"},
-	{"deaf",	&conf_api_sub_deaf,		1, "<confname> deaf <[member_id|all]>"},
-	{"undeaf",	&conf_api_sub_undeaf,		1, "<confname> undef <[member_id|all]>"},
+	{"stop",	&conf_api_sub_stop,		1, "<confname> stop <[current|all|last]> [<member_id>]"},
+	{"kick",	&conf_api_sub_kick,		1, "<confname> kick <[member_id|all|last]>"},
+	{"mute",	&conf_api_sub_mute,		1, "<confname> mute <[member_id|all]|last>"},
+	{"unmute",	&conf_api_sub_unmute,		1, "<confname> unmute <[member_id|all]|last>"},
+	{"deaf",	&conf_api_sub_deaf,		1, "<confname> deaf <[member_id|all]|last>"},
+	{"undeaf",	&conf_api_sub_undeaf,		1, "<confname> undef <[member_id|all]|last>"},
 	{"relate",	&conf_api_sub_relate,		0, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
 	{"lock",	&conf_api_sub_lock,		0, "<confname> lock"},
 	{"unlock",	&conf_api_sub_unlock,		0, "<confname> unlock"},
@@ -2429,7 +2429,7 @@
 			uint32_t cnum = atoi(argv[0]);
 			conference_obj_t *conference = (cnum != 0 ? (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]) : NULL);
 
-			if(cnum == 0 || (cnum != 0 && conference != NULL)) {
+			if(cnum == 0 || (cnum != 0 && conference != NULL && argc >= 3)) {
 				int argn = (cnum != 0 ? 1 : 0);
 
 				// loop through the command table to find a match
@@ -2450,9 +2450,32 @@
 								{
 									uint32_t id = atoi(argv[argn+1]);
 									int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
+									int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
 
 									if(all) {
 										 conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
+									} else if (last) {
+										conference_member_t *member = NULL;
+										conference_member_t *last_member = NULL;
+
+										switch_mutex_lock(conference->member_mutex);
+
+										// find last (oldest) member
+										member = conference->members;
+										while (member != NULL) {
+											if (last_member == NULL || member->id > last_member->id) {
+												last_member = member;
+											}
+											member = member->next;
+										}
+
+										// exec functio on last (oldest) member
+										if (last_member != NULL) {
+											conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+											pfn(last_member, stream, argv[argn+2]);
+										}
+
+										switch_mutex_unlock(conference->member_mutex);
 									} else {
 										conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
 										conference_member_t *member = conference_member_get(conference, id);
@@ -2493,7 +2516,11 @@
 					stream->write_function(stream, "Confernece command '%s' not found.\nTry 'help conference'\n", argv[argn]);
 				}
 			} else {
-				stream->write_function(stream,"No Conference called %s found.\n",argv[0]);
+				if (argc < 3) {
+					stream->write_function(stream,"Conference argument required\n");
+				} else {
+					stream->write_function(stream,"No Conference called %s found.\n",argv[0]);
+				}
 			}
 
 		} else {



More information about the Freeswitch-svn mailing list