[Asterisk-code-review] app_chanspy: Spyee information was missing in ChanSpyStop AMI Event (asterisk[16])

Hendrik Wedhorn asteriskteam at digium.com
Wed Sep 9 07:59:03 CDT 2020


Hendrik Wedhorn has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14889 )


Change subject: app_chanspy: Spyee information was missing in ChanSpyStop AMI Event
......................................................................

app_chanspy: Spyee information was missing in ChanSpyStop AMI Event

The documentation in the wiki says there should be spyee-channel information elements in the ChanSpyStop AMI event.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerEvent_ChanSpyStop

However, this is not the case in Asterisk <= 16.10.0 Version. We're using these Spyee* arguments since Asterisk 11.x, so these arguments vanished in Asterisk 12 or higher.

ASTERISK-28883

Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
---
M apps/app_chanspy.c
M main/manager_channels.c
2 files changed, 20 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/89/14889/1

diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index c66d250..e7693c2 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -845,13 +845,13 @@
 	ast_audiohook_unlock(&csth.spy_audiohook);
 	ast_audiohook_destroy(&csth.spy_audiohook);
 
+        ast_verb(2, "Done Spying on channel %s\n", name);
+        publish_chanspy_message(chan, spyee_autochan->chan, 0);
+
 	if (spyee_bridge_autochan) {
 		ast_autochan_destroy(spyee_bridge_autochan);
 	}
 
-	ast_verb(2, "Done Spying on channel %s\n", name);
-	publish_chanspy_message(chan, NULL, 0);
-
 	return running;
 }
 
diff --git a/main/manager_channels.c b/main/manager_channels.c
index c964033..80c9e0d 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -825,23 +825,37 @@
 		struct stasis_message *message)
 {
 	RAII_VAR(struct ast_str *, spyer_channel_string, NULL, ast_free);
+       RAII_VAR(struct ast_str *, spyee_channel_string, NULL, ast_free);
 	struct ast_channel_snapshot *spyer;
+       struct ast_channel_snapshot *spyee;
 	struct ast_multi_channel_blob *payload = stasis_message_data(message);
 
 	spyer = ast_multi_channel_blob_get_channel(payload, "spyer_channel");
 	if (!spyer) {
-		ast_log(AST_LOG_WARNING, "Received ChanSpy Start event with no spyer channel!\n");
+               ast_log(AST_LOG_WARNING, "Received ChanSpy Stop event with no spyer channel!\n");
 		return;
 	}
+        spyee = ast_multi_channel_blob_get_channel(payload, "spyee_channel");
+        if (!spyee) {
+                ast_log(AST_LOG_WARNING, "Received ChanSpy Stop event with no spyee channel!\n");
+                return;
+        }
+
 
 	spyer_channel_string = ast_manager_build_channel_state_string_prefix(spyer, "Spyer");
 	if (!spyer_channel_string) {
 		return;
 	}
+        spyee_channel_string = ast_manager_build_channel_state_string_prefix(spyee, "Spyee");
+        if (!spyee_channel_string) {
+                return;
+        }
+
 
 	manager_event(EVENT_FLAG_CALL, "ChanSpyStop",
-		      "%s",
-		      ast_str_buffer(spyer_channel_string));
+                     "%s%s",
+                     ast_str_buffer(spyer_channel_string),
+                     ast_str_buffer(spyee_channel_string));
 }
 
 static void channel_chanspy_start_cb(void *data, struct stasis_subscription *sub,

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
Gerrit-Change-Number: 14889
Gerrit-PatchSet: 1
Gerrit-Owner: Hendrik Wedhorn <hwedhorn at addix.net>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200909/50a2915b/attachment-0001.html>


More information about the asterisk-code-review mailing list