[Asterisk-code-review] manager: Log AMI actions (...asterisk[master])

Kevin Harwell asteriskteam at digium.com
Tue Jul 9 14:43:34 CDT 2019


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11540


Change subject: manager: Log AMI actions
......................................................................

manager: Log AMI actions

When manager debugging is turned on, this patch makes it so incoming AMI actions
are now also logged.

Change-Id: I8047524510e7ac97d99482b2448f8e368f29cd47
---
M main/manager.c
1 file changed, 23 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/11540/1

diff --git a/main/manager.c b/main/manager.c
index b5388c2..e4638b3 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -6439,6 +6439,28 @@
 	return 0;
 }
 
+static void log_action(const struct message *m)
+{
+	struct ast_str *buf;
+	int x;
+
+	if (!manager_debug) {
+		return;
+	}
+
+	buf = ast_str_create(256);
+	if (!buf) {
+		return;
+	}
+
+	for (x = 0; x < m->hdrcount; x++) {
+		ast_str_append(&buf, 0, "%s\n", m->headers[x]);
+	}
+
+	ast_verbose("<--- Examining AMI action: -->\n%s\n", ast_str_buffer(buf));
+	ast_free(buf);
+}
+
 /*
  * Done with the action handlers here, we start with the code in charge
  * of accepting connections and serving them.
@@ -6527,6 +6549,7 @@
 				ao2_unlock(act_found);
 				if (mod_ref || !act_found->module) {
 					ast_debug(1, "Running action '%s'\n", act_found->action);
+					log_action(m);
 					ret = act_found->func(s, m);
 					acted = 1;
 					ast_module_unref(mod_ref);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I8047524510e7ac97d99482b2448f8e368f29cd47
Gerrit-Change-Number: 11540
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190709/29701c9d/attachment.html>


More information about the asterisk-code-review mailing list