[Asterisk-code-review] main/stasis.c: Added detail info for stasis show app cli (...asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Apr 23 13:18:07 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11253 )

Change subject: main/stasis.c: Added detail info for stasis show app cli
......................................................................

main/stasis.c: Added detail info for stasis show app cli

Currently, the "stasis show app" cli doesn't give detail
of subscription/subscriber information.
Added more printings to show details.

ASTERISK-28378

Change-Id: If25a6f14fe4f622bfb37462e891333da1fdf875f
---
M main/stasis.c
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/main/stasis.c b/main/stasis.c
index 4ce7052..e8ce0c7 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -2369,6 +2369,7 @@
 {
 	struct stasis_topic *topic;
 	char print_time[32];
+	int i;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -2402,6 +2403,21 @@
 	ast_format_duration_hh_mm_ss(ast_tvnow().tv_sec - topic->creationtime->tv_sec, print_time, sizeof(print_time));
 	ast_cli(a->fd, "Duration time: %s\n", print_time);
 
+	ao2_lock(topic);
+	ast_cli(a->fd, "\nSubscribers:\n");
+	for (i = 0; i < AST_VECTOR_SIZE(&topic->subscribers); i++) {
+		struct stasis_subscription *subscription_tmp = AST_VECTOR_GET(&topic->subscribers, i);
+		ast_cli(a->fd, "  UniqueID: %s, Topic: %s, Detail: %s\n",
+				subscription_tmp->uniqueid, subscription_tmp->topic->name, subscription_tmp->topic->detail);
+	}
+
+	ast_cli(a->fd, "\nForwarded topics:\n");
+	for (i = 0; i < AST_VECTOR_SIZE(&topic->upstream_topics); i++) {
+		struct stasis_topic *topic_tmp = AST_VECTOR_GET(&topic->upstream_topics, i);
+		ast_cli(a->fd, "  Topic: %s, Detail: %s\n", topic_tmp->name, topic_tmp->detail);
+	}
+	ao2_unlock(topic);
+
 	ao2_ref(topic, -1);
 
 	return CLI_SUCCESS;

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If25a6f14fe4f622bfb37462e891333da1fdf875f
Gerrit-Change-Number: 11253
Gerrit-PatchSet: 2
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: 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/20190423/547bafb9/attachment.html>


More information about the asterisk-code-review mailing list