res/ari/resource_channels.c: Added hangup reason code for channels

Currently, DELETE /ari/channels/<channelID> supports only few hangup reasons.
It's good enough for simple use, but when it needs to set the detail reason,
it comes challenges.
Added reason_code query parameter for that.

ASTERISK-28385

Change-Id: I1cf1d991ffd759d0591b347445a55f416ddc3ff2
This commit is contained in:
sungtae kim
2019-04-16 01:26:46 +02:00
committed by Kevin Harwell
parent ccbc83fed7
commit 613a335de5
4 changed files with 78 additions and 33 deletions

View File

@@ -598,6 +598,10 @@ int ast_ari_channels_hangup_parse_body(
{
struct ast_json *field;
/* Parse query parameters out of it */
field = ast_json_object_get(body, "reason_code");
if (field) {
args->reason_code = ast_json_string_get(field);
}
field = ast_json_object_get(body, "reason");
if (field) {
args->reason = ast_json_string_get(field);
@@ -625,6 +629,9 @@ static void ast_ari_channels_hangup_cb(
#endif /* AST_DEVMODE */
for (i = get_params; i; i = i->next) {
if (strcmp(i->name, "reason_code") == 0) {
args.reason_code = (i->value);
} else
if (strcmp(i->name, "reason") == 0) {
args.reason = (i->value);
} else