if (!cmd) {
sprintf (sql, "select * from interfaces");
}
- else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"application") ||
- !strcmp(cmd,"api") || !strcmp(cmd,"dialplan") ||
+ else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"dialplan") ||
!strcmp(cmd,"file") || !strcmp(cmd,"timer")
) {
+ sprintf (sql, "select type, name from interfaces where type = '%s'", cmd);
+ }
+ else if (!strcmp(cmd,"application") || !strcmp(cmd,"api")) {
sprintf (sql, "select * from interfaces where type = '%s'", cmd);
}
else if ( !strcmp(cmd,"calls")) {
holder.print_title = 0;
if ((cmdname = strchr(cmd, ' ')) != 0) {
*cmdname++ = '\0';
- sprintf (sql, "select name from interfaces where type = 'api' and name = '%s'", cmdname);
+ sprintf (sql, "select name, description, syntax from interfaces where type = 'api' and name = '%s'", cmdname);
} else {
- sprintf (sql, "select name from interfaces where type = 'api'");
+ sprintf (sql, "select name, description, syntax from interfaces where type = 'api'");
}
}
else {
stream->write_function(stream, "\nValid Commands:\n\n");
show_function(showcmd, session, stream);
if (all)
- stream->write_function(stream, "version\n" "help - umm yeah..\n" "shutdown - stop the program\n\n");
+ stream->write_function(stream, "version\n" "shutdown - stop the program\n");
return SWITCH_STATUS_SUCCESS;
}
case SWITCH_EVENT_LOG:
return;
case SWITCH_EVENT_MODULE_LOAD:
- sql = switch_core_db_mprintf("insert into interfaces (type,name) values('%q','%q')",
+ sql = switch_core_db_mprintf("insert into interfaces (type,name,description,syntax) values('%q','%q','%q','%q')",
switch_event_get_header(event, "type"),
- switch_event_get_header(event, "name")
+ switch_event_get_header(event, "name"),
+ switch_event_get_header(event, "description"),
+ switch_event_get_header(event, "syntax")
);
break;
default:
char create_interfaces_sql[] =
"CREATE TABLE interfaces (\n"
" type VARCHAR(255),\n"
- " name VARCHAR(255)\n"
+ " name VARCHAR(255),\n"
+ " description VARCHAR(255),\n"
+ " syntax VARCHAR(255)\n"
");\n";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n");
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "application");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", ptr->short_desc);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", ptr->syntax);
switch_event_fire(&event);
}
switch_core_hash_insert(loadable_modules.application_hash,
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "api");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", ptr->desc);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", ptr->syntax);
switch_event_fire(&event);
}
switch_core_hash_insert(loadable_modules.api_hash, (char *) ptr->interface_name, (void *) ptr);