mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11008 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0f71b42b7c
commit
47ffbb3dde
@ -127,11 +127,28 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
|
|||||||
|
|
||||||
static int process_command(esl_handle_t *handle, const char *cmd)
|
static int process_command(esl_handle_t *handle, const char *cmd)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!strcasecmp(cmd, "help")) {
|
||||||
|
printf(
|
||||||
|
"Command \tDescription\n"
|
||||||
|
"-----------------------------------------------\n"
|
||||||
|
"/help \tHelp\n"
|
||||||
|
"/exit, /quit, /bye, ... \tExit the program.\n"
|
||||||
|
"/event, /noevent, /nixevent\tEvent commands.\n"
|
||||||
|
"/log, /nolog \tLog commands.\n"
|
||||||
|
"/filter \tFilter commands.\n"
|
||||||
|
"\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!strcasecmp(cmd, "exit") ||
|
!strcasecmp(cmd, "exit") ||
|
||||||
!strcasecmp(cmd, "quit") ||
|
!strcasecmp(cmd, "quit") ||
|
||||||
!strcasecmp(cmd, "bye")
|
!strcasecmp(cmd, "bye")
|
||||||
) {
|
) {
|
||||||
|
esl_log(ESL_LOG_INFO, "Goodbye!\nSee you at ClueCon http://www.cluecon.com\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +235,29 @@ static const char *basic_gets(int *cnt)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void print_banner(FILE *stream)
|
||||||
|
{
|
||||||
|
fprintf(stream,
|
||||||
|
|
||||||
|
|
||||||
|
" _____ ____ ____ _ ___ \n"
|
||||||
|
" | ___/ ___| / ___| | |_ _| \n"
|
||||||
|
" | |_ \\___ \\ | | | | | | \n"
|
||||||
|
" | _| ___) | | |___| |___ | | \n"
|
||||||
|
" |_| |____/ \\____|_____|___| \n"
|
||||||
|
"\n"
|
||||||
|
"****************************************************\n"
|
||||||
|
"* Anthony Minessale II, Ken Rice, Michael Jerris *\n"
|
||||||
|
"* FreeSWITCH (http://www.freeswitch.org) *\n"
|
||||||
|
"* Brought to you by ClueCon http://www.cluecon.com *\n"
|
||||||
|
"****************************************************\n"
|
||||||
|
"\n\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
esl_handle_t handle = {{0}};
|
esl_handle_t handle = {{0}};
|
||||||
@ -274,7 +314,7 @@ int main(int argc, char *argv[])
|
|||||||
signal(SIGINT, handle_SIGINT);
|
signal(SIGINT, handle_SIGINT);
|
||||||
|
|
||||||
handle.debug = 0;
|
handle.debug = 0;
|
||||||
esl_global_set_default_logger(3); /* default debug level to 3 (error) */
|
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
@ -339,7 +379,7 @@ int main(int argc, char *argv[])
|
|||||||
esl_set_string(profiles[cur].host, "localhost");
|
esl_set_string(profiles[cur].host, "localhost");
|
||||||
esl_set_string(profiles[cur].pass, "ClueCon");
|
esl_set_string(profiles[cur].pass, "ClueCon");
|
||||||
profiles[cur].port = 8021;
|
profiles[cur].port = 8021;
|
||||||
esl_log(ESL_LOG_INFO, "Found Profile [%s]\n", profiles[cur].name);
|
esl_log(ESL_LOG_DEBUG, "Found Profile [%s]\n", profiles[cur].name);
|
||||||
pcount++;
|
pcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,10 +404,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
if (get_profile(argv[optind], &profile)) {
|
if (get_profile(argv[optind], &profile)) {
|
||||||
esl_log(ESL_LOG_INFO, "Chosen profile %s does not exist using builtin default\n", argv[optind]);
|
esl_log(ESL_LOG_DEBUG, "Chosen profile %s does not exist using builtin default\n", argv[optind]);
|
||||||
profile = &profiles[0];
|
profile = &profiles[0];
|
||||||
} else {
|
} else {
|
||||||
esl_log(ESL_LOG_INFO, "Chosen profile %s\n", profile->name);
|
esl_log(ESL_LOG_DEBUG, "Chosen profile %s\n", profile->name);
|
||||||
if (temp_log < 0 ) {
|
if (temp_log < 0 ) {
|
||||||
esl_global_set_default_logger(profile->debug);
|
esl_global_set_default_logger(profile->debug);
|
||||||
}
|
}
|
||||||
@ -384,7 +424,7 @@ int main(int argc, char *argv[])
|
|||||||
esl_set_string(profile->pass, temp_pass);
|
esl_set_string(profile->pass, temp_pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
esl_log(ESL_LOG_INFO, "Using profile %s [%s]\n", profile->name, profile->host);
|
esl_log(ESL_LOG_DEBUG, "Using profile %s [%s]\n", profile->name, profile->host);
|
||||||
|
|
||||||
if (argv_host) {
|
if (argv_host) {
|
||||||
if (argv_port && profile->port != 8021) {
|
if (argv_port && profile->port != 8021) {
|
||||||
@ -439,6 +479,8 @@ int main(int argc, char *argv[])
|
|||||||
snprintf(cmd_str, sizeof(cmd_str), "log info\n\n");
|
snprintf(cmd_str, sizeof(cmd_str), "log info\n\n");
|
||||||
esl_send_recv(&handle, cmd_str);
|
esl_send_recv(&handle, cmd_str);
|
||||||
|
|
||||||
|
print_banner(stdout);
|
||||||
|
|
||||||
esl_log(ESL_LOG_INFO, "FS CLI Ready.\n");
|
esl_log(ESL_LOG_INFO, "FS CLI Ready.\n");
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
@ -469,8 +511,10 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!strncasecmp(cmd, "...", 3)) {
|
if (!strncasecmp(cmd, "...", 3)) {
|
||||||
goto done;
|
if (process_command(&handle, "exit")) {
|
||||||
} else if (*cmd == '/') {
|
running = 0;
|
||||||
|
}
|
||||||
|
} else if (*cmd == '/' || !strncasecmp(cmd, "...", 3)) {
|
||||||
if (process_command(&handle, cmd + 1)) {
|
if (process_command(&handle, cmd + 1)) {
|
||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user