summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-10-03 19:06:48 +0000
committerJoshua Colp <jcolp@digium.com>2013-10-03 19:06:48 +0000
commitbd8cf10d60560524a5c90315a85b471d14e61331 (patch)
tree89459a907248f7c1a08de3aa8bc1d6011f9d37f9
parent7e698f1f42858d707047455f6f87ca16f105efd2 (diff)
Fix a crash caused by muting and unmuting a channel in ARI without specifying a direction.
(closes issue ASTERISK-22637) Reported by: Scott Griepentrog Patch by Matt Jordan, whose office I have taken over in the name of Canada. ........ Merged revisions 400401 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400402 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--res/ari/resource_channels.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 4d5228168..aaf04a3f8 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -152,6 +152,13 @@ void ast_ari_mute_channel(struct ast_variable *headers, struct ast_mute_channel_
return;
}
+ if (ast_strlen_zero(args->direction)) {
+ ast_ari_response_error(
+ response, 400, "Bad Request",
+ "Direction is required");
+ return;
+ }
+
if (!strcmp(args->direction, "in")) {
direction = AST_MUTE_DIRECTION_READ;
} else if (!strcmp(args->direction, "out")) {
@@ -181,6 +188,13 @@ void ast_ari_unmute_channel(struct ast_variable *headers, struct ast_unmute_chan
return;
}
+ if (ast_strlen_zero(args->direction)) {
+ ast_ari_response_error(
+ response, 400, "Bad Request",
+ "Direction is required");
+ return;
+ }
+
if (!strcmp(args->direction, "in")) {
direction = AST_MUTE_DIRECTION_READ;
} else if (!strcmp(args->direction, "out")) {