summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/ari/resource_channels.c9
-rw-r--r--res/res_ari_channels.c2
-rw-r--r--rest-api/api-docs/channels.json2
3 files changed, 10 insertions, 3 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 67498af9f..edd319d37 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -1242,6 +1242,11 @@ void ast_ari_channels_get_channel_var(struct ast_variable *headers,
ast_assert(response != NULL);
+ if (!value) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
+
if (ast_strlen_zero(args->variable)) {
ast_ari_response_error(
response, 400, "Bad Request",
@@ -1280,7 +1285,9 @@ void ast_ari_channels_get_channel_var(struct ast_variable *headers,
}
} else {
if (!ast_str_retrieve_variable(&value, 0, channel, NULL, args->variable)) {
- ast_ari_response_alloc_failed(response);
+ ast_ari_response_error(
+ response, 404, "Variable Not Found",
+ "Provided variable was not found");
return;
}
}
diff --git a/res/res_ari_channels.c b/res/res_ari_channels.c
index a088705ad..0d1334eb0 100644
--- a/res/res_ari_channels.c
+++ b/res/res_ari_channels.c
@@ -2173,7 +2173,7 @@ static void ast_ari_channels_get_channel_var_cb(
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
case 400: /* Missing variable parameter. */
- case 404: /* Channel not found */
+ case 404: /* Channel or variable not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
break;
diff --git a/rest-api/api-docs/channels.json b/rest-api/api-docs/channels.json
index 9a0a4f356..9bcfda978 100644
--- a/rest-api/api-docs/channels.json
+++ b/rest-api/api-docs/channels.json
@@ -1199,7 +1199,7 @@
},
{
"code": 404,
- "reason": "Channel not found"
+ "reason": "Channel or variable not found"
},
{
"code": 409,