diff options
author | Mark Michelson <mmichelson@digium.com> | 2014-12-08 16:24:36 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2014-12-08 16:24:36 +0000 |
commit | fe7671fee69b0ce1a6120a9ccb6664c5f31d37d3 (patch) | |
tree | 108d125bf0ea17e17cfb63bf5d7d89756eb30f7e /res/stasis | |
parent | 4bb556a8478741dc81361327d3a50a8809be09f6 (diff) |
Add new AMI and ARI events for connected line changes on a channel.
The AMI event is called NewConnectedLine and the ARI event is called
ChannelConnectedLine.
ASTERISK-24554 #close
Reported by Matt Jordan
Review: https://reviewboard.asterisk.org/r/4231
........
Merged revisions 429064 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis')
-rw-r--r-- | res/stasis/app.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c index 725414561..1cc4fb511 100644 --- a/res/stasis/app.c +++ b/res/stasis/app.c @@ -450,10 +450,38 @@ static struct ast_json *channel_callerid( "channel", json_channel); } +static struct ast_json *channel_connected_line( + struct ast_channel_snapshot *old_snapshot, + struct ast_channel_snapshot *new_snapshot, + const struct timeval *tv) +{ + struct ast_json *json_channel; + + /* No ChannelConnectedLine event on cache clear or first event */ + if (!old_snapshot || !new_snapshot) { + return NULL; + } + + if (ast_channel_snapshot_connected_line_equal(old_snapshot, new_snapshot)) { + return NULL; + } + + json_channel = ast_channel_snapshot_to_json(new_snapshot, stasis_app_get_sanitizer()); + if (!json_channel) { + return NULL; + } + + return ast_json_pack("{s: s, s: o, s: o}", + "type", "ChannelConnectedLine", + "timestamp", ast_json_timeval(*tv, NULL), + "channel", json_channel); +} + static channel_snapshot_monitor channel_monitors[] = { channel_state, channel_dialplan, channel_callerid, + channel_connected_line, }; static void sub_channel_update_handler(void *data, |