SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const char *last_word,
FILE *console_out, switch_stream_handle_t *stream, switch_xml_t xml);
SWITCH_DECLARE(void) switch_console_sort_matches(switch_console_callback_match_t *matches);
+SWITCH_DECLARE(void) switch_console_save_history(void);
SWITCH_END_EXTERN_C
#endif
SCSC_DEBUG_LEVEL,
SCSC_FLUSH_DB_HANDLES,
SCSC_SHUTDOWN_NOW,
- SCSC_CALIBRATE_CLOCK
+ SCSC_CALIBRATE_CLOCK,
+ SCSC_SAVE_HISTORY,
+ SCSC_CRASH
} switch_session_ctl_t;
typedef enum {
stream->write_function(stream, "+OK\n");
} else if (!strcasecmp(argv[0], "calibrate_clock")) {
switch_core_session_ctl(SCSC_CALIBRATE_CLOCK, NULL);
+ stream->write_function(stream, "+OK\n");
+ } else if (!strcasecmp(argv[0], "crash")) {
+ switch_core_session_ctl(SCSC_CRASH, NULL);
+ stream->write_function(stream, "+OK\n");
+ } else if (!strcasecmp(argv[0], "save_history")) {
+ switch_core_session_ctl(SCSC_SAVE_HISTORY, NULL);
+ stream->write_function(stream, "+OK\n");
} else if (!strcasecmp(argv[0], "shutdown")) {
switch_session_ctl_t command = SCSC_SHUTDOWN;
int x = 0;
return CC_REDISPLAY;
}
+SWITCH_DECLARE(void) switch_console_save_history(void)
+{
+#ifdef SWITCH_HAVE_LIBEDIT
+ history(myhistory, &ev, H_SAVE, hfile);
+#else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "NOT IMPLEMENTED!\n");
+#endif
+}
+
#ifdef SWITCH_HAVE_LIBEDIT
static char prompt_str[512] = "";
case SCSC_CANCEL_SHUTDOWN:
switch_clear_flag((&runtime), SCF_SHUTDOWN_REQUESTED);
break;
+ case SCSC_SAVE_HISTORY:
+ switch_console_save_history();
+ break;
+ case SCSC_CRASH:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Declinatio Mortuus Obfirmo!\n");
+ switch_console_save_history();
+ abort();
+ break;
case SCSC_SHUTDOWN_NOW:
+ switch_console_save_history();
exit(0);
break;
case SCSC_SHUTDOWN_ELEGANT: