aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-24 23:52:48 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-24 23:52:48 +0000
commit6b8dfea440d909bc45b4ce606d3c4fed1564363b (patch)
tree1a535993de0e90956f9d8b4b71332d6f70f62dc6
parentef55792f03676458d725bfc4aeda38147997b86c (diff)
Merged revisions 265320,265467 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r265320 | twilson | 2010-05-24 14:06:40 -0500 (Mon, 24 May 2010) | 14 lines Add the FullyBooted AMI event It is possible to connect to the manager interface before all Asterisk modules are loaded. To ensure that an application does not send AMI actions that might require a module that has not yet loaded, the application can listen for the FullyBooted manager event. It will be sent upon connection if all modules have been loaded, or as soon as loading is complete. The event: Event: FullyBooted Privilege: system,all Status: Fully Booted Review: https://reviewboard.asterisk.org/r/639/ ........ r265467 | twilson | 2010-05-24 17:21:58 -0500 (Mon, 24 May 2010) | 1 line Merge the rest of the FullyBooted patch ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@265521 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--Makefile1
-rw-r--r--doc/manager_1_1.txt16
-rw-r--r--doc/tex/manager.tex17
-rw-r--r--include/asterisk/options.h3
-rw-r--r--main/asterisk.c6
-rw-r--r--main/manager.c3
6 files changed, 44 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 35598b730..832f87964 100644
--- a/Makefile
+++ b/Makefile
@@ -730,6 +730,7 @@ samples: adsi
echo " ; to the device. It is for this reason that this is optional, as it may result in requiring a" ; \
echo " ; temporary codec translation path for a channel that may not otherwise require one." ; \
echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
+ echo ";sendfullybooted = yes ; Send the FullyBooted AMI event on AMI login and when all modules are finished loading" ; \
echo ";runuser = asterisk ; The user to run as" ; \
echo ";rungroup = asterisk ; The group to run as" ; \
echo ";lightbackground = yes ; If your terminal is set for a light-colored background" ; \
diff --git a/doc/manager_1_1.txt b/doc/manager_1_1.txt
index a2daa6d9b..0d9f036b0 100644
--- a/doc/manager_1_1.txt
+++ b/doc/manager_1_1.txt
@@ -262,6 +262,22 @@ Changes to manager version 1.1:
* NEW EVENTS
------------
+- Event: FullyBooted
+ Modules: loader.c
+ Purpose:
+ It is handy to have a single event notification for when all Asterisk
+ modules have been loaded--especially for situations like running
+ automated tests. This event will fire 1) immediately upon all modules
+ loading or 2) upon connection to the AMI interface if the modules have
+ already finished loading before the connection was made. This ensures
+ that a user will never miss getting a FullyBooted event. In vary rare
+ circumstances, it might be possible to get two copies of the message
+ if the AMI connection is made right as the modules finish loading.
+ Example:
+ Event: FullyBooted
+ Privilege: system,all
+ Status: Fully Booted
+
- Event: Transfer
Modules: res_features, chan_sip
Purpose:
diff --git a/doc/tex/manager.tex b/doc/tex/manager.tex
index 1f9fa1495..7235ca447 100644
--- a/doc/tex/manager.tex
+++ b/doc/tex/manager.tex
@@ -28,8 +28,6 @@ If you develop applications, please try to reuse existing manager
headers and their interpretation. If you are unsure, discuss on
the asterisk-dev mailing list.
-\section{Device status reports}
-
Manager subscribes to extension status reports from all channels,
to be able to generate events when an extension or device changes
state. The level of details in these events may depend on the channel
@@ -111,6 +109,21 @@ There are a number of GUI tools that use the manager interface, please search
the mailing list archives and the documentation page on the
\url{http://www.asterisk.org} web site for more information.
+\section{Ensuring all modules are loaded}
+It is possible to connect to the manager interface before all Asterisk modules
+are loaded. To ensure that an application does not send AMI actions that might
+require a module that has not yet loaded, the application can listen for the
+FullyBooted manager event. It will be sent upon connection if all modules have
+been loaded, or as soon as loading is complete. The event:
+
+\begin{verbatim}
+ Event: FullyBooted
+ Privilege: system,all
+ Status: Fully Booted
+\end{verbatim}
+
+\section{Device status reports}
+
\section{Some standard AMI headers}
\begin{verbatim}
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index f7d99e27e..1128ede76 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -94,6 +94,8 @@ enum ast_option_flags {
AST_OPT_FLAG_HIDE_CONSOLE_CONNECT = (1 << 28),
/*! Generic PLC */
AST_OPT_FLAG_GENERIC_PLC = (1 << 30),
+ /*! Send the FullyBooted AMI event when all modules are loaded */
+ AST_OPT_FLAG_SEND_FULLYBOOTED = (1 << 31),
};
/*! These are the options that set by default when Asterisk starts */
@@ -131,6 +133,7 @@ enum ast_option_flags {
#define ast_opt_force_black_background ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
#define ast_opt_hide_connect ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT)
#define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC)
+#define ast_opt_send_fullybooted ast_test_flag(&ast_options, AST_OPT_FLAG_SEND_FULLYBOOTED)
extern struct ast_flags ast_options;
diff --git a/main/asterisk.c b/main/asterisk.c
index 42829addd..187b59416 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -470,6 +470,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli(a->fd, " -------------\n");
ast_cli(a->fd, " Manager (AMI): %s\n", check_manager_enabled() ? "Enabled" : "Disabled");
ast_cli(a->fd, " Web Manager (AMI/HTTP): %s\n", check_webmanager_enabled() ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Send Manager FullyBooted: %s\n", ast_opt_send_fullybooted ? "Enabled" : "Disabled");
ast_cli(a->fd, " Call data records: %s\n", check_cdr_enabled() ? "Enabled" : "Disabled");
ast_cli(a->fd, " Realtime Architecture (ARA): %s\n", ast_realtime_enabled() ? "Enabled" : "Disabled");
@@ -2997,6 +2998,8 @@ static void ast_readconfig(void)
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
} else if (!strcasecmp(v->name, "hideconnect")) {
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
+ } else if (!strcasecmp(v->name, "sendfullybooted")) {
+ ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_SEND_FULLYBOOTED);
}
}
for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) {
@@ -3678,6 +3681,9 @@ int main(int argc, char *argv[])
sig_alert_pipe[0] = sig_alert_pipe[1] = -1;
ast_set_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
+ if (ast_opt_send_fullybooted) {
+ manager_event(EVENT_FLAG_SYSTEM, "FullyBooted", "Status: Fully Booted\r\n");
+ }
ast_process_pending_reloads();
diff --git a/main/manager.c b/main/manager.c
index f1d88ded4..66253c543 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1771,6 +1771,9 @@ static int action_login(struct mansession *s, const struct message *m)
ast_verb(2, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
ast_log(LOG_EVENT, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
astman_send_ack(s, m, "Authentication accepted");
+ if (ast_opt_send_fullybooted && ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ manager_event(EVENT_FLAG_SYSTEM, "FullyBooted", "Status: Fully Booted\r\n");
+ }
return 0;
}