[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311550 - /team/dvossel/hd_confbridge/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 22 14:37:47 CDT 2011


Author: dvossel
Date: Tue Mar 22 14:37:43 2011
New Revision: 311550

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311550
Log:
AMI conferernce kick action

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311550&r1=311549&r2=311550
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Tue Mar 22 14:37:43 2011
@@ -161,6 +161,19 @@
 		<description>
 		</description>
 	</manager>
+	<manager name="ConfbridgeKick" language="en_US">
+		<synopsis>
+			Kick a Confbridge user.
+		</synopsis>
+		<syntax>
+			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+			<parameter name="Conference" required="true" />
+			<parameter name="Channel" required="true" />
+		</syntax>
+		<description>
+		</description>
+	</manager>
+
 ***/
 
 /*!
@@ -1690,6 +1703,50 @@
 	return action_mute_unmute_helper(s, m, 1);
 }
 
+static int action_confbridgekick(struct mansession *s, const struct message *m)
+{
+	const char *conference = astman_get_header(m, "Conference");
+	const char *channel = astman_get_header(m, "Channel");
+	struct conference_bridge_user *participant = NULL;
+	struct conference_bridge *bridge = NULL;
+	struct conference_bridge tmp;
+	int found = 0;
+
+	if (ast_strlen_zero(conference)) {
+		astman_send_error(s, m, "No Conference name provided.");
+		return 0;
+	}
+	if (!ao2_container_count(conference_bridges)) {
+		astman_send_error(s, m, "No active conferences.");
+		return 0;
+	}
+	ast_copy_string(tmp.name, conference, sizeof(tmp.name));
+	bridge = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	if (!bridge) {
+		astman_send_error(s, m, "No Conference by that name found.");
+		return 0;
+	}
+
+	ao2_lock(bridge);
+	AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
+		if (!strcasecmp(participant->chan->name, channel)) {
+			participant->kicked = 1;
+			ast_bridge_remove(bridge->bridge, participant->chan);
+			found = 1;
+			break;
+		}
+	}
+	ao2_unlock(bridge);
+	ao2_ref(bridge, -1);
+
+	if (found) {
+		astman_send_ack(s, m, "User kicked");
+	} else {
+		astman_send_error(s, m, "No Channel by that name found in Conference.");
+	}
+	return 0;
+}
+
 /*! \brief Called when module is being unloaded */
 static int unload_module(void)
 {
@@ -1711,6 +1768,7 @@
 	res |= ast_manager_unregister("ConfbridgeListRooms");
 	res |= ast_manager_unregister("ConfbridgeMute");
 	res |= ast_manager_unregister("ConfbridgeUnmute");
+	res |= ast_manager_unregister("ConfbridgeKick");
 
 	return res;
 }
@@ -1744,6 +1802,7 @@
 	res |= ast_manager_register_xml("ConfbridgeListRooms", EVENT_FLAG_REPORTING, action_confbridgelistrooms);
 	res |= ast_manager_register_xml("ConfbridgeMute", EVENT_FLAG_REPORTING, action_confbridgemute);
 	res |= ast_manager_register_xml("ConfbridgeUnmute", EVENT_FLAG_REPORTING, action_confbridgeunmute);
+	res |= ast_manager_register_xml("ConfbridgeKick", EVENT_FLAG_REPORTING, action_confbridgekick);
 
 	conf_load_config(0);
 	return res;




More information about the asterisk-commits mailing list