[Freeswitch-svn] [commit] r11008 - freeswitch/trunk/libs/esl

FreeSWITCH SVN anthm at freeswitch.org
Tue Dec 30 13:28:29 PST 2008


Author: anthm
Date: Tue Dec 30 16:28:29 2008
New Revision: 11008

Log:
update

Modified:
   freeswitch/trunk/libs/esl/fs_cli.c

Modified: freeswitch/trunk/libs/esl/fs_cli.c
==============================================================================
--- freeswitch/trunk/libs/esl/fs_cli.c	(original)
+++ freeswitch/trunk/libs/esl/fs_cli.c	Tue Dec 30 16:28:29 2008
@@ -127,11 +127,28 @@
 
 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 (
 		!strcasecmp(cmd, "exit") ||
 		!strcasecmp(cmd, "quit") ||
 		!strcasecmp(cmd, "bye")
 		) {
+		esl_log(ESL_LOG_INFO, "Goodbye!\nSee you at ClueCon http://www.cluecon.com\n");
 		return -1;
 	}
 
@@ -218,6 +235,29 @@
 }
 #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[])
 {
 	esl_handle_t handle = {{0}};
@@ -274,7 +314,7 @@
 	signal(SIGINT, handle_SIGINT);
 
 	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(;;) {
 		int option_index = 0;
@@ -339,7 +379,7 @@
 				esl_set_string(profiles[cur].host, "localhost");
 				esl_set_string(profiles[cur].pass, "ClueCon");
 				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++;
 			}
 			
@@ -364,10 +404,10 @@
 	
 	if (optind < argc) {
 		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];
 		} 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 ) {
 				esl_global_set_default_logger(profile->debug);
 			}
@@ -384,7 +424,7 @@
 		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_port && profile->port != 8021) {
@@ -439,6 +479,8 @@
 	snprintf(cmd_str, sizeof(cmd_str), "log info\n\n");
 	esl_send_recv(&handle, cmd_str);
 
+	print_banner(stdout);
+
 	esl_log(ESL_LOG_INFO, "FS CLI Ready.\n");
 
 	while (running) {
@@ -469,8 +511,10 @@
 #endif
 
 				if (!strncasecmp(cmd, "...", 3)) {
-					goto done;
-				} else if (*cmd == '/') {
+					if (process_command(&handle, "exit")) {
+                        running = 0;
+                    }
+				} else if (*cmd == '/' || !strncasecmp(cmd, "...", 3)) {
 					if (process_command(&handle, cmd + 1)) {
 						running = 0;
 					}



More information about the Freeswitch-svn mailing list