]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ari/stasis: Indicate progress before playback on a bridge
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>
Mon, 2 Oct 2023 12:03:03 +0000 (20:03 +0800)
committerAsterisk Development Team <asteriskteam@digium.com>
Fri, 12 Jan 2024 18:32:12 +0000 (18:32 +0000)
Make it possible to start a playback and the calling party
to receive audio on a bridge before the call is connected.

Model the implementation after play_on_channel and deliver a
AST_CONTROL_PROGRESS before starting the playback.

For a PJSIP channel this will result in sending a SIP 183
Session Progress.

(cherry picked from commit 624c7ac88326e75ae60975d2bbcf5e9d4d03d1ba)

res/ari/resource_bridges.c

index 8c6acdb67673bee5d0ba2c2de39553bb4a9ca2f3..b66e41cc81782216147777bf4e54386a97fa0801 100644 (file)
@@ -425,6 +425,12 @@ static void ari_bridges_play_new(const char **args_media,
        struct bridge_channel_control_thread_data *thread_data;
        pthread_t threadid;
 
+       struct ast_frame prog = {
+               .frametype = AST_FRAME_CONTROL,
+               .subclass.integer = AST_CONTROL_PROGRESS,
+       };
+
+
        if (!(play_channel = prepare_bridge_media_channel("Announcer"))) {
                ast_ari_response_error(
                        response, 500, "Internal Error", "Could not create playback channel");
@@ -472,6 +478,8 @@ static void ari_bridges_play_new(const char **args_media,
                return;
        }
 
+       ast_bridge_queue_everyone_else(bridge, NULL, &prog);
+
        /* Give play_channel and control reference to the thread data */
        thread_data = ast_malloc(sizeof(*thread_data) + strlen(bridge->uniqueid) + 1);
        if (!thread_data) {