Index: asterisk.c =================================================================== RCS file: /usr/cvsroot/asterisk/asterisk.c,v retrieving revision 1.70 diff -u -r1.70 asterisk.c --- asterisk.c 22 Apr 2004 05:11:11 -0000 1.70 +++ asterisk.c 23 Apr 2004 02:04:49 -0000 @@ -1603,6 +1603,10 @@ printf(term_quit()); exit(1); } + if (ast_file_init()) { + printf(term_quit()); + exit(1); + } if (load_pbx()) { printf(term_quit()); exit(1); Index: file.c =================================================================== RCS file: /usr/cvsroot/asterisk/file.c,v retrieving revision 1.40 diff -u -r1.40 file.c --- file.c 21 Apr 2004 03:53:15 -0000 1.40 +++ file.c 23 Apr 2004 02:04:57 -0000 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1038,3 +1039,41 @@ } return (c->_softhangup ? -1 : 0); } + +static int show_file_formats(int fd, int argc, char *argv[]) +{ +#define FORMAT "%-10s %-10s %-20s\n" +#define FORMAT2 "%-10s %-10s %-20s\n" + struct ast_format *f; + if (argc != 3) + return RESULT_SHOWUSAGE; + ast_cli(fd, FORMAT, "Format", "Name", "Extensions"); + + if (ast_mutex_lock(&formatlock)) { + ast_log(LOG_WARNING, "Unable to lock format list\n"); + return -1; + } + + f = formats; + while(f) { + ast_cli(fd, FORMAT2, ast_getformatname(f->format), f->name, f->exts); + f = f->next; + }; + ast_mutex_unlock(&formatlock); + return RESULT_SUCCESS; +} + +struct ast_cli_entry show_file = +{ + { "show", "file", "formats" }, + show_file_formats, + "Displays file formats", + "Usage: show file formats\n" + " displays currently registered file formats (if any)\n" +}; + +int ast_file_init(void) +{ + ast_cli_register(&show_file); + return 0; +} Index: include/asterisk/file.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/file.h,v retrieving revision 1.16 diff -u -r1.16 file.h --- include/asterisk/file.h 25 Feb 2004 22:31:50 -0000 1.16 +++ include/asterisk/file.h 23 Apr 2004 02:05:06 -0000 @@ -284,6 +284,14 @@ */ struct ast_frame *ast_readframe(struct ast_filestream *s); +//! Initialize file stuff +/*! + * Initializes all the various file stuff. Basically just registers the cli stuff + * Returns 0 all the time + */ +extern int ast_file_init(void); + + #define AST_RESERVED_POINTERS 20 #if defined(__cplusplus) || defined(c_plusplus)