[svn-commits] dvossel: branch dvossel/hd_confbridge r311549 - /team/dvossel/hd_confbridge/a...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 22 14:17:36 CDT 2011


Author: dvossel
Date: Tue Mar 22 14:17:32 2011
New Revision: 311549

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311549
Log:
AMI mute and unmute actions

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=311549&r1=311548&r2=311549
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Tue Mar 22 14:17:32 2011
@@ -137,6 +137,30 @@
 				ConfbridgeListRoomsComplete.</para>
 		</description>
 	</manager>
+	<manager name="ConfbridgeMute" language="en_US">
+		<synopsis>
+			Mute 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>
+	<manager name="ConfbridgeUnmute" language="en_US">
+		<synopsis>
+			Unmute 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>
 ***/
 
 /*!
@@ -1121,13 +1145,13 @@
 
 static int action_toggle_mute(struct conference_bridge *conference_bridge,
 	struct conference_bridge_user *conference_bridge_user,
-	struct ast_bridge_channel *bridge_channel)
+	struct ast_channel *chan)
 {
 	/* Mute or unmute yourself, note we only allow manipulation if they aren't waiting for a marked user or if marked users exist */
 	if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_WAITMARKED) || conference_bridge->markedusers) {
 		conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
 	}
-	return ast_stream_and_wait(bridge_channel->chan, (conference_bridge_user->features.mute ?
+	return ast_stream_and_wait(chan, (conference_bridge_user->features.mute ?
 		conf_get_sound(CONF_SOUND_MUTED, conference_bridge_user->b_profile.sounds) :
 		conf_get_sound(CONF_SOUND_UNMUTED, conference_bridge_user->b_profile.sounds)),
 		"");
@@ -1258,7 +1282,7 @@
 		case MENU_ACTION_TOGGLE_MUTE:
 			res |= action_toggle_mute(conference_bridge,
 				conference_bridge_user,
-				bridge_channel);
+				bridge_channel->chan);
 			break;
 		case MENU_ACTION_PLAYBACK:
 			res |= action_playback(bridge_channel, menu_action->data.playback_file);
@@ -1614,6 +1638,58 @@
 	return 0;
 }
 
+static int action_mute_unmute_helper(struct mansession *s, const struct message *m, int mute)
+{
+	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->features.mute = mute;
+			found = 1;
+			break;
+		}
+	}
+	ao2_unlock(bridge);
+	ao2_ref(bridge, -1);
+
+	if (found) {
+		astman_send_ack(s, m, mute ? "User muted" : "User unmuted");
+	} else {
+		astman_send_error(s, m, "No Channel by that name found in Conference.");
+	}
+	return 0;
+}
+
+static int action_confbridgeunmute(struct mansession *s, const struct message *m)
+{
+	return action_mute_unmute_helper(s, m, 0);
+}
+static int action_confbridgemute(struct mansession *s, const struct message *m)
+{
+	return action_mute_unmute_helper(s, m, 1);
+}
+
 /*! \brief Called when module is being unloaded */
 static int unload_module(void)
 {
@@ -1633,6 +1709,8 @@
 
 	res |= ast_manager_unregister("ConfbridgeList");
 	res |= ast_manager_unregister("ConfbridgeListRooms");
+	res |= ast_manager_unregister("ConfbridgeMute");
+	res |= ast_manager_unregister("ConfbridgeUnmute");
 
 	return res;
 }
@@ -1664,6 +1742,8 @@
 	res |= ast_cli_register_multiple(cli_confbridge, sizeof(cli_confbridge) / sizeof(struct ast_cli_entry));
 	res |= ast_manager_register_xml("ConfbridgeList", EVENT_FLAG_REPORTING, action_confbridgelist);
 	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);
 
 	conf_load_config(0);
 	return res;




More information about the svn-commits mailing list