diff options
author | David M. Lee <dlee@digium.com> | 2013-06-11 15:46:35 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-06-11 15:46:35 +0000 |
commit | dbdb2b1b3a618a79b3e42c77c05cb2688b4da08d (patch) | |
tree | 6d7174c03a0388cf81bee13403cf4c118184d1d9 /main/parking.c | |
parent | 2053fc31594d4069cb178e591ab2b4e0df08b268 (diff) |
Add vtable and methods for to_json and to_ami for Stasis messages
When a Stasis message type is defined in a loadable module, handling
those messages for AMI and res_stasis events can be cumbersome.
This patch adds a vtable to stasis_message_type, with to_ami and
to_json virtual functions. These allow messages to be handled
abstractly without putting module-specific code in core.
As an example, the VarSet AMI event was refactored to use the to_ami
virtual function.
(closes issue ASTERISK-21817)
Review: https://reviewboard.asterisk.org/r/2579/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/parking.c')
-rw-r--r-- | main/parking.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/main/parking.c b/main/parking.c index 2a5b72e61..a7cd0ba54 100644 --- a/main/parking.c +++ b/main/parking.c @@ -35,7 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/channel.h" /*! \brief Message type for parked calls */ -static struct stasis_message_type *parked_call_type; +STASIS_MESSAGE_TYPE_DEFN(ast_parked_call_type); /*! \brief Topic for parking lots */ static struct stasis_topic *parking_topic; @@ -48,15 +48,14 @@ static ast_bridge_channel_park_fn ast_bridge_channel_park_func = NULL; void ast_parking_stasis_init(void) { - parked_call_type = stasis_message_type_create("ast_parked_call"); + STASIS_MESSAGE_TYPE_INIT(ast_parked_call_type); parking_topic = stasis_topic_create("ast_parking"); } void ast_parking_stasis_disable(void) { - ao2_cleanup(parked_call_type); + STASIS_MESSAGE_TYPE_CLEANUP(ast_parked_call_type); ao2_cleanup(parking_topic); - parked_call_type = NULL; parking_topic = NULL; } @@ -65,11 +64,6 @@ struct stasis_topic *ast_parking_topic(void) return parking_topic; } -struct stasis_message_type *ast_parked_call_type(void) -{ - return parked_call_type; -} - /*! \brief Destructor for parked_call_payload objects */ static void parked_call_payload_destructor(void *obj) { |