[asterisk-commits] dlee: branch dlee/fix-asterisk-info r396153 - in /team/dlee/fix-asterisk-info...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 2 15:14:33 CDT 2013


Author: dlee
Date: Fri Aug  2 15:14:31 2013
New Revision: 396153

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396153
Log:
Export several config options from Asterisk

Modified:
    team/dlee/fix-asterisk-info/include/asterisk/options.h
    team/dlee/fix-asterisk-info/main/asterisk.c
    team/dlee/fix-asterisk-info/main/channel.c
    team/dlee/fix-asterisk-info/main/cli.c
    team/dlee/fix-asterisk-info/main/manager.c
    team/dlee/fix-asterisk-info/main/pbx.c
    team/dlee/fix-asterisk-info/res/ari/resource_asterisk.c
    team/dlee/fix-asterisk-info/utils/extconf.c

Modified: team/dlee/fix-asterisk-info/include/asterisk/options.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/include/asterisk/options.h?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/include/asterisk/options.h (original)
+++ team/dlee/fix-asterisk-info/include/asterisk/options.h Fri Aug  2 15:14:31 2013
@@ -154,15 +154,15 @@
 extern struct ast_flags ast_compat;
 
 extern int option_verbose;
-extern int option_maxfiles;		/*!< Max number of open file handles (files, sockets) */
+extern int ast_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 int ast_option_maxcalls;		/*!< Maximum number of simultaneous channels */
 extern unsigned int option_dtmfminduration;	/*!< Minimum duration of DTMF (channel.c) in ms */
-extern double option_maxload;
+extern double ast_option_maxload;
 #if defined(HAVE_SYSINFO)
 extern long option_minmemfree;		/*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
 #endif
-extern char defaultlanguage[];
+extern char ast_defaultlanguage[];
 
 extern struct timeval ast_startuptime;
 extern struct timeval ast_lastreloadtime;

Modified: team/dlee/fix-asterisk-info/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/main/asterisk.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/main/asterisk.c (original)
+++ team/dlee/fix-asterisk-info/main/asterisk.c Fri Aug  2 15:14:31 2013
@@ -319,9 +319,9 @@
 
 int option_verbose;				/*!< Verbosity level */
 int option_debug;				/*!< Debug level */
-double option_maxload;				/*!< Max load avg on system */
-int option_maxcalls;				/*!< Max number of active calls */
-int option_maxfiles;				/*!< Max number of open file handles (files, sockets) */
+double ast_option_maxload;			/*!< Max load avg on system */
+int ast_option_maxcalls;			/*!< Max number of active calls */
+int ast_option_maxfiles;			/*!< Max number of open file handles (files, sockets) */
 unsigned int option_dtmfminduration;		/*!< Minimum duration of DTMF. */
 #if defined(HAVE_SYSINFO)
 long option_minmemfree;				/*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
@@ -364,7 +364,7 @@
 
 struct console consoles[AST_MAX_CONNECTS];
 
-char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
+char ast_defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
 
 static int ast_el_add_history(char *);
 static int ast_el_read_history(char *);
@@ -599,17 +599,17 @@
 	ast_cli(a->fd, "-----------------\n");
 	ast_cli(a->fd, "  Version:                     %s\n", ast_get_version());
 	ast_cli(a->fd, "  Build Options:               %s\n", S_OR(AST_BUILDOPTS, "(none)"));
-	if (option_maxcalls)
-		ast_cli(a->fd, "  Maximum calls:               %d (Current %d)\n", option_maxcalls, ast_active_channels());
+	if (ast_option_maxcalls)
+		ast_cli(a->fd, "  Maximum calls:               %d (Current %d)\n", ast_option_maxcalls, ast_active_channels());
 	else
 		ast_cli(a->fd, "  Maximum calls:               Not set\n");
-	if (option_maxfiles)
-		ast_cli(a->fd, "  Maximum open file handles:   %d\n", option_maxfiles);
+	if (ast_option_maxfiles)
+		ast_cli(a->fd, "  Maximum open file handles:   %d\n", ast_option_maxfiles);
 	else
 		ast_cli(a->fd, "  Maximum open file handles:   Not set\n");
 	ast_cli(a->fd, "  Verbosity:                   %d\n", option_verbose);
 	ast_cli(a->fd, "  Debug level:                 %d\n", option_debug);
-	ast_cli(a->fd, "  Maximum load average:        %lf\n", option_maxload);
+	ast_cli(a->fd, "  Maximum load average:        %lf\n", ast_option_maxload);
 #if defined(HAVE_SYSINFO)
 	ast_cli(a->fd, "  Minimum free memory:         %ld MB\n", option_minmemfree);
 #endif
@@ -624,7 +624,7 @@
 	ast_cli(a->fd, "  System:                      %s/%s built by %s on %s %s\n", ast_build_os, ast_build_kernel, ast_build_user, ast_build_machine, ast_build_date);
 	ast_cli(a->fd, "  System name:                 %s\n", ast_config_AST_SYSTEM_NAME);
 	ast_cli(a->fd, "  Entity ID:                   %s\n", eid_str);
-	ast_cli(a->fd, "  Default language:            %s\n", defaultlanguage);
+	ast_cli(a->fd, "  Default language:            %s\n", ast_defaultlanguage);
 	ast_cli(a->fd, "  Language prefix:             %s\n", ast_language_is_prefix ? "Enabled" : "Disabled");
 	ast_cli(a->fd, "  User name and group:         %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP);
 	ast_cli(a->fd, "  Executable includes:         %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES) ? "Enabled" : "Disabled");
@@ -3402,22 +3402,22 @@
 				option_dtmfminduration = AST_MIN_DTMF_DURATION;
 			}
 		} else if (!strcasecmp(v->name, "maxcalls")) {
-			if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
-				option_maxcalls = 0;
+			if ((sscanf(v->value, "%30d", &ast_option_maxcalls) != 1) || (ast_option_maxcalls < 0)) {
+				ast_option_maxcalls = 0;
 			}
 		} else if (!strcasecmp(v->name, "maxload")) {
 			double test[1];
 
 			if (getloadavg(test, 1) == -1) {
 				ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n");
-				option_maxload = 0.0;
-			} else if ((sscanf(v->value, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
-				option_maxload = 0.0;
+				ast_option_maxload = 0.0;
+			} else if ((sscanf(v->value, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) {
+				ast_option_maxload = 0.0;
 			}
 		/* Set the maximum amount of open files */
 		} else if (!strcasecmp(v->name, "maxfiles")) {
-			option_maxfiles = atoi(v->value);
-			set_ulimit(option_maxfiles);
+			ast_option_maxfiles = atoi(v->value);
+			set_ulimit(ast_option_maxfiles);
 		/* What user to run as */
 		} else if (!strcasecmp(v->name, "runuser")) {
 			ast_copy_string(cfg_paths.run_user, v->value, sizeof(cfg_paths.run_user));
@@ -3440,7 +3440,7 @@
 		} else if (!strcasecmp(v->name, "languageprefix")) {
 			ast_language_is_prefix = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "defaultlanguage")) {
-			ast_copy_string(defaultlanguage, v->value, MAX_LANGUAGE);
+			ast_copy_string(ast_defaultlanguage, v->value, MAX_LANGUAGE);
 		} else if (!strcasecmp(v->name, "lockmode")) {
 			if (!strcasecmp(v->value, "lockfile")) {
 				ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
@@ -3725,13 +3725,13 @@
 			ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
 			break;
 		case 'L':
-			if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
-				option_maxload = 0.0;
+			if ((sscanf(optarg, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) {
+				ast_option_maxload = 0.0;
 			}
 			break;
 		case 'M':
-			if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
-				option_maxcalls = 0;
+			if ((sscanf(optarg, "%30d", &ast_option_maxcalls) != 1) || (ast_option_maxcalls < 0)) {
+				ast_option_maxcalls = 0;
 			}
 			break;
 		case 'm':

Modified: team/dlee/fix-asterisk-info/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/main/channel.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/main/channel.c (original)
+++ team/dlee/fix-asterisk-info/main/channel.c Fri Aug  2 15:14:31 2013
@@ -992,7 +992,7 @@
 
 	AST_LIST_HEAD_INIT_NOLOCK(ast_channel_autochans(tmp));
 
-	ast_channel_language_set(tmp, defaultlanguage);
+	ast_channel_language_set(tmp, ast_defaultlanguage);
 
 	ast_channel_tech_set(tmp, &null_tech);
 

Modified: team/dlee/fix-asterisk-info/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/main/cli.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/main/cli.c (original)
+++ team/dlee/fix-asterisk-info/main/cli.c Fri Aug  2 15:14:31 2013
@@ -854,10 +854,10 @@
 	} else
 		return CLI_SHOWUSAGE;
 
-	if (option_maxcalls) {
+	if (ast_option_maxcalls) {
 		ast_cli(a->fd, "%d of %d max active call%s (%5.2f%% of capacity)\n",
-		   ast_active_calls(), option_maxcalls, ESS(ast_active_calls()),
-		   ((double)ast_active_calls() / (double)option_maxcalls) * 100.0);
+		   ast_active_calls(), ast_option_maxcalls, ESS(ast_active_calls()),
+		   ((double)ast_active_calls() / (double)ast_option_maxcalls) * 100.0);
 	} else {
 		ast_cli(a->fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls()));
 	}
@@ -982,10 +982,10 @@
 	if (!concise) {
 		numchans = ast_active_channels();
 		ast_cli(a->fd, "%d active channel%s\n", numchans, ESS(numchans));
-		if (option_maxcalls)
+		if (ast_option_maxcalls)
 			ast_cli(a->fd, "%d of %d max active call%s (%5.2f%% of capacity)\n",
-				ast_active_calls(), option_maxcalls, ESS(ast_active_calls()),
-				((double)ast_active_calls() / (double)option_maxcalls) * 100.0);
+				ast_active_calls(), ast_option_maxcalls, ESS(ast_active_calls()),
+				((double)ast_active_calls() / (double)ast_option_maxcalls) * 100.0);
 		else
 			ast_cli(a->fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls()));
 

Modified: team/dlee/fix-asterisk-info/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/main/manager.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/main/manager.c (original)
+++ team/dlee/fix-asterisk-info/main/manager.c Fri Aug  2 15:14:31 2013
@@ -5212,11 +5212,11 @@
 			AMI_VERSION,
 			ast_get_version(),
 			ast_config_AST_SYSTEM_NAME,
-			option_maxcalls,
-			option_maxload,
+			ast_option_maxcalls,
+			ast_option_maxload,
 			ast_config_AST_RUN_USER,
 			ast_config_AST_RUN_GROUP,
-			option_maxfiles,
+			ast_option_maxfiles,
 			AST_CLI_YESNO(ast_realtime_enabled()),
 			AST_CLI_YESNO(ast_cdr_is_enabled()),
 			AST_CLI_YESNO(check_webmanager_enabled())

Modified: team/dlee/fix-asterisk-info/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/main/pbx.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/main/pbx.c (original)
+++ team/dlee/fix-asterisk-info/main/pbx.c Fri Aug  2 15:14:31 2013
@@ -6317,16 +6317,16 @@
 #endif
 
 	ast_mutex_lock(&maxcalllock);
-	if (option_maxcalls) {
-		if (countcalls >= option_maxcalls) {
-			ast_log(LOG_WARNING, "Maximum call limit of %d calls exceeded by '%s'!\n", option_maxcalls, ast_channel_name(c));
+	if (ast_option_maxcalls) {
+		if (countcalls >= ast_option_maxcalls) {
+			ast_log(LOG_WARNING, "Maximum call limit of %d calls exceeded by '%s'!\n", ast_option_maxcalls, ast_channel_name(c));
 			failed = -1;
 		}
 	}
-	if (option_maxload) {
+	if (ast_option_maxload) {
 		getloadavg(&curloadavg, 1);
-		if (curloadavg >= option_maxload) {
-			ast_log(LOG_WARNING, "Maximum loadavg limit of %f load exceeded by '%s' (currently %f)!\n", option_maxload, ast_channel_name(c), curloadavg);
+		if (curloadavg >= ast_option_maxload) {
+			ast_log(LOG_WARNING, "Maximum loadavg limit of %f load exceeded by '%s' (currently %f)!\n", ast_option_maxload, ast_channel_name(c), curloadavg);
 			failed = -1;
 		}
 	}

Modified: team/dlee/fix-asterisk-info/res/ari/resource_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/res/ari/resource_asterisk.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/res/ari/resource_asterisk.c (original)
+++ team/dlee/fix-asterisk-info/res/ari/resource_asterisk.c Fri Aug  2 15:14:31 2013
@@ -99,7 +99,7 @@
 			" s: { s: s, s: s } }",
 
 			"name", ast_config_AST_SYSTEM_NAME,
-			"default_language", defaultlanguage,
+			"default_language", ast_defaultlanguage,
 
 			"setid",
 			"user", ast_config_AST_RUN_USER,
@@ -107,19 +107,19 @@
 
 		res |= ast_json_object_set(json, "config", config);
 
-		if (option_maxcalls) {
+		if (ast_option_maxcalls) {
 			res |= ast_json_object_set(config, "max_channels",
-				ast_json_integer_create(option_maxcalls));
+				ast_json_integer_create(ast_option_maxcalls));
 		}
 
-		if (option_maxfiles) {
+		if (ast_option_maxfiles) {
 			res |= ast_json_object_set(config, "max_open_files",
-				ast_json_integer_create(option_maxfiles));
+				ast_json_integer_create(ast_option_maxfiles));
 		}
 
-		if (option_maxload) {
+		if (ast_option_maxload) {
 			res |= ast_json_object_set(config, "max_load",
-				ast_json_real_create(option_maxload));
+				ast_json_real_create(ast_option_maxload));
 		}
 	}
 

Modified: team/dlee/fix-asterisk-info/utils/extconf.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/fix-asterisk-info/utils/extconf.c?view=diff&rev=396153&r1=396152&r2=396153
==============================================================================
--- team/dlee/fix-asterisk-info/utils/extconf.c (original)
+++ team/dlee/fix-asterisk-info/utils/extconf.c Fri Aug  2 15:14:31 2013
@@ -1894,9 +1894,9 @@
 
 extern int option_verbose;
 extern int option_debug;		/*!< Debugging */
-extern int option_maxcalls;		/*!< Maximum number of simultaneous channels */
-extern double option_maxload;
-extern char defaultlanguage[];
+extern int ast_option_maxcalls;		/*!< Maximum number of simultaneous channels */
+extern double ast_option_maxload;
+extern char ast_defaultlanguage[];
 
 extern pid_t ast_mainpid;
 




More information about the asterisk-commits mailing list