summaryrefslogtreecommitdiff
path: root/main/stasis_channels.c
diff options
context:
space:
mode:
authorSebastien Duthil <sduthil@proformatique.com>2016-11-11 11:45:37 -0500
committerSebastien Duthil <sduthil@proformatique.com>2016-11-14 13:51:56 -0500
commitc6d755de11e98c1f6f33b1b35db9725f64f72053 (patch)
tree2299d268ffdce70a50dafacc20cc56509a79f4c4 /main/stasis_channels.c
parent7540036427f87bfe3c87357ac33c08561f191e98 (diff)
res_ari: Add support for channel variables in ARI events.
This works the same as for AMI manager variables. Set "channelvars=foo,bar" in your ari.conf general section, and then the channel variables "foo" and "bar" (along with their values), will appear in every Stasis websocket channel event. ASTERISK-26492 #close patches: ari_vars.diff submitted by Mark Michelson Change-Id: I5609ba239259577c0948645df776d7f3bc864229
Diffstat (limited to 'main/stasis_channels.c')
-rw-r--r--main/stasis_channels.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c
index 91f209290..4897af89e 100644
--- a/main/stasis_channels.c
+++ b/main/stasis_channels.c
@@ -270,6 +270,7 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha
ast_set_flag(&snapshot->softhangup_flags, ast_channel_softhangup_internal_flag(chan));
snapshot->manager_vars = ast_channel_get_manager_vars(chan);
+ snapshot->ari_vars = ast_channel_get_ari_vars(chan);
snapshot->tech_properties = ast_channel_tech(chan)->properties;
return snapshot;
@@ -918,6 +919,10 @@ struct ast_json *ast_channel_snapshot_to_json(
"creationtime", ast_json_timeval(snapshot->creationtime, NULL),
"language", snapshot->language);
+ if (snapshot->ari_vars && !AST_LIST_EMPTY(snapshot->ari_vars)) {
+ ast_json_object_set(json_chan, "channelvars", ast_json_channel_vars(snapshot->ari_vars));
+ }
+
return ast_json_ref(json_chan);
}