[Asterisk-code-review] res/res_stasis: Fixed wrong StasisEnd timestamp (...asterisk[16])
George Joseph
asteriskteam at digium.com
Tue Mar 19 09:27:05 CDT 2019
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11134 )
Change subject: res/res_stasis: Fixed wrong StasisEnd timestamp
......................................................................
res/res_stasis: Fixed wrong StasisEnd timestamp
Because StasisEnd's timestamp created it's own timestamp, it makes
wrong timestamp, compare to other channel event(ChannelDestroyed).
Fixed to getting a timestamp from the Channel's timestamp.
ASTERISK-28333
Change-Id: I5eb8380fc472f1100535a6bc4983c64767026116
---
M res/res_stasis.c
1 file changed, 13 insertions(+), 3 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/res/res_stasis.c b/res/res_stasis.c
index c01ce1a..25e2fe9 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -116,16 +116,23 @@
const struct stasis_message_sanitizer *sanitize)
{
struct ast_channel_blob *payload = stasis_message_data(message);
+ struct ast_json *msg;
if (sanitize && sanitize->channel_snapshot &&
sanitize->channel_snapshot(payload->snapshot)) {
return NULL;
}
- return ast_json_pack("{s: s, s: o, s: o}",
+ msg = ast_json_pack("{s: s, s: O, s: o}",
"type", "StasisEnd",
- "timestamp", ast_json_timeval(ast_tvnow(), NULL),
+ "timestamp", ast_json_object_get(payload->blob, "timestamp"),
"channel", ast_channel_snapshot_to_json(payload->snapshot, sanitize));
+ if (!msg) {
+ ast_log(LOG_ERROR, "Failed to pack JSON for StasisEnd message\n");
+ return NULL;
+ }
+
+ return msg;
}
STASIS_MESSAGE_TYPE_DEFN_LOCAL(end_message_type,
@@ -1063,7 +1070,10 @@
return 0;
}
- blob = ast_json_pack("{s: s}", "app", stasis_app_name(app));
+ blob = ast_json_pack("{s: s, s: o}",
+ "app", stasis_app_name(app),
+ "timestamp", ast_json_timeval(ast_tvnow(), NULL)
+ );
if (!blob) {
ast_log(LOG_ERROR, "Error packing JSON for StasisEnd message\n");
return -1;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11134
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I5eb8380fc472f1100535a6bc4983c64767026116
Gerrit-Change-Number: 11134
Gerrit-PatchSet: 5
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190319/ede7429c/attachment.html>
More information about the asterisk-code-review
mailing list