diff options
author | Scott Griepentrog <sgriepentrog@digium.com> | 2014-05-22 16:09:51 +0000 |
---|---|---|
committer | Scott Griepentrog <sgriepentrog@digium.com> | 2014-05-22 16:09:51 +0000 |
commit | cf21644d6a4b757999be136ab1b90ba5cf6ac3bc (patch) | |
tree | a35b24bdfcf860a4085383bab882ed33bf3d3e1d /main/stasis_channels.c | |
parent | d00882108fabd3798aa6566aa5697d82459e753e (diff) |
ARI: Add ability to raise arbitrary User Events
User events can now be generated from ARI. Events can be signalled with
arbitrary json variables, and include one or more of channel, bridge, or
endpoint snapshots. An application must be specified which will receive
the event message (other applications can subscribe to it). The message
will also be delivered via AMI provided a channel is attached. Dialplan
generated user event messages are still transmitted via the channel, and
will only be received by a stasis application they are attached to or if
the channel is subscribed to.
This change also introduces the multi object blob mechanism used to send
multiple snapshot types in a single message. The dialplan app UserEvent
was also changed to use multi object blob, and a new stasis message type
created to handle them.
ASTERISK-22697 #close
Review: https://reviewboard.asterisk.org/r/3494/
........
Merged revisions 414405 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_channels.c')
-rw-r--r-- | main/stasis_channels.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c index 3522fb291..49fd3f995 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -916,28 +916,6 @@ static struct ast_json *dtmf_end_to_json( "channel", json_channel); } -static struct ast_json *user_event_to_json( - struct stasis_message *message, - const struct stasis_message_sanitizer *sanitize) -{ - struct ast_channel_blob *channel_blob = stasis_message_data(message); - struct ast_json *blob = channel_blob->blob; - struct ast_channel_snapshot *snapshot = channel_blob->snapshot; - const struct timeval *tv = stasis_message_timestamp(message); - struct ast_json *json_channel = ast_channel_snapshot_to_json(snapshot, sanitize); - - if (!json_channel) { - return NULL; - } - - return ast_json_pack("{s: s, s: o, s: O, s: O, s: o}", - "type", "ChannelUserevent", - "timestamp", ast_json_timeval(*tv, NULL), - "eventname", ast_json_object_get(blob, "eventname"), - "userevent", blob, - "channel", json_channel); -} - static struct ast_json *varset_to_json( struct stasis_message *message, const struct stasis_message_sanitizer *sanitize) @@ -1007,9 +985,6 @@ STASIS_MESSAGE_TYPE_DEFN(ast_channel_varset_type, .to_ami = varset_to_ami, .to_json = varset_to_json, ); -STASIS_MESSAGE_TYPE_DEFN(ast_channel_user_event_type, - .to_json = user_event_to_json, - ); STASIS_MESSAGE_TYPE_DEFN(ast_channel_hangup_request_type, .to_json = hangup_request_to_json, ); @@ -1048,7 +1023,6 @@ static void stasis_channels_cleanup(void) STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_snapshot_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dial_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_varset_type); - STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_user_event_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_hangup_request_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_begin_type); STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_end_type); @@ -1097,7 +1071,6 @@ int ast_stasis_channels_init(void) res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dial_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_varset_type); - res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_user_event_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hangup_request_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_begin_type); res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_end_type); |