diff options
author | Jonathan Rose <jrose@digium.com> | 2013-04-30 22:37:24 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2013-04-30 22:37:24 +0000 |
commit | 8e257fe8196544ff962f1032a73134ad7c8cc4b4 (patch) | |
tree | 7683b460e67a9e1e50f5ada8991f2216ae6c8aa6 /main/json.c | |
parent | 6f5733388a93d01124c62233184691b53e886b3b (diff) |
Stasis Core: Refactor ACL Change events to go out over the stasis core msg bus
(issue ASTERISK-21103)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2481/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/json.c')
-rw-r--r-- | main/json.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/json.c b/main/json.c index 1ff563871..87971f04a 100644 --- a/main/json.c +++ b/main/json.c @@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/localtime.h" #include "asterisk/module.h" #include "asterisk/utils.h" +#include "asterisk/astobj2.h" #include <jansson.h> #include <time.h> @@ -531,3 +532,23 @@ void ast_json_init(void) /* Setup to use Asterisk custom allocators */ ast_json_reset_alloc_funcs(); } + +static void json_payload_destructor(void *obj) +{ + struct ast_json_payload *payload = obj; + ast_json_unref(payload->json); +} + +struct ast_json_payload *ast_json_payload_create(struct ast_json *json) +{ + struct ast_json_payload *payload; + + if (!(payload = ao2_alloc(sizeof(*payload), json_payload_destructor))) { + return NULL; + } + + ast_json_ref(json); + payload->json = json; + + return payload; +} |