summaryrefslogtreecommitdiff
path: root/main/stasis_channels.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-06-18 04:22:05 +0000
committerMatthew Jordan <mjordan@digium.com>2014-06-18 04:22:05 +0000
commita965613cf7eb65e9caf71d00614f00f9bda7c985 (patch)
treed44eb17c08c42592537675909ff494b73844ea3d /main/stasis_channels.c
parentfc52fd88847e9ff0dd3be7848be01ab757be97ac (diff)
stasis_channels: Update the stasis cache if manager variables are needed
In r416211, the publishing of variable changes was modified such that a cached channel snapshot was used if manager variables were not requested with each AMI event. This was done to reduce the amount of channel snapshots created. However, an assumption was made that generating a channel snapshot and publishing the snapshot to the channel topic was sufficient to ensure that the cache would be updated; this is not the case. The channel snapshot type must be used to force a snapshot update. This patch updates the publication of channel variables such that the cache is updated prior to publication of the channel variable message if manager variables are in use. This ensures that all AMI events receive the variable update when they are supposed to. Note that this issue was caught by the Asterisk Test Suite (go go testing) ........ Merged revisions 416557 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_channels.c')
-rw-r--r--main/stasis_channels.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c
index ad9da50cf..a1e7ad209 100644
--- a/main/stasis_channels.c
+++ b/main/stasis_channels.c
@@ -707,14 +707,18 @@ void ast_channel_publish_varset(struct ast_channel *chan, const char *name, cons
return;
}
- if (chan && !ast_channel_has_manager_vars()) {
+ /*! If there are manager variables, force a cache update */
+ if (chan && ast_channel_has_manager_vars()) {
+ ast_channel_publish_snapshot(chan);
+ }
+
+ if (chan) {
ast_channel_publish_cached_blob(chan, ast_channel_varset_type(), blob);
} else {
- /* This function is NULL safe. If there are manager variables,
- * we have to produce the full snapshot.
- */
- ast_channel_publish_blob(chan, ast_channel_varset_type(), blob);
+ /* This function is NULL safe for global variables */
+ ast_channel_publish_blob(NULL, ast_channel_varset_type(), blob);
}
+
ast_json_unref(blob);
}