Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.60
diff -u -r1.60 cli.c
--- cli.c	22 Oct 2004 20:59:37 -0000	1.60
+++ cli.c	6 Nov 2004 17:55:20 -0000
@@ -37,6 +37,8 @@
 #define VERSION_INFO "Asterisk " ASTERISK_VERSION " built by " BUILD_USER "@" BUILD_HOSTNAME \
 	" on a " BUILD_MACHINE " running " BUILD_OS
 	
+extern unsigned long global_fin, global_fout;
+	
 void ast_cli(int fd, char *fmt, ...)
 {
 	char *stuff;
@@ -548,47 +550,73 @@
 static int handle_debugchan(int fd, int argc, char *argv[])
 {
 	struct ast_channel *c=NULL;
+	int is_all;
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
+
+	is_all = !strcasecmp("all", argv[2]);
+	if (is_all) {
+		global_fin |= 0x80000000;
+		global_fout |= 0x80000000;
+	}
 	c = ast_channel_walk_locked(NULL);
 	while(c) {
-		if (!strcasecmp(c->name, argv[2])) {
-			c->fin |= 0x80000000;
-			c->fout |= 0x80000000;
-			break;
+		if (is_all || !strcasecmp(c->name, argv[2])) {
+			if (!(c->fin & 0x80000000) || !(c->fout & 0x80000000)) {
+				c->fin |= 0x80000000;
+				c->fout |= 0x80000000;
+				ast_cli(fd, "Debugging enabled on channel %s\n", c->name);
+			}
+			if (!is_all)
+				break;
 		}
 		ast_mutex_unlock(&c->lock);
 		c = ast_channel_walk_locked(c);
 	}
-	if (c) {
-		ast_cli(fd, "Debugging enabled on channel %s\n", c->name);
-		ast_mutex_unlock(&c->lock);
+	if (!is_all) {
+		if (c)
+			ast_mutex_unlock(&c->lock);
+		else
+			ast_cli(fd, "No such channel %s\n", argv[2]);
 	}
 	else
-		ast_cli(fd, "No such channel %s\n", argv[2]);
+		ast_cli(fd, "Debugging on new channels is enabled\n");
 	return RESULT_SUCCESS;
 }
 
 static int handle_nodebugchan(int fd, int argc, char *argv[])
 {
 	struct ast_channel *c=NULL;
+	int is_all;
 	if (argc != 4)
 		return RESULT_SHOWUSAGE;
+	is_all = !strcasecmp("all", argv[3]);
+	if (is_all) {
+		global_fin &= ~0x80000000;
+		global_fout &= ~0x80000000;
+	}
 	c = ast_channel_walk_locked(NULL);
 	while(c) {
-		if (!strcasecmp(c->name, argv[3])) {
-			c->fin &= 0x7fffffff;
-			c->fout &= 0x7fffffff;
-			break;
+		if (is_all || !strcasecmp(c->name, argv[3])) {
+			if ((c->fin & 0x80000000) || (c->fout & 0x80000000)) {
+				c->fin &= 0x7fffffff;
+				c->fout &= 0x7fffffff;
+				ast_cli(fd, "Debugging disabled on channel %s\n", c->name);
+			}
+			if (!is_all)
+				break;
 		}
 		ast_mutex_unlock(&c->lock);
 		c = ast_channel_walk_locked(c);
 	}
-	if (c) {
-		ast_cli(fd, "Debugging disabled on channel %s\n", c->name);
-		ast_mutex_unlock(&c->lock);
-	} else
-		ast_cli(fd, "No such channel %s\n", argv[2]);
+	if (!is_all) {
+		if (c)
+			ast_mutex_unlock(&c->lock);
+		else
+			ast_cli(fd, "No such channel %s\n", argv[3]);
+	}
+	else
+		ast_cli(fd, "Debugging on new channels is disabled\n");
 	return RESULT_SUCCESS;
 }
 		
Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.146
diff -u -r1.146 channel.c
--- channel.c	3 Nov 2004 22:37:55 -0000	1.146
+++ channel.c	6 Nov 2004 17:55:21 -0000
@@ -59,6 +59,8 @@
 static int shutting_down = 0;
 static int uniqueint = 0;
 
+unsigned long global_fin = 0, global_fout = 0;
+
 /* XXX Lock appropriately in more functions XXX */
 
 struct chanlist {
@@ -334,8 +336,8 @@
 					tmp->streamid = -1;
 					tmp->appl = NULL;
 					tmp->data = NULL;
-					tmp->fin = 0;
-					tmp->fout = 0;
+					tmp->fin = global_fin;
+					tmp->fout = global_fout;
 					snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long)time(NULL), uniqueint++);
 					headp=&tmp->varshead;
 					ast_mutex_init(&tmp->lock);
Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.36
diff -u -r1.36 frame.c
--- frame.c	19 Jul 2004 15:52:57 -0000	1.36
+++ frame.c	6 Nov 2004 17:55:21 -0000
@@ -607,7 +607,7 @@
 	char subclass[40] = "Unknown Subclass";
 	char csub[80];
 	char moreinfo[40] = "";
-	char cn[40];
+	char cn[60];
 	char cp[40];
 	char cmn[40];
 	if (name)
@@ -672,9 +672,13 @@
 		case AST_CONTROL_RADIO_UNKEY:
 			strcpy(subclass, "Unkey Radio");
 			break;
+		case -1:
+			strcpy(subclass, "Stop generators");
+			break;
 		default:
 			snprintf(subclass, sizeof(subclass), "Unknown control '%d'", f->subclass);
 		}
+		break;
 	case AST_FRAME_NULL:
 		strcpy(ftype, "Null Frame");
 		strcpy(subclass, "N/A");
