return SWITCH_STATUS_SUCCESS;
}
-#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls [count]|channels [count]|aliases|complete"
+#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls [count]|channels [count]|aliases|complete|chat|endpoint|management|say|interfaces|interface_types"
SWITCH_STANDARD_API(show_function)
{
char sql[1024];
return SWITCH_STATUS_SUCCESS;
}
+
/* If you change the field qty or order of any of these select */
/* statmements, you must also change show_callback and friends to match! */
if (!command) {
stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
return SWITCH_STATUS_SUCCESS;
- } else if (!strcasecmp(command, "codec") || !strcasecmp(command, "dialplan") || !strcasecmp(command, "file") || !strcasecmp(command, "timer")) {
+ } else if (!strncasecmp(command, "codec", 5) ||
+ !strncasecmp(command, "dialplan", 8) ||
+ !strncasecmp(command, "file", 4) ||
+ !strncasecmp(command, "timer", 5) ||
+ !strncasecmp(command, "chat", 4) ||
+ !strncasecmp(command, "say", 3) ||
+ !strncasecmp(command, "management", 10) ||
+ !strncasecmp(command, "endpoint", 8)) {
+ if (end_of(command) == 's') {
+ end_of(command) = '\0';
+ }
sprintf(sql, "select type, name from interfaces where type = '%s' order by type,name", command);
+ } else if (!strcasecmp(command, "interfaces")) {
+ sprintf(sql, "select type, name from interfaces order by type,name");
+ } else if (!strcasecmp(command, "interface_types")) {
+ sprintf(sql, "select type,count(type) as total from interfaces group by type order by type");
} else if (!strcasecmp(command, "tasks")) {
sprintf(sql, "select * from %s", command);
} else if (!strcasecmp(command, "application") || !strcasecmp(command, "api")) {
SWITCH_STANDARD_API(global_getvar_function)
{
- if (!switch_strlen_zero(cmd)) {
+ if (switch_strlen_zero(cmd)) {
+ switch_core_dump_variables(stream);
+ } else {
stream->write_function(stream, "%s", switch_str_nil(switch_core_get_variable(cmd)));
- goto done;
}
-
- stream->write_function(stream, "-USAGE: %s\n", GLOBAL_GETVAR_SYNTAX);
- done:
return SWITCH_STATUS_SUCCESS;
}
return runtime.state_handlers[index];
}
+SWITCH_DECLARE(void) switch_core_dump_variables(switch_stream_handle_t *stream)
+{
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+ switch_mutex_lock(runtime.global_mutex);
+ for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
+ char *vvar, *vval;
+ switch_hash_this(hi, &var, NULL, &val);
+ vvar = (char *) var;
+ vval = (char *) val;
+ stream->write_function(stream, "%s=%s\n", vvar, vval);
+ }
+ switch_mutex_unlock(runtime.global_mutex);
+}
+
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
{
char *val;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Endpoint '%s'\n", ptr->interface_name);
switch_core_hash_insert(loadable_modules.endpoint_hash, ptr->interface_name, (const void *) ptr);
+ if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "endpoint");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+ switch_event_fire(&event);
+ }
}
}
}