summaryrefslogtreecommitdiff
path: root/res/stasis
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2016-10-15 20:05:05 -0500
committerGeorge Joseph <gjoseph@digium.com>2016-10-17 08:15:08 -0500
commitdd5129d84adeb5580be626b0813a1a7fcb501e67 (patch)
treef263b93776f2d23a68569474eaac523b39c2d8af /res/stasis
parent5df575e16a11a906cd76b21205173da743305777 (diff)
res/ari: Add the Asterisk EID field to outgoing events
This patch adds the Asterisk EID field to all outgoing ARI events. Because this field should be added to all events as they are transmitted, it is appended to the JSON message just prior to it being handed off to the application message handler. This makes it somewhat resilient to both new events being added to ARI, as well as other potential event transport mechanisms. ASTERISK-26470 #close Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d
Diffstat (limited to 'res/stasis')
-rw-r--r--res/stasis/app.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c
index fb313df99..8bd1bc05a 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -929,8 +929,15 @@ struct stasis_topic *ast_app_get_topic(struct stasis_app *app)
void app_send(struct stasis_app *app, struct ast_json *message)
{
stasis_app_cb handler;
+ char eid[20];
RAII_VAR(void *, data, NULL, ao2_cleanup);
+ if (ast_json_object_set(message, "asterisk_id", ast_json_string_create(
+ ast_eid_to_str(eid, sizeof(eid), &ast_eid_default)))) {
+ ast_log(AST_LOG_WARNING, "Failed to append EID to outgoing event %s\n",
+ ast_json_string_get(ast_json_object_get(message, "type")));
+ }
+
/* Copy off mutable state with lock held */
{
SCOPED_AO2LOCK(lock, app);