[asterisk-commits] tzafrir: branch tzafrir/monitor-rtp r220175 - /team/tzafrir/monitor-rtp/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 24 12:12:59 CDT 2009


Author: tzafrir
Date: Thu Sep 24 12:12:55 2009
New Revision: 220175

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=220175
Log:
A workaround to send the final BYE even though we have no CDR

At hangup, chan_cdr is released in ast_hangup() and the monitoring is
stopped a bit later in the destructor of the channel object.

Thus when we get to monitor2rtp_stop(), we no longer have chan->cdr .

Previously I added a sanity check to just bail out in such a case. Now I
replace it with providing some dummy CDR data. Hopefully there will be a
better solution.

Modified:
    team/tzafrir/monitor-rtp/res/res_monitor.c

Modified: team/tzafrir/monitor-rtp/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/team/tzafrir/monitor-rtp/res/res_monitor.c?view=diff&rev=220175&r1=220174&r2=220175
==============================================================================
--- team/tzafrir/monitor-rtp/res/res_monitor.c (original)
+++ team/tzafrir/monitor-rtp/res/res_monitor.c Thu Sep 24 12:12:55 2009
@@ -380,14 +380,15 @@
 	int content_length;
 	int i;
 
-	if (!cdr)
-		return -1;
+	ast_log(LOG_NOTICE, "begin=%d, is_rx=%d, chan=%p, cdr=%p\n", begin, is_rx, chan, cdr);
+	//if (!cdr)
+	//	return -1;
 	ast_log(LOG_NOTICE, "%s-%s(%d): %s\n",
 			(begin) ? "BEGIN" : "END",
 			(is_rx) ? "RX" : "TX", ntohs(rtp_port), chan->uniqueid);
 #if 0
 	/* Debugging code */
-	{
+	if (cdr) {
 		char buf[BUFSIZ];
 
 		buf[0] = '\0';
@@ -396,7 +397,7 @@
 	}
 #endif
 #ifdef RTP_MONITOR_DEBUG
-	{
+	if (cdr) {
 		char buf[BUFSIZ];
 		int len = sizeof(buf);
 
@@ -422,9 +423,15 @@
 		ast_log(LOG_WARNING, "Cannot convert server ip address: %s\n", strerror(errno));
 		return -1;
 	}
+	if (cdr) {
 	ast_cdr_getvar(cdr, "src", &src, srcbuf, sizeof(srcbuf), 0, 0);
 	ast_cdr_getvar(cdr, "dst", &dst, dstbuf, sizeof(dstbuf), 0, 0);
 	ast_cdr_getvar(cdr, "clid", &clid, clidbuf, sizeof(clidbuf), 0, 0);
+	} else {
+		strcpy(srcbuf,"nocdr");  src  = srcbuf;
+		strcpy(dstbuf,"nocdr");  dst  = dstbuf;
+		strcpy(clidbuf,"nocdr"); clid = clidbuf;
+	}
 	if(begin) {
 		snprintf(payload, sizeof(payload),
 				"v=0\r\n"




More information about the asterisk-commits mailing list