mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-15 14:28:24 +00:00
Moved core logic from app_stasis to res_stasis
After some discussion on asterisk-dev, it was decided that the bulk of
the logic in app_stasis actually belongs in a resource module instead
of the application module.
This patch does that, leaves the app specific stuff in app_stasis, and
fixes up everything else to be consistent with that change.
* Renamed test_app_stasis to test_res_stasis
* Renamed app_stasis.h to stasis_app.h
* This is still stasis application support, even though it's no
longer in an app_ module. The name should never have been tied to
the type of module, anyways.
* Now that json isn't a resource module anymore, moved the
ast_channel_snapshot_to_json function to main/stasis_channels.c,
where it makes more sense.
Review: https://reviewboard.asterisk.org/r/2430/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -199,11 +199,76 @@ AST_TEST_DEFINE(multi_channel_blob_snapshots)
|
||||
return AST_TEST_PASS;
|
||||
}
|
||||
|
||||
AST_TEST_DEFINE(channel_snapshot_json)
|
||||
{
|
||||
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
||||
RAII_VAR(struct ast_channel *, chan, NULL, safe_channel_release);
|
||||
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
|
||||
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
|
||||
RAII_VAR(struct ast_json *, actual, NULL, ast_json_unref);
|
||||
|
||||
switch (cmd) {
|
||||
case TEST_INIT:
|
||||
info->name = __func__;
|
||||
info->category = test_category;
|
||||
info->summary = "Test creation of ast_channel_blob objects";
|
||||
info->description = "Test creation of ast_channel_blob objects";
|
||||
return AST_TEST_NOT_RUN;
|
||||
case TEST_EXECUTE:
|
||||
break;
|
||||
}
|
||||
|
||||
ast_test_validate(test, NULL == ast_channel_snapshot_to_json(NULL));
|
||||
|
||||
chan = ast_channel_alloc(0, AST_STATE_DOWN, "cid_num", "cid_name", "acctcode", "exten", "context", NULL, 0, "TEST/name");
|
||||
ast_test_validate(test, NULL != chan);
|
||||
snapshot = ast_channel_snapshot_create(chan);
|
||||
ast_test_validate(test, NULL != snapshot);
|
||||
|
||||
actual = ast_channel_snapshot_to_json(snapshot);
|
||||
expected = ast_json_pack("{ s: s, s: s, s: s, s: s, s: s, s: s, s: s,"
|
||||
" s: s, s: s, s: s, s: s,"
|
||||
" s: { s: s, s: s, s: i },"
|
||||
" s: { s: s, s: s },"
|
||||
" s: { s: s, s: s },"
|
||||
" s: o"
|
||||
"}",
|
||||
"name", "TEST/name",
|
||||
"state", "Down",
|
||||
"accountcode", "acctcode",
|
||||
"peeraccount", "",
|
||||
"userfield", "",
|
||||
"uniqueid", ast_channel_uniqueid(chan),
|
||||
"linkedid", ast_channel_uniqueid(chan),
|
||||
"parkinglot", "",
|
||||
"hangupsource", "",
|
||||
"appl", "",
|
||||
"data", "",
|
||||
"dialplan",
|
||||
"context", "context",
|
||||
"exten", "exten",
|
||||
"priority", 1,
|
||||
"caller",
|
||||
"name", "cid_name",
|
||||
"number", "cid_num",
|
||||
"connected",
|
||||
"name", "",
|
||||
"number", "",
|
||||
"creationtime",
|
||||
ast_json_timeval(
|
||||
ast_channel_creationtime(chan), NULL));
|
||||
|
||||
ast_test_validate(test, ast_json_equal(expected, actual));
|
||||
|
||||
return AST_TEST_PASS;
|
||||
}
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
AST_TEST_UNREGISTER(channel_blob_create);
|
||||
AST_TEST_UNREGISTER(multi_channel_blob_create);
|
||||
AST_TEST_UNREGISTER(multi_channel_blob_snapshots);
|
||||
AST_TEST_UNREGISTER(channel_snapshot_json);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -213,6 +278,7 @@ static int load_module(void)
|
||||
AST_TEST_REGISTER(channel_blob_create);
|
||||
AST_TEST_REGISTER(multi_channel_blob_create);
|
||||
AST_TEST_REGISTER(multi_channel_blob_snapshots);
|
||||
AST_TEST_REGISTER(channel_snapshot_json);
|
||||
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user