add options to show api command to show applications, codecs, file formats, ect. and cleanup the output format of this command. Thanks jkr888 (Johny Kadarisman) for the contribution.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1630 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-06-15 06:02:08 +00:00
parent 4fc49afe9e
commit 76f98bd034
2 changed files with 20 additions and 2 deletions

View File

@ -21,6 +21,7 @@ that much better:
and moral support.
Michal "cypromis" Bielicki (michal.bielicki AT halo2.pl) - Solaris porting, and autotools enhancements.
James Martelletti <james@nerdc0re.com> - All around cool guy (mod_syslog)
Johny Kadarisman <jkr888@gmail.com>
A big THANK YOU goes to:

View File

@ -24,6 +24,8 @@
* Contributor(s):
*
* Anthony Minessale II <anthmct@yahoo.com>
* Michael Jerris <mike@jerris.com>
* Johny Kadarisman <jkr888@gmail.com>
*
*
* mod_commands.c -- Misc. Command Module
@ -185,7 +187,7 @@ static switch_status_t pause_function(char *cmd, switch_stream_handle_t *stream)
static int show_callback(void *pArg, int argc, char **argv, char **columnNames){
switch_stream_handle_t *stream = (switch_stream_handle_t *) pArg;
stream->write_function(stream, "%s\n", argv[1]);
stream->write_function(stream, "%s|%s\n", argv[0], argv[1] ? argv[1] : "NULL");
return 0;
}
@ -196,7 +198,22 @@ static switch_status_t show_function(char *cmd, switch_stream_handle_t *stream)
char *errmsg;
switch_core_db_t *db = switch_core_db_handle();
if (!cmd) {
sprintf (sql, "select * from interfaces");
}
else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"application") ||
!strcmp(cmd,"api") || !strcmp(cmd,"dialplan") ||
!strcmp(cmd,"file") || !strcmp(cmd,"timer")
) {
sprintf (sql, "select * from interfaces where type = '%s'", cmd);
}
else {
stream->write_function(stream, "Invalid interfaces type!\n");
stream->write_function(stream, "Example:\n");
stream->write_function(stream, "show <blank>|codec|application|api|dialplan|file|timer\n");
return SWITCH_STATUS_SUCCESS;
}
switch_core_db_exec(db, sql, show_callback, stream, &errmsg);
if (errmsg) {