[svn-commits] oej: trunk r63030 - in /trunk: include/ include/asterisk/ main/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri May 4 06:44:51 MST 2007


Author: oej
Date: Fri May  4 08:44:50 2007
New Revision: 63030

URL: http://svn.digium.com/view/asterisk?view=rev&rev=63030
Log:
- Add manager command CoreSettings
- Add missing option to options.h
- Add missing variables to asterisk.h
- Move manager version to manager.h include file

Modified:
    trunk/include/asterisk.h
    trunk/include/asterisk/manager.h
    trunk/include/asterisk/options.h
    trunk/main/manager.c

Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?view=diff&rev=63030&r1=63029&r2=63030
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Fri May  4 08:44:50 2007
@@ -63,6 +63,8 @@
 extern char ast_config_AST_PID[PATH_MAX];
 extern char ast_config_AST_SOCKET[PATH_MAX];
 extern char ast_config_AST_RUN_DIR[PATH_MAX];
+extern char ast_config_AST_RUN_GROUP[PATH_MAX];
+extern char ast_config_AST_RUN_USER[PATH_MAX];
 extern char ast_config_AST_CTL_PERMISSIONS[PATH_MAX];
 extern char ast_config_AST_CTL_OWNER[PATH_MAX];
 extern char ast_config_AST_CTL_GROUP[PATH_MAX];

Modified: trunk/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=63030&r1=63029&r2=63030
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Fri May  4 08:44:50 2007
@@ -45,6 +45,7 @@
     You can find a reference of standard headers in doc/manager.txt
  */
 
+#define AMI_VERSION			"1.0"
 #define DEFAULT_MANAGER_PORT 5038	/* Default port for Asterisk management via TCP */
 
 #define EVENT_FLAG_SYSTEM 		(1 << 0) /* System events such as module load/unload */

Modified: trunk/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/options.h?view=diff&rev=63030&r1=63029&r2=63030
==============================================================================
--- trunk/include/asterisk/options.h (original)
+++ trunk/include/asterisk/options.h Fri May  4 08:44:50 2007
@@ -110,6 +110,7 @@
 extern struct ast_flags ast_options;
 
 extern int option_verbose;
+extern int option_maxfiles;		/*!< Max number of open file handles (files, sockets) */
 extern int option_debug;		/*!< Debugging */
 extern int option_maxcalls;		/*!< Maximum number of simultaneous channels */
 extern double option_maxload;

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=63030&r1=63029&r2=63030
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Fri May  4 08:44:50 2007
@@ -76,6 +76,7 @@
 #include "asterisk/acl.h"
 #include "asterisk/utils.h"
 #include "asterisk/http.h"
+#include "asterisk/version.h"
 #include "asterisk/threadstorage.h"
 #include "asterisk/linkedlists.h"
 
@@ -2158,6 +2159,52 @@
 	return 0;
 }
 
+static char mandescr_coresettings[] =
+"Description: Query for Core PBX settings.\n"
+"Variables: (Names marked with * are optional)\n"
+"       *ActionID: ActionID of this transaction\n";
+
+/*! \brief Show PBX core settings information */
+static int action_coresettings(struct mansession *s, const struct message *m)
+{
+	const char *actionid = astman_get_header(m, "ActionID");
+	char idText[150];
+
+        if (!ast_strlen_zero(actionid)) {
+                snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
+        }
+
+	astman_append(s, "Response: Success\r\n"
+			"%s"
+			"AMIversion: %s\r\n"
+			"AsteriskVersion: %s\r\n"
+			"SystemName: %s\r\n"
+			"CoreMaxCalls: %d\r\n"
+			"CoreMaxLoadAvg: %f\r\n"
+			"CoreRunUser: %s\r\n"
+			"CoreRunGroup: %s\r\n"
+			"CoreMaxFilehandles: %d\r\n" 
+			"CoreRealTimeEnabled: %s\r\n"
+			"CoreCDRenabled: %s\r\n"
+			"CoreHTTPenabled: %s\r\n"
+			,
+			AMI_VERSION,
+			idText,
+			ASTERISK_VERSION, 
+			ast_config_AST_SYSTEM_NAME,
+			option_maxcalls,
+			option_maxload,
+			ast_config_AST_RUN_USER,
+			ast_config_AST_RUN_GROUP,
+			option_maxfiles,
+			ast_realtime_enabled() ? "Yes" : "No",
+			check_cdr_enabled() ? "Yes" : "No",
+			check_webmanager_enabled() ? "Yes" : "No"
+			);
+	return 0;
+}
+
+
 /*
  * Done with the action handlers here, we start with the code in charge
  * of accepting connections and serving them.
@@ -2354,7 +2401,7 @@
 	/* Hook to the tail of the event queue */
 	s->last_ev = grab_last();
 	s->f = ser->f;
-	astman_append(s, "Asterisk Call Manager/1.0\r\n");	/* welcome prompt */
+	astman_append(s, "Asterisk Call Manager/%s\r\n", AMI_VERSION);	/* welcome prompt */
 	for (;;) {
 		if ((res = do_message(s)) < 0)
 			break;
@@ -3124,6 +3171,7 @@
 		ast_manager_register2("SendText", EVENT_FLAG_CALL, action_sendtext, "Send text message to channel", mandescr_sendtext);
 		ast_manager_register2("UserEvent", EVENT_FLAG_USER, action_userevent, "Send an arbitrary event", mandescr_userevent);
 		ast_manager_register2("WaitEvent", 0, action_waitevent, "Wait for an event to occur", mandescr_waitevent);
+		ast_manager_register2("CoreSettings", EVENT_FLAG_SYSTEM, action_coresettings, "Show PBX core settings (version etc)", mandescr_coresettings);
 
 		ast_cli_register_multiple(cli_manager, sizeof(cli_manager) / sizeof(struct ast_cli_entry));
 		ast_extension_state_add(NULL, NULL, manager_state_cb, NULL);



More information about the svn-commits mailing list