[asterisk-commits] dvossel: branch dvossel/shortbus r325539 - /team/dvossel/shortbus/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 29 11:09:58 CDT 2011


Author: dvossel
Date: Wed Jun 29 11:09:54 2011
New Revision: 325539

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=325539
Log:
Adds AMI action for setting video src in confbridge.

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

Modified: team/dvossel/shortbus/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/shortbus/apps/app_confbridge.c?view=diff&rev=325539&r1=325538&r2=325539
==============================================================================
--- team/dvossel/shortbus/apps/app_confbridge.c (original)
+++ team/dvossel/shortbus/apps/app_confbridge.c Wed Jun 29 11:09:54 2011
@@ -233,6 +233,19 @@
 		<description>
 		</description>
 	</manager>
+	<manager name="ConfbridgeSetSingleVideoSrc" language="en_US">
+		<synopsis>
+			Set a conference user as the single video source distributed to all other participants.
+		</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>
+
 ***/
 
 /*!
@@ -2506,6 +2519,55 @@
 	return 0;
 }
 
+static int action_confbridgesetsinglevideosrc(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;
+
+	if (ast_strlen_zero(conference)) {
+		astman_send_error(s, m, "No Conference name provided.");
+		return 0;
+	}
+	if (ast_strlen_zero(channel)) {
+		astman_send_error(s, m, "No channel 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;
+	}
+
+	/* find channel and set as video src. */
+	ao2_lock(bridge);
+	AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
+		if (!strncmp(channel, participant->chan->name, strlen(channel))) {
+			ast_bridge_set_single_src_video_mode(bridge->bridge, participant->chan);
+			break;
+		}
+	}
+	ao2_unlock(bridge);
+	ao2_ref(bridge, -1);
+
+	/* do not access participant after bridge unlock.  We are just
+	 * using this check to see if it was found or not */
+	if (!participant) {
+		astman_send_error(s, m, "No channel by that name found in conference.");
+		return 0;
+	}
+	astman_send_ack(s, m, "Conference single video source set.");
+	return 0;
+}
+
 static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
 	char *parse = NULL;
@@ -2637,6 +2699,7 @@
 	res |= ast_manager_register_xml("ConfbridgeLock", EVENT_FLAG_CALL, action_confbridgelock);
 	res |= ast_manager_register_xml("ConfbridgeStartRecord", EVENT_FLAG_CALL, action_confbridgestartrecord);
 	res |= ast_manager_register_xml("ConfbridgeStopRecord", EVENT_FLAG_CALL, action_confbridgestoprecord);
+	res |= ast_manager_register_xml("ConfbridgeSetSingleVideoSrc", EVENT_FLAG_CALL, action_confbridgesetsinglevideosrc);
 
 	conf_load_config(0);
 	return res;




More information about the asterisk-commits mailing list