]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_ari: Correct Location headers returned by some ARI resources 35/2835/1
authorSean Bright <sean.bright@gmail.com>
Sat, 14 May 2016 17:29:09 +0000 (13:29 -0400)
committerSean Bright <sean.bright@gmail.com>
Sat, 14 May 2016 17:48:59 +0000 (12:48 -0500)
The Location headers returned by:

 * /bridges/{bridgeId}/play
 * /bridges/{bridgeId}/record
 * /channels/{channelId}/play
 * /channels/{channelId}/record

Did not have the '/ari' prefix, and in the case of the 'play' resources, were
using 'playback' instead of 'playbacks.'

Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c

res/ari/resource_bridges.c
res/ari/resource_channels.c
res/res_ari.c

index 6018c43bebdb898317ef58f691bcc39e2d77dd0b..57c1c273889a739d925e26ae4ec4b928ef8ee786 100644 (file)
@@ -380,7 +380,7 @@ static int ari_bridges_play_helper(const char *args_media,
                return -1;
        }
 
-       if (ast_asprintf(playback_url, "/playback/%s",
+       if (ast_asprintf(playback_url, "/playbacks/%s",
                        stasis_app_playback_get_id(playback)) == -1) {
                playback_url = NULL;
                ast_ari_response_alloc_failed(response);
index c838bc39cceef0d1a05d5bad731613106611eeff..edf1a20e6cb99554af0bb9545960143b9d3ef5e6 100644 (file)
@@ -524,7 +524,7 @@ static void ari_channels_handle_play(
                return;
        }
 
-       if (ast_asprintf(&playback_url, "/playback/%s",
+       if (ast_asprintf(&playback_url, "/playbacks/%s",
                        stasis_app_playback_get_id(playback)) == -1) {
                playback_url = NULL;
                ast_ari_response_error(
index 62083bfb12d6a9f85db8ac790914e06c2c40140f..14dece8e4e07aa2241759eff5ef31af407d2e986 100644 (file)
@@ -304,10 +304,11 @@ void ast_ari_response_alloc_failed(struct ast_ari_response *response)
 void ast_ari_response_created(struct ast_ari_response *response,
        const char *url, struct ast_json *message)
 {
+       RAII_VAR(struct stasis_rest_handlers *, root, get_root_handler(), ao2_cleanup);
        response->message = message;
        response->response_code = 201;
        response->response_text = "Created";
-       ast_str_append(&response->headers, 0, "Location: %s\r\n", url);
+       ast_str_append(&response->headers, 0, "Location: /%s%s\r\n", root->path_segment, url);
 }
 
 static void add_allow_header(struct stasis_rest_handlers *handler,