[asterisk-commits] russell: branch 1.4 r267183 - /branches/1.4/main/cli.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 2 14:56:16 CDT 2010


Author: russell
Date: Wed Jun  2 14:56:14 2010
New Revision: 267183

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=267183
Log:
Add CLI command that blocks until Asterisk has fully booted.

Modified:
    branches/1.4/main/cli.c

Modified: branches/1.4/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/cli.c?view=diff&rev=267183&r1=267182&r2=267183
==============================================================================
--- branches/1.4/main/cli.c (original)
+++ branches/1.4/main/cli.c Wed Jun  2 14:56:14 2010
@@ -137,6 +137,10 @@
 "       Lists all currently active channels with channel group(s) specified.\n"
 "       Optional regular expression pattern is matched to group names for each\n"
 "       channel.\n";
+
+static char core_wait_fullybooted_help[] =
+"Usage: core waitfullybooted\n"
+"	Wait until Asterisk has fully booted.\n";
 
 static int handle_load_deprecated(int fd, int argc, char *argv[])
 {
@@ -1336,6 +1340,17 @@
 #undef FORMAT_STRING
 }
 
+static int handle_cli_wait_fullybooted(int fd, int argc, char *argv[])
+{
+	while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+		usleep(100);
+	}
+
+	ast_cli(fd, "Asterisk has fully booted.\n");
+
+	return RESULT_SUCCESS;
+}
+
 static int handle_help(int fd, int argc, char *argv[]);
 
 static char * complete_help(const char *text, const char *word, int pos, int state)
@@ -1500,6 +1515,10 @@
 	{ { "soft", "hangup", NULL },
 	handle_softhangup, "Request a hangup on a given channel",
 	softhangup_help, complete_ch_3 },
+
+	{ { "core", "waitfullybooted", NULL },
+	handle_cli_wait_fullybooted, "Display active channels with group(s)",
+	core_wait_fullybooted_help },
 };
 
 /*! \brief initialize the _full_cmd string in * each of the builtins. */




More information about the asterisk-commits mailing list