Index: include/asterisk/manager.h =================================================================== --- include/asterisk/manager.h (revision 48974) +++ include/asterisk/manager.h (working copy) @@ -55,6 +55,7 @@ #define EVENT_FLAG_AGENT (1 << 5) /* Ability to read/set agent info */ #define EVENT_FLAG_USER (1 << 6) /* Ability to read/set user info */ #define EVENT_FLAG_CONFIG (1 << 7) /* Ability to modify configurations */ +#define EVENT_FLAG_REPORTING (1 << 8) /* Reporting events such as rtcp sent */ /* Export manager structures */ #define AST_MAX_MANHEADERS 80 Index: main/manager.c =================================================================== --- main/manager.c (revision 48974) +++ main/manager.c (working copy) @@ -291,6 +291,7 @@ { EVENT_FLAG_AGENT, "agent" }, { EVENT_FLAG_USER, "user" }, { EVENT_FLAG_CONFIG, "config" }, + { EVENT_FLAG_REPORTING, "reporting" }, { -1, "all" }, { 0, "none" }, }; Index: main/rtp.c =================================================================== --- main/rtp.c (revision 48974) +++ main/rtp.c (working copy) @@ -54,6 +54,7 @@ #include "asterisk/lock.h" #include "asterisk/utils.h" #include "asterisk/cli.h" +#include "asterisk/manager.h" #include "asterisk/unaligned.h" #include "asterisk/utils.h" @@ -982,6 +983,10 @@ if (rtt) ast_verbose("RTT: %f(sec)\n", rtt); } + if(rtt) + manager_event(EVENT_FLAG_REPORTING, "RTCPReceived", "From %s:%d\r\nPT: %d(%s)\r\nReceptionReports: %d\r\nSenderSSRC: %u\r\nFractionLost: %ld\r\nPacketsLost: %d\r\nHighestSeq: %ld\r\nSeqNumberCycles: %ld\r\nIAJitter: %u\r\nLastSR: %lu.%010lu\r\nDLSR: %4.4f (sec)\r\nRTT: %f(sec)\r\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown", rc, rtcpheader[i + 1], (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24), rtp->rtcp->reported_lost, (long) (ntohl(rtcpheader[i + 2]) & 0xffff), (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16, rtp->rtcp->reported_jitter,(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096,ntohl(rtcpheader[i + 5])/65536.0, rtt); + else + manager_event(EVENT_FLAG_REPORTING, "RTCPReceived", "From %s:%d\r\nPT: %d(%s)\r\nReceptionRreports: %d\r\nSenderSSRC: %u\r\nFractionLost: %ld\r\nPacketsLost: %d\r\nHighestSeq: %ld\r\nSeqNumberCycles: %ld\r\nIAJitter: %u\r\nLastSR: %lu.%010lu\r\nDLSR: %4.4f (sec)\r\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), pt, (pt == 200) ? "Sender Report" : (pt == 201) ? "Receiver Report" : (pt == 192) ? "H.261 FUR" : "Unknown", rc, rtcpheader[i + 1], (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24), rtp->rtcp->reported_lost, (long) (ntohl(rtcpheader[i + 2]) & 0xffff), (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16, rtp->rtcp->reported_jitter,(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096,ntohl(rtcpheader[i + 5])/65536.0); break; case RTCP_PT_FUR: if (rtcp_debug_test_addr(&sin)) @@ -2098,6 +2103,8 @@ ast_verbose(" RTT: %f\n", rtp->rtcp->rtt); } + manager_event(EVENT_FLAG_REPORTING, "RTPRecvStat", "SSRC: %u\r\nRecvdPackets: %u\r\nLostPackets: %u\r\nJitter: %.4f\r\nTransit: %.4f\r\nRRCount: %u\r\n",rtp->themssrc,rtp->rxcount,rtp->rtcp->expected_prior - rtp->rtcp->received_prior,rtp->rxjitter,rtp->rxtransit,rtp->rtcp->rr_count); + manager_event(EVENT_FLAG_REPORTING, "RTPSndrStat", "SSRC: %u\r\nSentPackets: %u\r\nLostPackets: %u\r\nJitter: %u\r\nSRCount: %u\r\nRTT: %f\r\n", rtp->ssrc,rtp->txcount,rtp->rtcp->reported_lost,rtp->rtcp->reported_jitter,rtp->rtcp->sr_count,rtp->rtcp->rtt); if (rtp->smoother) ast_smoother_free(rtp->smoother); if (rtp->ioid) @@ -2415,6 +2422,7 @@ ast_verbose(" Their last SR: %u\n", rtp->rtcp->themrxlsr); ast_verbose(" DLSR: %4.4f (sec)\n\n", (double)(ntohl(rtcpheader[12])/65536.0)); } + manager_event(EVENT_FLAG_REPORTING, "RTCPSent", "To %s:%d\r\nOurSSRC: %u\r\nSentNTP: %u.%010u\r\nSentRTP: %u\r\nSentPackets: %u\r\nSentOctets: %u\r\nReportBlock:\r\nFractionLost: %u\r\nCumulativeLoss: %u\r\nIAJitter: %.4f\r\nTheirLastSR: %u\r\nDLSR: %4.4f (sec)\r\n", ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port), rtp->ssrc, (unsigned int)now.tv_sec, (unsigned int)now.tv_usec*4096, rtp->lastts, rtp->txcount, rtp->txoctetcount, fraction, lost, rtp->rxjitter, rtp->rtcp->themrxlsr, (double)(ntohl(rtcpheader[12])/65536.0)); return res; }