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 /main | |
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 'main')
-rw-r--r-- | main/channel.c | 1 | ||||
-rw-r--r-- | main/manager_channels.c | 20 | ||||
-rw-r--r-- | main/stasis_channels.c | 10 |
3 files changed, 30 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c index 6bd253174..4bf2f61ef 100644 --- a/main/channel.c +++ b/main/channel.c @@ -7960,6 +7960,7 @@ void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_p ast_channel_lock(chan); ast_party_connected_line_set(ast_channel_connected(chan), connected, update); + ast_channel_publish_snapshot(chan); ast_channel_unlock(chan); } diff --git a/main/manager_channels.c b/main/manager_channels.c index 127084161..d431af24c 100644 --- a/main/manager_channels.c +++ b/main/manager_channels.c @@ -570,6 +570,23 @@ static struct ast_manager_event_blob *channel_new_callerid( ast_describe_caller_presentation(new_snapshot->caller_pres)); } +static struct ast_manager_event_blob *channel_new_connected_line( + struct ast_channel_snapshot *old_snapshot, + struct ast_channel_snapshot *new_snapshot) +{ + /* No NewConnectedLine 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; + } + + return ast_manager_event_blob_create( + EVENT_FLAG_CALL, "NewConnectedLine", "%s", ""); +} + static struct ast_manager_event_blob *channel_new_accountcode( struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) @@ -591,7 +608,8 @@ channel_snapshot_monitor channel_monitors[] = { channel_state_change, channel_newexten, channel_new_callerid, - channel_new_accountcode + channel_new_accountcode, + channel_new_connected_line, }; static void channel_snapshot_update(void *data, struct stasis_subscription *sub, diff --git a/main/stasis_channels.c b/main/stasis_channels.c index cc5a9f587..816efdb45 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -938,6 +938,16 @@ int ast_channel_snapshot_caller_id_equal( strcmp(old_snapshot->caller_name, new_snapshot->caller_name) == 0; } +int ast_channel_snapshot_connected_line_equal( + const struct ast_channel_snapshot *old_snapshot, + const struct ast_channel_snapshot *new_snapshot) +{ + ast_assert(old_snapshot != NULL); + ast_assert(new_snapshot != NULL); + return strcmp(old_snapshot->connected_number, new_snapshot->connected_number) == 0 && + strcmp(old_snapshot->connected_name, new_snapshot->connected_name) == 0; +} + static struct ast_json *channel_blob_to_json( struct stasis_message *message, const char *type, |