main/json.c: Added app_name, app_data to channel type

It was difficult to check the channel's current application and
parameters using ARI for current channels. Added app_name, app_data
items to show the current application information.

ASTERISK-28343

Change-Id: Ia48972b3850e5099deab0faeaaf51223a1f2f38c
This commit is contained in:
sungtae kim
2019-03-22 00:09:14 +01:00
parent 4f0b8c3ed3
commit d5a318f148
8 changed files with 91 additions and 13 deletions

View File

@@ -1680,20 +1680,26 @@ AST_TEST_DEFINE(json_test_cep)
break;
}
expected = ast_json_pack("{s: o, s: o, s: o}",
expected = ast_json_pack("{s: o, s: o, s: o, s: o, s: o}",
"context", ast_json_null(),
"exten", ast_json_null(),
"priority", ast_json_null());
uut = ast_json_dialplan_cep(NULL, NULL, -1);
"priority", ast_json_null(),
"app_name", ast_json_null(),
"app_data", ast_json_null()
);
uut = ast_json_dialplan_cep_app(NULL, NULL, -1, NULL, NULL);
ast_test_validate(test, ast_json_equal(expected, uut));
ast_json_unref(expected);
ast_json_unref(uut);
expected = ast_json_pack("{s: s, s: s, s: i}",
expected = ast_json_pack("{s: s, s: s, s: i, s: s, s: s}",
"context", "main",
"exten", "4321",
"priority", 7);
uut = ast_json_dialplan_cep("main", "4321", 7);
"priority", 7,
"app_name", "",
"app_data", ""
);
uut = ast_json_dialplan_cep_app("main", "4321", 7, "", "");
ast_test_validate(test, ast_json_equal(expected, uut));
return AST_TEST_PASS;

View File

@@ -274,7 +274,7 @@ AST_TEST_DEFINE(channel_snapshot_json)
actual = ast_channel_snapshot_to_json(snapshot, NULL);
expected = ast_json_pack("{ s: s, s: s, s: s, s: s,"
" s: { s: s, s: s, s: i },"
" s: { s: s, s: s, s: i, s: s, s: s },"
" s: { s: s, s: s },"
" s: { s: s, s: s },"
" s: s"
@@ -288,6 +288,8 @@ AST_TEST_DEFINE(channel_snapshot_json)
"context", "context",
"exten", "exten",
"priority", 1,
"app_name", "",
"app_data", "",
"caller",
"name", "cid_name",
"number", "cid_num",