Index: main/translate.c =================================================================== --- main/translate.c (revision 92267) +++ main/translate.c (working copy) @@ -483,6 +483,7 @@ } } +//caio static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { #define SHOW_TRANS 13 @@ -493,6 +494,53 @@ case CLI_INIT: e->command = "core show translation [recalc]"; e->usage = + "Usage: core show translation [recalc []]\n"; + return NULL; + case CLI_GENERATE: + return NULL; + } + return CLI_SHOWUSAGE; + + AST_RWLIST_RDLOCK(&translators); + for (x = -1; x < SHOW_TRANS; x++) { + struct ast_str *out = ast_str_alloca(120); + + for (y = -1; y < SHOW_TRANS; y++) { + /*curlen = strlen(ast_getformatname(1 << (y))); + if (curlen < 5) + curlen = 5; + if (x >= 0 && y >= 0 && tr_matrix[x][y].step) { + ast_str_append(&out, -1, "%*d", curlen + 1, tr_matrix[x][y].cost > 99999 ? 0 : tr_matrix[x][y].cost); + } else if (x == -1 && y >= 0) { + ast_str_append(&out, -1, "%*s", curlen + 1, ast_getformatname(1 << (x + y + 1)) ); + } else if (y == -1 && x >= 0) { + ast_str_append(&out, -1, "%*s", longest, ast_getformatname(1 << (x + y + 1)) ); + } else if (x >= 0 && y >= 0) { + ast_str_append(&out, -1, "%*s", curlen + 1, "-"); + } else { + ast_str_append(&out, -1, "%*s", longest, ""); + } + */ + + } + ast_cli(a->fd, "%s \n", ast_getformatname(1 << (x + 1))); + ast_str_append(&out, -1, "\n"); + ast_cli(a->fd, out->str); + } + AST_RWLIST_UNLOCK(&translators); + return CLI_SUCCESS; +} + +static char *handle_caio_cli_core_show_translation(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) +{ +#define SHOW_TRANS 13 + int x, y, z; + int curlen = 0, longest = 0; + + switch (cmd) { + case CLI_INIT: + e->command = "core show translation [recalc]"; + e->usage = "Usage: core show translation [recalc []]\n" " Displays known codec translators and the cost associated\n" " with each conversion. If the argument 'recalc' is supplied along\n"