summaryrefslogtreecommitdiff
path: root/main/manager_channels.c
diff options
context:
space:
mode:
authorScott Griepentrog <sgriepentrog@digium.com>2014-05-22 16:09:51 +0000
committerScott Griepentrog <sgriepentrog@digium.com>2014-05-22 16:09:51 +0000
commitcf21644d6a4b757999be136ab1b90ba5cf6ac3bc (patch)
treea35b24bdfcf860a4085383bab882ed33bf3d3e1d /main/manager_channels.c
parentd00882108fabd3798aa6566aa5697d82459e753e (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/manager_channels.c')
-rw-r--r--main/manager_channels.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/main/manager_channels.c b/main/manager_channels.c
index 507e2c9b4..9a15353f2 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -629,54 +629,6 @@ static void channel_snapshot_update(void *data, struct stasis_subscription *sub,
}
}
-static int userevent_exclusion_cb(const char *key)
-{
- if (!strcmp("type", key)) {
- return 1;
- }
- if (!strcmp("eventname", key)) {
- return 1;
- }
- return 0;
-}
-
-static void channel_user_event_cb(void *data, struct stasis_subscription *sub,
- struct stasis_message *message)
-{
- struct ast_channel_blob *obj = stasis_message_data(message);
- RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
- RAII_VAR(struct ast_str *, body, NULL, ast_free);
- const char *eventname;
-
- eventname = ast_json_string_get(ast_json_object_get(obj->blob, "eventname"));
- body = ast_manager_str_from_json_object(obj->blob, userevent_exclusion_cb);
- channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
-
- if (!channel_event_string || !body) {
- return;
- }
-
- /*** DOCUMENTATION
- <managerEventInstance>
- <synopsis>A user defined event raised from the dialplan.</synopsis>
- <syntax>
- <channel_snapshot/>
- <parameter name="UserEvent">
- <para>The event name, as specified in the dialplan.</para>
- </parameter>
- </syntax>
- <see-also>
- <ref type="application">UserEvent</ref>
- </see-also>
- </managerEventInstance>
- ***/
- manager_event(EVENT_FLAG_USER, "UserEvent",
- "%s"
- "UserEvent: %s\r\n"
- "%s",
- ast_str_buffer(channel_event_string), eventname, ast_str_buffer(body));
-}
-
static void publish_basic_channel_event(const char *event, int class, struct ast_channel_snapshot *snapshot)
{
RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
@@ -1160,9 +1112,6 @@ int manager_channels_init(void)
ast_channel_snapshot_type(), channel_snapshot_update, NULL);
ret |= stasis_message_router_add(message_router,
- ast_channel_user_event_type(), channel_user_event_cb, NULL);
-
- ret |= stasis_message_router_add(message_router,
ast_channel_dtmf_begin_type(), channel_dtmf_begin_cb, NULL);
ret |= stasis_message_router_add(message_router,