[svn-commits] file: branch file/rtp_engine r131169 - /team/file/rtp_engine/main/rtp_engine.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 15 19:59:44 CDT 2008


Author: file
Date: Tue Jul 15 19:59:44 2008
New Revision: 131169

URL: http://svn.digium.com/view/asterisk?view=rev&rev=131169
Log:
Create manager events when an RTP instance is destroyed with some statistics.

Modified:
    team/file/rtp_engine/main/rtp_engine.c

Modified: team/file/rtp_engine/main/rtp_engine.c
URL: http://svn.digium.com/view/asterisk/team/file/rtp_engine/main/rtp_engine.c?view=diff&rev=131169&r1=131168&r2=131169
==============================================================================
--- team/file/rtp_engine/main/rtp_engine.c (original)
+++ team/file/rtp_engine/main/rtp_engine.c Tue Jul 15 19:59:44 2008
@@ -33,6 +33,7 @@
 #include "asterisk/frame.h"
 #include "asterisk/module.h"
 #include "asterisk/rtp_engine.h"
+#include "asterisk/manager.h"
 
 /* List of RTP engines that are currently registered */
 static AST_RWLIST_HEAD_STATIC(engines, ast_rtp_engine);
@@ -295,6 +296,30 @@
 
 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
 {
+	struct ast_rtp_instance_stats stats;
+
+	/* Before we destroy grab some statistics so we can create some manager events */
+	if (!ast_rtp_instance_get_stats(instance, &stats, AST_RTP_INSTANCE_STAT_ALL)) {
+		manager_event(EVENT_FLAG_REPORTING, "RTPReceiverStat", "SSRC: %u\r\n"
+			      "ReceivedPackets: %u\r\n"
+			      "LostPackets: %u\r\n"
+			      "Jitter: %u\r\n",
+			      stats.remote_ssrc,
+			      stats.rxcount,
+			      stats.rxploss,
+			      stats.rxjitter);
+		manager_event(EVENT_FLAG_REPORTING, "RTPSenderStat", "SSRC: %u\r\n"
+			      "SentPackets: %u\r\n"
+			      "LostPackets: %u\r\n"
+			      "Jitter: %u\r\n"
+			      "RTT: %u\r\n",
+			      stats.local_ssrc,
+			      stats.txcount,
+			      stats.txploss,
+			      stats.txjitter,
+			      stats.rtt);
+	}
+
 	/* Pass us off to the engine to destroy */
 	if (instance->engine->destroy(instance)) {
 		ast_debug(1, "Engine '%s' failed to destroy RTP instance '%p'\n", instance->engine->name, instance);




More information about the svn-commits mailing list