Index: channel.c =================================================================== --- channel.c (revision 7832) +++ channel.c (working copy) @@ -193,13 +193,74 @@ } +static int show_channeltype(int fd, int argc, char *argv[]) +{ + struct chanlist *cl; + int found = 0; + + if (argc != 3) + return RESULT_SHOWUSAGE; + + if (ast_mutex_lock(&chlock)) { + ast_log(LOG_WARNING, "Unable to lock channel list\n"); + return -1; + } + + + for (cl = backends; cl; cl = cl->next) { + if (!strncasecmp(cl->tech->type, argv[2], strlen(cl->tech->type))) { + found = 1; + break; + } + } + + if (!found) { + ast_cli(fd, "\n%s is not a registered channel driver.\n", argv[2]); + ast_mutex_unlock(&chlock); + return -1; + } + + ast_cli(fd, + "-- Info about channel driver: %s --\n" + " Device State: %s\n" + " Indication: %s\n" + " Transfer : %s\n" + " Capabilities: %d\n" + " Send Digit: %s\n" + " Send HTML : %s\n" + " Image Support: %s\n" + " Text Support: %s\n", + cl->tech->type, + (cl->tech->devicestate) ? "yes" : "no", + (cl->tech->indicate) ? "yes" : "no", + (cl->tech->transfer) ? "yes" : "no", + (cl->tech->capabilities) ? cl->tech->capabilities : -1, + (cl->tech->send_digit) ? "yes" : "no", + (cl->tech->send_html) ? "yes" : "no", + (cl->tech->send_image) ? "yes" : "no", + (cl->tech->send_text) ? "yes" : "no" + + ); + + ast_mutex_unlock(&chlock); + return RESULT_SUCCESS; +} + + static char show_channeltypes_usage[] = "Usage: show channeltypes\n" " Shows available channel types registered in your Asterisk server.\n"; +static char show_channeltype_usage[] = +"Usage: show channeltype \n" +" Show all the details on that specified channel type .\n"; + static struct ast_cli_entry cli_show_channeltypes = { { "show", "channeltypes", NULL }, show_channeltypes, "Show available channel types", show_channeltypes_usage }; +static struct ast_cli_entry cli_show_channeltype = + { { "show", "channeltype", NULL }, show_channeltype, "Give more details on that channel type", show_channeltype_usage }; + /*! \brief Checks to see if a channel is needing hang up */ int ast_check_hangup(struct ast_channel *chan) { @@ -3778,6 +3839,7 @@ void ast_channels_init(void) { ast_cli_register(&cli_show_channeltypes); + ast_cli_register(&cli_show_channeltype); } /*! \brief Print call group and pickup group ---*/