rendered paste body#include <switch.h>
static int RUNNING = 0;
int main(int argc, char *argv[])
{
char *ppath = NULL;
char *err = NULL;
switch_event *event;
// This needs to be done for initialization
if (switch_core_init(ppath) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Cannot Initilize\n");
return 255;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n");
if (switch_loadable_module_init() != SWITCH_STATUS_SUCCESS) {
err = "Cannot load modules";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Error: %s", err);
exit(-1);
}
if (switch_event_create(&event, SWITCH_EVENT_STARTUP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Ready");
switch_event_fire(&event);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "freeswitch Version %s Started\n\n", SWITCH_VERSION_FULL);
/* wait for console input */
{
char *arg = "888";
char *cmd = "pacall";
char *cmd2 = "pahup";
char retbuf[100];
int retlen = 100;
switch_api_execute(cmd, arg, retbuf, retlen);
Sleep(100);
arg = NULL;
retbuf[0] = '/0';
switch_api_execute(cmd2, arg, retbuf, retlen);
}
// switch_console_loop();
// and this in shutdown
if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
switch_event_fire(&event);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
switch_loadable_module_shutdown();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Tearing down environment.\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Exiting Now.\n");
switch_core_destroy();
return 0;
}