[Asterisk-code-review] res/res_ari: Added timestamp as a requirement for all ARI events (...asterisk[master])

sungtae kim asteriskteam at digium.com
Thu Mar 7 14:54:14 CST 2019


sungtae kim has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/11100 )

Change subject: res/res_ari: Added timestamp as a requirement for all ARI events
......................................................................


Patch Set 2:

Found 1 more ARI event has no timestamp item. - ApplicationReplaced

Btw, instead of writing the timestamp from the message creating function, how about add the timestamp item at the void app_send(struct stasis_app *app, struct ast_json *message) for the future events?

Like this way.

void app_send(struct stasis_app *app, struct ast_json *message)
{
	stasis_app_cb handler;
	char eid[20];
	void *data;
	struct ast_json *j_timestamp;

	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")));
	}

	/* set the timestamp if it doesn't exist */
	j_timestamp = ast_json_object_create();
	if (j_timestamp) {
		ast_json_object_set(j_timestamp, "timestamp", ast_json_timeval(ast_tvnow(), NULL));
		ast_json_object_update_missing(message, j_timestamp);
	}

	/* Copy off mutable state with lock held */
	ao2_lock(app);
	handler = app->handler;
	data = ao2_bump(app->data);
	ao2_unlock(app);
	/* Name is immutable; no need to copy */
...


-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11100
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
Gerrit-Change-Number: 11100
Gerrit-PatchSet: 2
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: sungtae kim <pchero21 at gmail.com>
Gerrit-Comment-Date: Thu, 07 Mar 2019 20:54:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190307/3b987de1/attachment.html>


More information about the asterisk-code-review mailing list