[asterisk-commits] oej: branch oej/pinefrog-1.4 r248348 - in /team/oej/pinefrog-1.4: channels/ i...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 22 15:02:11 CST 2010


Author: oej
Date: Mon Feb 22 15:02:06 2010
New Revision: 248348

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=248348
Log:
- Adding uniqueid to reports
- Updating realtime support

Modified:
    team/oej/pinefrog-1.4/channels/chan_sip.c
    team/oej/pinefrog-1.4/include/asterisk/rtp.h
    team/oej/pinefrog-1.4/main/rtp.c

Modified: team/oej/pinefrog-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/channels/chan_sip.c?view=diff&rev=248348&r1=248347&r2=248348
==============================================================================
--- team/oej/pinefrog-1.4/channels/chan_sip.c (original)
+++ team/oej/pinefrog-1.4/channels/chan_sip.c Mon Feb 22 15:02:06 2010
@@ -13443,12 +13443,12 @@
 	char localjitter[10], remotejitter[10];
 	int qosrealtime = ast_check_realtime("rtpqos");
 	long int duration;	/* Duration in secs */
-	struct ast_channel *bridgepeer = NULL;
 
 	if (p && p->owner) {
-		bridgepeer = ast_bridged_channel(p->owner);
+		struct ast_channel *bridgepeer = ast_bridged_channel(p->owner);
 		if (bridgepeer) {
-			ast_rtcp_set_bridged(rtp, bridgepeer->name);
+			/* Store the bridged peer data while we have it */
+			ast_rtcp_set_bridged(rtp, bridgepeer->name, bridgepeer->uniqueid);
 		}
 	}
 
@@ -13461,7 +13461,9 @@
 		duration = (long int)(ast_tvdiff_ms(ast_tvnow(), qual.start) / 1000);
 		manager_event(EVENT_FLAG_CALL, "RTPQuality", 
 			"Channel: %s\r\n"			/* AST_CHANNEL for this call */
+			"Uniqueid: %s\r\n"			/* AST_CHANNEL for this call */
 			"BridgedChannel: %s\r\n"
+			"BridgedUniqueid: %s\r\n"
 			"RTPreporttype: %s\r\n"
 			"RTPrtcpstatus: %s\r\n"
 			"Duration: %ld\r\n"		/* used in cdr_manager */
@@ -13483,7 +13485,9 @@
 			"RTPOutPlPercent: %5.2f\r\n"
 			"\r\n", 
 			p->owner ? p->owner->name : "",
+			p->owner ? p->owner->uniqueid : "",
 			qual.bridgedchan,
+			qual.bridgeduniqueid,
 			endreport ? "Final" : "Update",
 			qual.numberofreports == 0 ? "Inactive" : "Active",
 			duration,
@@ -13509,20 +13513,37 @@
 			(qual.local_count + qual.remote_lostpackets) > 0 ? (double) qual.remote_lostpackets / qual.local_count  * 100 : 0
 			);
 	}
+#ifdef REALTIME2
 	/* CDR records are not reliable when it comes to near-death-of-channel events, so we need to store the RTCP
 	   report in realtime when we have it */
 	if (endreport && qosrealtime) {
+		char buf_duration[10], buf_lssrc[30], buf_rssrc[30], buf_rtt[30];
+		duration = (long int)(ast_tvdiff_ms(ast_tvnow(), qual.start) / 1000);
+
 		if (rtpqstring == NULL) {
 			rtpqstring =  ast_rtp_get_quality(rtp, &qual);
 		}
 		sprintf(localjitter, "%f", qual.local_jitter);
 		sprintf(remotejitter, "%f", qual.remote_jitter);
-#ifdef REALTIME2
-		/* This only works with updated realtime system that has the "ast_store_realtime" support that's not generally available in 
-		   Asterisk 1.4. It's part of the Appleraisin-1.4 branch though. 
-		*/
-		ast_store_realtime("rtpqos", "Channel", p->owner ? p->owner->name : "", "pvtcallid", p->callid, "rtpmedia", mediatype, "localssrc", qual.local_ssrc, "remotessrc", qual.remote_ssrc, "rtt", qual.rtt, "localjitter", localjitter, "remotejitter", remotejitter, NULL);
-#endif
+		sprintf(buf_lssrc, "%u", qual.local_ssrc);
+		sprintf(buf_rssrc, "%u", qual.remote_ssrc);
+		sprintf(buf_rtt, "%f", qual.rtt);
+		sprintf(buf_duration, "%ld", duration);
+		ast_store_realtime("rtpqos", 
+			"channel", p->owner ? p->owner->name : "", 
+			"uniqueid", p->owner ? p->owner->uniqueid : "", 
+			"bridgedchan", qual.bridgedchan,
+			"bridgeduniqueid", qual.bridgeduniqueid,
+			"pvtcallid", p->callid, 
+			"rtpmedia", mediatype, 
+			"localssrc", buf_lssrc, "remotessrc", buf_rssrc,
+			"rtt", buf_rtt, 
+			"localjitter", localjitter, "remotejitter", remotejitter, 
+			"sendformat", ast_getformatname(qual.lasttxformat),
+			"receiveformat", ast_getformatname(qual.lastrxformat),
+			"rtcpstatus", qual.numberofreports == 0 ? "Inactive" : "Active",
+			"duration", buf_duration,
+			NULL);
 	}
 }
 

Modified: team/oej/pinefrog-1.4/include/asterisk/rtp.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/include/asterisk/rtp.h?view=diff&rev=248348&r1=248347&r2=248348
==============================================================================
--- team/oej/pinefrog-1.4/include/asterisk/rtp.h (original)
+++ team/oej/pinefrog-1.4/include/asterisk/rtp.h Mon Feb 22 15:02:06 2010
@@ -80,6 +80,7 @@
 /*! \brief Data structure only used for RTCP reports */
 struct ast_rtp_quality {
 	char bridgedchan[AST_MAX_EXTENSION];	/*!< Name of bridged channel */
+	char bridgeduniqueid[AST_MAX_EXTENSION];	/*!< uniqueid of bridged channel */
 	unsigned int numberofreports;	  /*!< Number of reports received from remote end */
 	unsigned int local_ssrc;          /*!< Our SSRC */
 	unsigned int local_lostpackets;   /*!< Our lost packets */
@@ -201,7 +202,7 @@
 it can be reset by first setting it to an empty string, then setting to 
 a new name 
 */
-void ast_rtcp_set_bridged(struct ast_rtp *rtp, const char *bridged_name);
+void ast_rtcp_set_bridged(struct ast_rtp *rtp, const char *bridged_name, const char *bridged_uniqueid);
 
 
 

Modified: team/oej/pinefrog-1.4/main/rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinefrog-1.4/main/rtp.c?view=diff&rev=248348&r1=248347&r2=248348
==============================================================================
--- team/oej/pinefrog-1.4/main/rtp.c (original)
+++ team/oej/pinefrog-1.4/main/rtp.c Mon Feb 22 15:02:06 2010
@@ -2363,7 +2363,7 @@
 it can be reset by first setting it to an empty string, then setting to 
 a new name 
 */
-void ast_rtcp_set_bridged(struct ast_rtp *rtp, const char *bridged_name)
+void ast_rtcp_set_bridged(struct ast_rtp *rtp, const char *bridged_name, const char *bridged_uniqueid)
 {
 	if (!rtp) {		/* For some reason, there's no RTP */
 		return;
@@ -2376,6 +2376,7 @@
 		return;
 	}
 	ast_copy_string(rtp->rtcp->bridgedchan, bridged_name, sizeof(rtp->rtcp->bridgedchan));
+	ast_copy_string(rtp->rtcp->bridgeduniqueid, bridged_uniqueid, sizeof(rtp->rtcp->bridgeduniqueid));
 }
 
 int ast_rtp_settos(struct ast_rtp *rtp, int tos)




More information about the asterisk-commits mailing list