[Asterisk-cvs] asterisk asterisk.c, 1.133, 1.134 asterisk.h, 1.13, 1.14 channel.c, 1.154, 1.155

markster at lists.digium.com markster at lists.digium.com
Thu Dec 30 19:10:02 CST 2004


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

Modified Files:
	asterisk.c asterisk.h channel.c 
Log Message:
Merge OEJ's channel type listing (bug #3187) with slight modifications


Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- asterisk.c	29 Dec 2004 07:46:10 -0000	1.133
+++ asterisk.c	31 Dec 2004 00:04:41 -0000	1.134
@@ -1832,6 +1832,7 @@
 		printf(term_quit());
 		exit(1);
 	}
+	ast_channels_init();
 	if (init_manager()) {
 		printf(term_quit());
 		exit(1);

Index: asterisk.h
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- asterisk.h	7 Sep 2004 15:02:53 -0000	1.13
+++ asterisk.h	31 Dec 2004 00:04:41 -0000	1.14
@@ -50,5 +50,7 @@
 extern int term_init(void);
 /* Provided by db.c */
 extern int astdb_init(void);
+/* Provided by channel.c */
+extern void ast_channels_init(void);
 
 #endif

Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- channel.c	24 Dec 2004 01:40:07 -0000	1.154
+++ channel.c	31 Dec 2004 00:04:41 -0000	1.155
@@ -29,6 +29,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/say.h>
 #include <asterisk/file.h>
+#include <asterisk/cli.h>
 #include <asterisk/translate.h>
 #include <asterisk/manager.h>
 #include <asterisk/chanvars.h>
@@ -49,6 +50,7 @@
 #error "You need newer zaptel!  Please cvs update zaptel"
 #endif
 #endif
+#include "asterisk.h"
 
 /* uncomment if you have problems with 'monitoring' synchronized files */
 #if 0
@@ -78,6 +80,32 @@
    
 AST_MUTEX_DEFINE_STATIC(chlock);
 
+static int show_channeltypes(int fd, int argc, char *argv[])
+{
+#define FORMAT  "%-7.7s  %-50.50s\n"
+	struct chanlist *cl = backends;
+	ast_cli(fd, FORMAT, "Type", "Description");
+	ast_cli(fd, FORMAT, "------", "-----------");
+	if (ast_mutex_lock(&chlock)) {
+		ast_log(LOG_WARNING, "Unable to lock channel list\n");
+		return -1;
+	}
+	while (cl) {
+		ast_cli(fd, FORMAT, cl->type, cl->description);
+		cl = cl->next;
+	}
+	ast_mutex_unlock(&chlock);
+	return RESULT_SUCCESS;
+
+}
+
+static char show_channeltypes_usage[] = 
+"Usage: show channeltypes\n"
+"       Shows available channel types registred in your Asterisk server.";
+
+static struct ast_cli_entry cli_show_channeltypes = 
+	{ { "show", "channeltypes", NULL }, show_channeltypes, "Show available channel types", show_channeltypes_usage };
+
 int ast_check_hangup(struct ast_channel *chan)
 {
 time_t	myt;
@@ -3011,3 +3039,7 @@
         ast_moh_cleanup_ptr(chan);
 }
 
+void ast_channels_init(void)
+{
+	ast_cli_register(&cli_show_channeltypes);
+}




More information about the svn-commits mailing list