[Asterisk-cvs] asterisk channel.c, 1.146, 1.147 cli.c, 1.60, 1.61 frame.c, 1.36, 1.37

markster at lists.digium.com markster at lists.digium.com
Sat Nov 6 16:31:11 CST 2004


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

Modified Files:
	channel.c cli.c frame.c 
Log Message:
Add features (incomplete, highly experimental), fix DundiLookup app, debug improvements (bug #2800)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- channel.c	3 Nov 2004 22:37:55 -0000	1.146
+++ channel.c	6 Nov 2004 21:33:01 -0000	1.147
@@ -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: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- cli.c	22 Oct 2004 20:59:37 -0000	1.60
+++ cli.c	6 Nov 2004 21:33:01 -0000	1.61
@@ -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: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- frame.c	19 Jul 2004 15:52:57 -0000	1.36
+++ frame.c	6 Nov 2004 21:33:01 -0000	1.37
@@ -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");




More information about the svn-commits mailing list