mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +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:
@@ -458,6 +458,37 @@ void ast_channel_publish_varset(struct ast_channel *chan, const char *name, cons
|
||||
publish_message_for_channel_topics(msg, chan);
|
||||
}
|
||||
|
||||
struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot)
|
||||
{
|
||||
RAII_VAR(struct ast_json *, json_chan, NULL, ast_json_unref);
|
||||
|
||||
if (snapshot == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
json_chan = 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: o, s: o, s: o,"
|
||||
" s: o"
|
||||
"}",
|
||||
"name", snapshot->name,
|
||||
"state", ast_state2str(snapshot->state),
|
||||
"accountcode", snapshot->accountcode,
|
||||
"peeraccount", snapshot->peeraccount,
|
||||
"userfield", snapshot->userfield,
|
||||
"uniqueid", snapshot->uniqueid,
|
||||
"linkedid", snapshot->linkedid,
|
||||
"parkinglot", snapshot->parkinglot,
|
||||
"hangupsource", snapshot->hangupsource,
|
||||
"appl", snapshot->appl,
|
||||
"data", snapshot->data,
|
||||
"dialplan", ast_json_dialplan_cep(snapshot->context, snapshot->exten, snapshot->priority),
|
||||
"caller", ast_json_name_number(snapshot->caller_name, snapshot->caller_number),
|
||||
"connected", ast_json_name_number(snapshot->connected_name, snapshot->connected_number),
|
||||
"creationtime", ast_json_timeval(snapshot->creationtime, NULL));
|
||||
|
||||
return ast_json_ref(json_chan);
|
||||
}
|
||||
|
||||
void ast_stasis_channels_shutdown(void)
|
||||
{
|
||||
ao2_cleanup(channel_snapshot_type);
|
||||
|
Reference in New Issue
Block a user