[Asterisk-cvs] asterisk/channels chan_iax2.c,1.308,1.309

kpfleming at lists.digium.com kpfleming at lists.digium.com
Mon Jun 20 21:01:15 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv2297/channels

Modified Files:
	chan_iax2.c 
Log Message:
separate IAX2 protocol debugging and jitterbuffer debugging (bug #4523)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -d -r1.308 -r1.309
--- chan_iax2.c	13 Jun 2005 08:48:17 -0000	1.308
+++ chan_iax2.c	21 Jun 2005 01:02:07 -0000	1.309
@@ -662,7 +662,6 @@
 {
 	va_list args;
 	char buf[1024];
-	if(!iaxdebug) return;
 
 	va_start(args, fmt);
 	vsnprintf(buf, 1024, fmt, args);
@@ -2187,7 +2186,7 @@
 
 /* while we transition from the old JB to the new one, we can either make two schedule_delivery functions, or 
  * make preprocessor swiss-cheese out of this one.  I'm not sure which is less revolting.. */
-static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int updatehistory, int fromtrunk)
+static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk)
 {
 #ifdef NEWJB
 	int type, len;
@@ -2208,8 +2207,8 @@
 
 #if 0
 	if (option_debug)
-		ast_log(LOG_DEBUG, "schedule_delivery: ts=%d, last=%d, really=%d, update=%d\n",
-				fr->ts, iaxs[fr->callno]->last, reallydeliver, updatehistory);
+		ast_log(LOG_DEBUG, "schedule_delivery: ts=%d, last=%d, update=%d\n",
+				fr->ts, iaxs[fr->callno]->last, updatehistory);
 #endif
 
 	/* Attempt to recover wrapped timestamps */
@@ -2271,8 +2270,7 @@
 	}
 	else {
 #if 0
-		if (reallydeliver)
-			ast_log(LOG_DEBUG, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n");
+		ast_log(LOG_DEBUG, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n");
 #endif
 		fr->af.delivery.tv_sec = 0;
 		fr->af.delivery.tv_usec = 0;
@@ -2312,9 +2310,6 @@
 #endif
 
 #ifdef NEWJB
-	if(!reallydeliver)
-	    	return 0;
-
 	type = JB_TYPE_CONTROL;
 	len = 0;
 
@@ -2400,10 +2395,6 @@
 	/* update "min", just for RRs and stats */
 	iaxs[fr->callno]->min = min; 
 
-	/* If the caller just wanted us to update, return now */
-	if (!reallydeliver)
-		return 0;
-
 	/* Subtract the lateness from our jitter buffer to know how long to wait
 	   before sending our packet.  */
 	delay = iaxs[fr->callno]->jitterbuffer - ms;
@@ -4454,6 +4445,15 @@
 	return RESULT_SUCCESS;
 }
 
+static int iax2_do_debug(int fd, int argc, char *argv[])
+{
+	if (argc != 2)
+		return RESULT_SHOWUSAGE;
+	iaxdebug = 1;
+	ast_cli(fd, "IAX2 Debugging Enabled\n");
+	return RESULT_SUCCESS;
+}
+
 static int iax2_do_trunk_debug(int fd, int argc, char *argv[])
 {
 	if (argc != 3)
@@ -4463,15 +4463,14 @@
 	return RESULT_SUCCESS;
 }
 
-static int iax2_do_debug(int fd, int argc, char *argv[])
+static int iax2_do_jb_debug(int fd, int argc, char *argv[])
 {
-	if (argc != 2)
+	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	iaxdebug = 1;
 #ifdef NEWJB
 	jb_setoutput(jb_error_output, jb_warning_output, jb_debug_output);
 #endif
-	ast_cli(fd, "IAX2 Debugging Enabled\n");
+	ast_cli(fd, "IAX2 Jitterbuffer Debugging Enabled\n");
 	return RESULT_SUCCESS;
 }
 
@@ -4480,14 +4479,30 @@
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
 	iaxdebug = 0;
-#ifdef NEWJB
-	jb_setoutput(jb_error_output, jb_warning_output, NULL);
-#endif
 	ast_cli(fd, "IAX2 Debugging Disabled\n");
 	return RESULT_SUCCESS;
 }
 
+static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
+{
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+	iaxtrunkdebug = 0;
+	ast_cli(fd, "IAX2 Trunk Debugging Disabled\n");
+	return RESULT_SUCCESS;
+}
 
+static int iax2_no_jb_debug(int fd, int argc, char *argv[])
+{
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+#ifdef NEWJB
+	jb_setoutput(jb_error_output, jb_warning_output, NULL);
+#endif
+	jb_debug_output("\n");
+	ast_cli(fd, "IAX2 Jitterbuffer Debugging Disabled\n");
+	return RESULT_SUCCESS;
+}
 
 static int iax2_write(struct ast_channel *c, struct ast_frame *f)
 {
@@ -6251,14 +6266,14 @@
 									} else {
 										duped_fr = iaxfrdup2(&fr);
 										if (duped_fr) {
-											schedule_delivery(duped_fr, 1, updatehistory, 1);
+											schedule_delivery(duped_fr, updatehistory, 1);
 											fr.ts = duped_fr->ts;
 										}
 									}
 #else
 									duped_fr = iaxfrdup2(&fr);
 									if (duped_fr) {
-										schedule_delivery(duped_fr, 1, updatehistory, 1);
+										schedule_delivery(duped_fr, updatehistory, 1);
 										fr.ts = duped_fr->ts;
 									}
 #endif
@@ -7419,14 +7434,14 @@
 	} else {
 		duped_fr = iaxfrdup2(&fr);
 		if (duped_fr) {
-			schedule_delivery(duped_fr, 1, updatehistory, 0);
+			schedule_delivery(duped_fr, updatehistory, 0);
 			fr.ts = duped_fr->ts;
 		}
 	}
 #else
 	duped_fr = iaxfrdup2(&fr);
 	if (duped_fr) {
-		schedule_delivery(duped_fr, 1, updatehistory, 0);
+		schedule_delivery(duped_fr, updatehistory, 0);
 		fr.ts = duped_fr->ts;
 	}
 #endif
@@ -9079,6 +9094,18 @@
 "Usage: iax2 trunk debug\n"
 "       Requests current status of IAX trunking\n";
 
+static char no_debug_trunk_usage[] =
+"Usage: iax2 no trunk debug\n"
+"       Requests current status of IAX trunking\n";
+
+static char debug_jb_usage[] =
+"Usage: iax2 jb debug\n"
+"       Enables jitterbuffer debugging information\n";
+
+static char no_debug_jb_usage[] =
+"Usage: iax2 no jb debug\n"
+"       Disables jitterbuffer debugging information\n";
+
 static char iax2_test_losspct_usage[] =
 "Usage: iax2 test losspct <percentage>\n"
 "       For testing, throws away <percentage> percent of incoming packets\n";
@@ -9125,9 +9152,15 @@
 	{ { "iax2", "debug", NULL }, iax2_do_debug,
 	  "Enable IAX debugging", debug_usage },
 	{ { "iax2", "trunk", "debug", NULL }, iax2_do_trunk_debug,
-	  "Request snapshot of IAX trunk states", debug_trunk_usage },
+	  "Enable IAX trunk debugging", debug_trunk_usage },
+	{ { "iax2", "jb", "debug", NULL }, iax2_do_jb_debug,
+	  "Enable IAX jitterbuffer debugging", debug_jb_usage },
 	{ { "iax2", "no", "debug", NULL }, iax2_no_debug,
 	  "Disable IAX debugging", no_debug_usage },
+	{ { "iax2", "no", "trunk", "debug", NULL }, iax2_no_trunk_debug,
+	  "Disable IAX trunk debugging", no_debug_trunk_usage },
+	{ { "iax2", "no", "jb", "debug", NULL }, iax2_no_jb_debug,
+	  "Disable IAX jitterbuffer debugging", no_debug_jb_usage },
 	{ { "iax2", "test", "losspct", NULL }, iax2_test_losspct,
 	  "Set IAX2 incoming frame loss percentage", iax2_test_losspct_usage },
 	{ { "iax2", "provision", NULL }, iax2_prov_cmd,




More information about the svn-commits mailing list