]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_stasis.c: Add new type 'sdp_label' for bridge creation.
authorJoe Searle <joe@jsearle.net>
Thu, 25 May 2023 09:58:45 +0000 (10:58 +0100)
committerGeorge Joseph <gtjoseph@users.noreply.github.com>
Mon, 5 Jun 2023 18:26:11 +0000 (12:26 -0600)
Add new type 'sdp_label' when creating a bridge using the ARI. This will
add labels to the SDP for each stream, the label is set to the
corresponding channel id.

Resolves: #91

UserNote: When creating a bridge using the ARI the 'type' argument now
accepts a new value 'sdp_label' which will configure the bridge to add
labels for each stream in the SDP with the corresponding channel id.

res/ari/resource_bridges.h
res/res_stasis.c
res/stasis/stasis_bridge.c
res/stasis/stasis_bridge.h
rest-api/api-docs/bridges.json

index 95f43d0b398cb3c5553e481a50d44cce6e135a29..01d5d6070ce3aa7d5aeffbb0c34a9feb8e824a3a 100644 (file)
@@ -52,7 +52,7 @@ struct ast_ari_bridges_list_args {
 void ast_ari_bridges_list(struct ast_variable *headers, struct ast_ari_bridges_list_args *args, struct ast_ari_response *response);
 /*! Argument struct for ast_ari_bridges_create() */
 struct ast_ari_bridges_create_args {
-       /*! Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single). */
+       /*! Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label). */
        const char *type;
        /*! Unique ID to give to the bridge being created. */
        const char *bridge_id;
@@ -82,7 +82,7 @@ int ast_ari_bridges_create_parse_body(
 void ast_ari_bridges_create(struct ast_variable *headers, struct ast_ari_bridges_create_args *args, struct ast_ari_response *response);
 /*! Argument struct for ast_ari_bridges_create_with_id() */
 struct ast_ari_bridges_create_with_id_args {
-       /*! Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single) to set. */
+       /*! Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label) to set. */
        const char *type;
        /*! Unique ID to give to the bridge being created. */
        const char *bridge_id;
index 7eacbfe0a1d9bf22487621ece34858fc977b7e4b..84244c2a133a09bef6f3f3ecc5cab09780330759 100644 (file)
@@ -801,6 +801,7 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam
                | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO
                | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY;
        enum ast_bridge_video_mode_type video_mode = AST_BRIDGE_VIDEO_MODE_TALKER_SRC;
+       int send_sdp_label = 0;
 
        if (invisible) {
                flags |= AST_BRIDGE_FLAG_INVISIBLE;
@@ -821,6 +822,8 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam
                        video_mode = AST_BRIDGE_VIDEO_MODE_SFU;
                } else if (!strcmp(requested_type, "video_single")) {
                        video_mode = AST_BRIDGE_VIDEO_MODE_SINGLE_SRC;
+               } else if (!strcmp(requested_type, "sdp_label")) {
+                       send_sdp_label = 1;
                }
        }
 
@@ -837,7 +840,7 @@ static struct ast_bridge *bridge_create_common(const char *type, const char *nam
                return NULL;
        }
 
-       bridge = bridge_stasis_new(capabilities, flags, name, id, video_mode);
+       bridge = bridge_stasis_new(capabilities, flags, name, id, video_mode, send_sdp_label);
        if (bridge) {
                if (!ao2_link(app_bridges, bridge)) {
                        ast_bridge_destroy(bridge, 0);
index d5ab00aae7afb08fc0b4db71a3afcf9aff60b604..f48f60cab9aaf3f37e9bd98044777107259c424d 100644 (file)
@@ -295,7 +295,7 @@ static void bridge_stasis_pull(struct ast_bridge *self, struct ast_bridge_channe
        ast_bridge_base_v_table.pull(self, bridge_channel);
 }
 
-struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode)
+struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode, unsigned int send_sdp_label)
 {
        void *bridge;
 
@@ -317,6 +317,10 @@ struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags,
                ast_bridge_set_talker_src_video_mode(bridge);
        }
 
+       if (send_sdp_label) {
+               ast_bridge_set_send_sdp_label(bridge, 1);
+       }
+
        bridge = bridge_register(bridge);
 
        return bridge;
index 531da927ff8e019666cc1dbe2f9b5c0e073b63d2..3a459155cb0ad6d2f70280d34782ec0f8a64be55 100644 (file)
@@ -55,7 +55,7 @@ extern "C" {
  * \retval a pointer to a new bridge on success
  * \retval NULL on failure
  */
-struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode);
+struct ast_bridge *bridge_stasis_new(uint32_t capabilities, unsigned int flags, const char *name, const char *id, enum ast_bridge_video_mode_type video_mode, unsigned int send_sdp_label);
 
 /*!
  * \internal
index bf0a0016ec8acf923337bdd570a9eddcab3fa11e..636d254093088ea0599c871e12183b1ae3bc2131 100644 (file)
@@ -30,7 +30,7 @@
                                        "parameters": [
                                                {
                                                        "name": "type",
-                                                       "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single).",
+                                                       "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label).",
                                                        "paramType": "query",
                                                        "required": false,
                                                        "allowMultiple": false,
@@ -69,7 +69,7 @@
                                        "parameters": [
                                                {
                                                        "name": "type",
-                                                       "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single) to set.",
+                                                       "description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label) to set.",
                                                        "paramType": "query",
                                                        "required": false,
                                                        "allowMultiple": false,