aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-31 00:04:41 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-31 00:04:41 +0000
commita6a2f18023d64d01cd437fe2b04cf590898b51b0 (patch)
treee592d78d99448f231b6bdc5fb0a99353e0adae39
parent1912592f1baa0913cd385bdaa2f218bba8ac0b27 (diff)
Merge OEJ's channel type listing (bug #3187) with slight modifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4614 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xasterisk.c1
-rwxr-xr-xasterisk.h2
-rwxr-xr-xchannel.c32
3 files changed, 35 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index 76e98b319..59e22cf38 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -1832,6 +1832,7 @@ int main(int argc, char *argv[])
printf(term_quit());
exit(1);
}
+ ast_channels_init();
if (init_manager()) {
printf(term_quit());
exit(1);
diff --git a/asterisk.h b/asterisk.h
index 08fc295d5..e1cf447ac 100755
--- a/asterisk.h
+++ b/asterisk.h
@@ -50,5 +50,7 @@ extern int reload_logger(int);
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
diff --git a/channel.c b/channel.c
index c30f3838e..8be15ea54 100755
--- a/channel.c
+++ b/channel.c
@@ -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 @@ struct ast_channel *channels = NULL;
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 @@ void ast_moh_cleanup(struct ast_channel *chan)
ast_moh_cleanup_ptr(chan);
}
+void ast_channels_init(void)
+{
+ ast_cli_register(&cli_show_channeltypes);
+}