mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-17 18:19:45 +00:00
res/ari/resource_bridges: Add the ability to manipulate the video source
In multi-party bridges, Asterisk currently supports two video modes: * Follow the talker, in which the speaker with the most energy is shown to all participants but the speaker, and the speaker sees the previous video source * Explicitly set video sources, in which all participants see a locked video source Prior to this patch, ARI had no ability to manipulate the video source. This isn't important for two-party bridges, in which Asterisk merely relays the video between the participants. However, in a multi-party bridge, it can be advantageous to allow an external application to manipulate the video source. This patch provides two new routes to accomplish this: (1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId} Sets a video source to an explicit channel (2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource Removes any explicit video source, and sets the video mode to talk detection ASTERISK-26595 #close Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "asterisk/stasis.h"
|
||||
#include "asterisk/stasis_bridges.h"
|
||||
#include "asterisk/stasis_app.h"
|
||||
#include "asterisk/stasis_app_impl.h"
|
||||
#include "asterisk/stasis_app_playback.h"
|
||||
#include "asterisk/stasis_app_recording.h"
|
||||
#include "asterisk/stasis_channels.h"
|
||||
@@ -1003,3 +1004,68 @@ void ast_ari_bridges_create_with_id(struct ast_variable *headers,
|
||||
ast_ari_response_ok(response,
|
||||
ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer()));
|
||||
}
|
||||
|
||||
static int bridge_set_video_source_cb(struct stasis_app_control *control,
|
||||
struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct ast_bridge *bridge = data;
|
||||
|
||||
ast_bridge_lock(bridge);
|
||||
ast_bridge_set_single_src_video_mode(bridge, chan);
|
||||
ast_bridge_unlock(bridge);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ast_ari_bridges_set_video_source(struct ast_variable *headers,
|
||||
struct ast_ari_bridges_set_video_source_args *args, struct ast_ari_response *response)
|
||||
{
|
||||
struct ast_bridge *bridge;
|
||||
struct stasis_app_control *control;
|
||||
|
||||
bridge = find_bridge(response, args->bridge_id);
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
control = find_channel_control(response, args->channel_id);
|
||||
if (!control) {
|
||||
ao2_ref(bridge, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stasis_app_get_bridge(control) != bridge) {
|
||||
ast_ari_response_error(response, 422,
|
||||
"Unprocessable Entity",
|
||||
"Channel not in this bridge");
|
||||
ao2_ref(bridge, -1);
|
||||
ao2_ref(control, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
stasis_app_send_command(control, bridge_set_video_source_cb,
|
||||
ao2_bump(bridge), __ao2_cleanup);
|
||||
|
||||
ao2_ref(bridge, -1);
|
||||
ao2_ref(control, -1);
|
||||
|
||||
ast_ari_response_no_content(response);
|
||||
}
|
||||
|
||||
void ast_ari_bridges_clear_video_source(struct ast_variable *headers,
|
||||
struct ast_ari_bridges_clear_video_source_args *args, struct ast_ari_response *response)
|
||||
{
|
||||
struct ast_bridge *bridge;
|
||||
|
||||
bridge = find_bridge(response, args->bridge_id);
|
||||
if (!bridge) {
|
||||
return;
|
||||
}
|
||||
|
||||
ast_bridge_lock(bridge);
|
||||
ast_bridge_set_talker_src_video_mode(bridge);
|
||||
ast_bridge_unlock(bridge);
|
||||
|
||||
ao2_ref(bridge, -1);
|
||||
ast_ari_response_no_content(response);
|
||||
}
|
||||
|
Reference in New Issue
Block a user