[asterisk-commits] dlee: branch dlee/asterisk-info r395494 - in /team/dlee/asterisk-info: res/st...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 25 22:44:19 CDT 2013


Author: dlee
Date: Thu Jul 25 22:44:17 2013
New Revision: 395494

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395494
Log:
Implement /ari/asterisk/info

Modified:
    team/dlee/asterisk-info/res/stasis_http/ari_model_validators.c
    team/dlee/asterisk-info/res/stasis_http/ari_model_validators.h
    team/dlee/asterisk-info/res/stasis_http/resource_asterisk.c
    team/dlee/asterisk-info/rest-api/api-docs/asterisk.json

Modified: team/dlee/asterisk-info/res/stasis_http/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/stasis_http/ari_model_validators.c?view=diff&rev=395494&r1=395493&r2=395494
==============================================================================
--- team/dlee/asterisk-info/res/stasis_http/ari_model_validators.c (original)
+++ team/dlee/asterisk-info/res/stasis_http/ari_model_validators.c Thu Jul 25 22:44:17 2013
@@ -41,6 +41,42 @@
 	struct ast_json_iter *iter;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("build", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_build_info(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI AsteriskInfo field build failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("config", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_config_info(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI AsteriskInfo field config failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("status", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_status_info(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI AsteriskInfo field status failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("system", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_system_info(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI AsteriskInfo field system failed validation\n");
+				res = 0;
+			}
+		} else
 		{
 			ast_log(LOG_ERROR,
 				"ARI AsteriskInfo has undocumented field %s\n",
@@ -55,6 +91,383 @@
 ari_validator ari_validate_asterisk_info_fn(void)
 {
 	return ari_validate_asterisk_info;
+}
+
+int ari_validate_build_info(struct ast_json *json)
+{
+	int res = 1;
+	struct ast_json_iter *iter;
+	int has_date = 0;
+	int has_kernel = 0;
+	int has_machine = 0;
+	int has_options = 0;
+	int has_os = 0;
+	int has_user = 0;
+
+	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("date", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_date = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field date failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("kernel", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_kernel = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field kernel failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("machine", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_machine = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field machine failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("options", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_options = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field options failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("os", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_os = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field os failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_user = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI BuildInfo field user failed validation\n");
+				res = 0;
+			}
+		} else
+		{
+			ast_log(LOG_ERROR,
+				"ARI BuildInfo has undocumented field %s\n",
+				ast_json_object_iter_key(iter));
+			res = 0;
+		}
+	}
+
+	if (!has_date) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field date\n");
+		res = 0;
+	}
+
+	if (!has_kernel) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field kernel\n");
+		res = 0;
+	}
+
+	if (!has_machine) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field machine\n");
+		res = 0;
+	}
+
+	if (!has_options) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field options\n");
+		res = 0;
+	}
+
+	if (!has_os) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field os\n");
+		res = 0;
+	}
+
+	if (!has_user) {
+		ast_log(LOG_ERROR, "ARI BuildInfo missing required field user\n");
+		res = 0;
+	}
+
+	return res;
+}
+
+ari_validator ari_validate_build_info_fn(void)
+{
+	return ari_validate_build_info;
+}
+
+int ari_validate_config_info(struct ast_json *json)
+{
+	int res = 1;
+	struct ast_json_iter *iter;
+	int has_default_language = 0;
+	int has_name = 0;
+	int has_setid = 0;
+
+	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("default_language", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_default_language = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field default_language failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("max_channels", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_int(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field max_channels failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("max_load", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_double(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field max_load failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("max_open_files", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			prop_is_valid = ari_validate_int(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field max_open_files failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_name = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field name failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("setid", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_setid = 1;
+			prop_is_valid = ari_validate_set_id(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI ConfigInfo field setid failed validation\n");
+				res = 0;
+			}
+		} else
+		{
+			ast_log(LOG_ERROR,
+				"ARI ConfigInfo has undocumented field %s\n",
+				ast_json_object_iter_key(iter));
+			res = 0;
+		}
+	}
+
+	if (!has_default_language) {
+		ast_log(LOG_ERROR, "ARI ConfigInfo missing required field default_language\n");
+		res = 0;
+	}
+
+	if (!has_name) {
+		ast_log(LOG_ERROR, "ARI ConfigInfo missing required field name\n");
+		res = 0;
+	}
+
+	if (!has_setid) {
+		ast_log(LOG_ERROR, "ARI ConfigInfo missing required field setid\n");
+		res = 0;
+	}
+
+	return res;
+}
+
+ari_validator ari_validate_config_info_fn(void)
+{
+	return ari_validate_config_info;
+}
+
+int ari_validate_set_id(struct ast_json *json)
+{
+	int res = 1;
+	struct ast_json_iter *iter;
+	int has_group = 0;
+	int has_user = 0;
+
+	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("group", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_group = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI SetId field group failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("user", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_user = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI SetId field user failed validation\n");
+				res = 0;
+			}
+		} else
+		{
+			ast_log(LOG_ERROR,
+				"ARI SetId has undocumented field %s\n",
+				ast_json_object_iter_key(iter));
+			res = 0;
+		}
+	}
+
+	if (!has_group) {
+		ast_log(LOG_ERROR, "ARI SetId missing required field group\n");
+		res = 0;
+	}
+
+	if (!has_user) {
+		ast_log(LOG_ERROR, "ARI SetId missing required field user\n");
+		res = 0;
+	}
+
+	return res;
+}
+
+ari_validator ari_validate_set_id_fn(void)
+{
+	return ari_validate_set_id;
+}
+
+int ari_validate_status_info(struct ast_json *json)
+{
+	int res = 1;
+	struct ast_json_iter *iter;
+	int has_last_reload_time = 0;
+	int has_startup_time = 0;
+
+	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("last_reload_time", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_last_reload_time = 1;
+			prop_is_valid = ari_validate_date(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI StatusInfo field last_reload_time failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("startup_time", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_startup_time = 1;
+			prop_is_valid = ari_validate_date(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI StatusInfo field startup_time failed validation\n");
+				res = 0;
+			}
+		} else
+		{
+			ast_log(LOG_ERROR,
+				"ARI StatusInfo has undocumented field %s\n",
+				ast_json_object_iter_key(iter));
+			res = 0;
+		}
+	}
+
+	if (!has_last_reload_time) {
+		ast_log(LOG_ERROR, "ARI StatusInfo missing required field last_reload_time\n");
+		res = 0;
+	}
+
+	if (!has_startup_time) {
+		ast_log(LOG_ERROR, "ARI StatusInfo missing required field startup_time\n");
+		res = 0;
+	}
+
+	return res;
+}
+
+ari_validator ari_validate_status_info_fn(void)
+{
+	return ari_validate_status_info;
+}
+
+int ari_validate_system_info(struct ast_json *json)
+{
+	int res = 1;
+	struct ast_json_iter *iter;
+	int has_entity_id = 0;
+	int has_version = 0;
+
+	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+		if (strcmp("entity_id", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_entity_id = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI SystemInfo field entity_id failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("version", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_version = 1;
+			prop_is_valid = ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI SystemInfo field version failed validation\n");
+				res = 0;
+			}
+		} else
+		{
+			ast_log(LOG_ERROR,
+				"ARI SystemInfo has undocumented field %s\n",
+				ast_json_object_iter_key(iter));
+			res = 0;
+		}
+	}
+
+	if (!has_entity_id) {
+		ast_log(LOG_ERROR, "ARI SystemInfo missing required field entity_id\n");
+		res = 0;
+	}
+
+	if (!has_version) {
+		ast_log(LOG_ERROR, "ARI SystemInfo missing required field version\n");
+		res = 0;
+	}
+
+	return res;
+}
+
+ari_validator ari_validate_system_info_fn(void)
+{
+	return ari_validate_system_info;
 }
 
 int ari_validate_variable(struct ast_json *json)

Modified: team/dlee/asterisk-info/res/stasis_http/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/stasis_http/ari_model_validators.h?view=diff&rev=395494&r1=395493&r2=395494
==============================================================================
--- team/dlee/asterisk-info/res/stasis_http/ari_model_validators.h (original)
+++ team/dlee/asterisk-info/res/stasis_http/ari_model_validators.h Thu Jul 25 22:44:17 2013
@@ -162,6 +162,96 @@
 ari_validator ari_validate_asterisk_info_fn(void);
 
 /*!
+ * \brief Validator for BuildInfo.
+ *
+ * Info about how Asterisk was built
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ari_validate_build_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ari_validate_build_info().
+ *
+ * See \ref ari_model_validators.h for more details.
+ */
+ari_validator ari_validate_build_info_fn(void);
+
+/*!
+ * \brief Validator for ConfigInfo.
+ *
+ * Info about Asterisk configuration
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ari_validate_config_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ari_validate_config_info().
+ *
+ * See \ref ari_model_validators.h for more details.
+ */
+ari_validator ari_validate_config_info_fn(void);
+
+/*!
+ * \brief Validator for SetId.
+ *
+ * Effective user/group id
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ari_validate_set_id(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ari_validate_set_id().
+ *
+ * See \ref ari_model_validators.h for more details.
+ */
+ari_validator ari_validate_set_id_fn(void);
+
+/*!
+ * \brief Validator for StatusInfo.
+ *
+ * Info about Asterisk status
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ari_validate_status_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ari_validate_status_info().
+ *
+ * See \ref ari_model_validators.h for more details.
+ */
+ari_validator ari_validate_status_info_fn(void);
+
+/*!
+ * \brief Validator for SystemInfo.
+ *
+ * Info about Asterisk
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ari_validate_system_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ari_validate_system_info().
+ *
+ * See \ref ari_model_validators.h for more details.
+ */
+ari_validator ari_validate_system_info_fn(void);
+
+/*!
  * \brief Validator for Variable.
  *
  * The value of a channel variable
@@ -785,6 +875,33 @@
  * JSON models
  *
  * AsteriskInfo
+ * - build: BuildInfo
+ * - config: ConfigInfo
+ * - status: StatusInfo
+ * - system: SystemInfo
+ * BuildInfo
+ * - date: string (required)
+ * - kernel: string (required)
+ * - machine: string (required)
+ * - options: string (required)
+ * - os: string (required)
+ * - user: string (required)
+ * ConfigInfo
+ * - default_language: string (required)
+ * - max_channels: int
+ * - max_load: double
+ * - max_open_files: int
+ * - name: string (required)
+ * - setid: SetId (required)
+ * SetId
+ * - group: string (required)
+ * - user: string (required)
+ * StatusInfo
+ * - last_reload_time: Date (required)
+ * - startup_time: Date (required)
+ * SystemInfo
+ * - entity_id: string (required)
+ * - version: string (required)
  * Variable
  * - value: string (required)
  * Endpoint

Modified: team/dlee/asterisk-info/res/stasis_http/resource_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/stasis_http/resource_asterisk.c?view=diff&rev=395494&r1=395493&r2=395494
==============================================================================
--- team/dlee/asterisk-info/res/stasis_http/resource_asterisk.c (original)
+++ team/dlee/asterisk-info/res/stasis_http/resource_asterisk.c Thu Jul 25 22:44:17 2013
@@ -31,12 +31,113 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#include "asterisk/ast_version.h"
+#include "asterisk/buildinfo.h"
+#include "asterisk/paths.h"
+#include "asterisk/pbx.h"
 #include "resource_asterisk.h"
-#include "asterisk/pbx.h"
 
-void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response)
+void stasis_http_get_asterisk_info(struct ast_variable *headers,
+	struct ast_get_asterisk_info_args *args,
+	struct stasis_http_response *response)
 {
-	ast_log(LOG_ERROR, "TODO: stasis_http_get_asterisk_info\n");
+	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+	int show_all = args->only_count == 0;
+	int show_build = show_all;
+	int show_system = show_all;
+	int show_config = show_all;
+	int show_status = show_all;
+	size_t i;
+	int res = 0;
+
+	for (i = 0; i < args->only_count; ++i) {
+		if (strcasecmp("build", args->only[i]) == 0) {
+			show_build = 1;
+		} else if (strcasecmp("system", args->only[i]) == 0) {
+			show_system = 1;
+		} else if (strcasecmp("config", args->only[i]) == 0) {
+			show_config = 1;
+		} else if (strcasecmp("status", args->only[i]) == 0) {
+			show_status = 1;
+		} else {
+			ast_log(LOG_WARNING, "Unrecognized info section '%s'\n",
+				args->only[i]);
+		}
+	}
+
+	json = ast_json_object_create();
+
+	if (show_build) {
+		res |= ast_json_object_set(json, "build",
+			ast_json_pack(
+				"{ s: s, s: s, s: s,"
+				"  s: s, s: s, s: s }",
+
+				"os", ast_build_os,
+				"kernel", ast_build_kernel,
+				"machine", ast_build_machine,
+
+				"options", AST_BUILDOPTS,
+				"date", ast_build_date,
+				"user", ast_build_user));
+	}
+
+	if (show_system) {
+		char eid_str[128];
+
+		ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default);
+
+		res |= ast_json_object_set(json, "system",
+			ast_json_pack("{ s: s, s: s }",
+				"version", ast_get_version(),
+				"entity_id", eid_str));
+	}
+
+	if (show_config) {
+		struct ast_json *config = ast_json_pack(
+			"{ s: s, s: s,"
+			" s: { s: s, s: s } }",
+
+			"name", ast_config_AST_SYSTEM_NAME,
+			"default_language", defaultlanguage,
+
+			"setid",
+			"user", ast_config_AST_RUN_USER,
+			"group", ast_config_AST_RUN_GROUP);
+
+		res |= ast_json_object_set(json, "config", config);
+
+		if (option_maxcalls) {
+			res |= ast_json_object_set(config, "max_channels",
+				ast_json_integer_create(option_maxcalls));
+		}
+
+		if (option_maxfiles) {
+			res |= ast_json_object_set(config, "max_open_files",
+				ast_json_integer_create(option_maxfiles));
+		}
+
+		if (option_maxload) {
+			res |= ast_json_object_set(config, "max_load",
+				ast_json_real_create(option_maxload));
+		}
+	}
+
+	if (show_status) {
+		res |= ast_json_object_set(json, "status",
+			ast_json_pack("{ s: o, s: o }",
+				"startup_time",
+				ast_json_timeval(ast_startuptime, NULL),
+				"last_reload_time",
+				ast_json_timeval(ast_lastreloadtime, NULL)));
+	}
+
+	if (res != 0) {
+		stasis_http_response_alloc_failed(response);
+		return;
+	}
+
+	stasis_http_response_ok(response, ast_json_ref(json));
 }
 
 void stasis_http_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct stasis_http_response *response)

Modified: team/dlee/asterisk-info/rest-api/api-docs/asterisk.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/rest-api/api-docs/asterisk.json?view=diff&rev=395494&r1=395493&r2=395494
==============================================================================
--- team/dlee/asterisk-info/rest-api/api-docs/asterisk.json (original)
+++ team/dlee/asterisk-info/rest-api/api-docs/asterisk.json Thu Jul 25 22:44:17 2013
@@ -85,10 +85,151 @@
 		}
 	],
 	"models": {
+		"BuildInfo": {
+			"id": "BuildInfo",
+			"description": "Info about how Asterisk was built",
+			"properties": {
+				"os": {
+					"required": true,
+					"type": "string",
+					"description": "OS Asterisk was built on."
+				},
+				"kernel": {
+					"required": true,
+					"type": "string",
+					"description": "Kernel version Asterisk was built on."
+				},
+				"options": {
+					"required": true,
+					"type": "string",
+					"description": "Compile time options, or empty string if default."
+				},
+				"machine": {
+					"required": true,
+					"type": "string",
+					"description": "Machine architecture (x86_64, i686, ppc, etc.)"
+				},
+				"date": {
+					"required": true,
+					"type": "string",
+					"description": "Date and time when Asterisk was built."
+				},
+				"user": {
+					"required": true,
+					"type": "string",
+					"description": "Username that build Asterisk"
+				}
+			}
+		},
+		"SystemInfo": {
+			"id": "SystemInfo",
+			"description": "Info about Asterisk",
+			"properties": {
+				"version": {
+					"required": true,
+					"type": "string",
+					"description": "Asterisk version."
+				},
+				"entity_id": {
+					"required": true,
+					"type": "string",
+					"description": ""
+				}
+			}
+		},
+		"SetId": {
+			"id": "SetId",
+			"description": "Effective user/group id",
+			"properties": {
+				"user": {
+					"required": true,
+					"type": "string",
+					"description": "Effective user id."
+				},
+				"group": {
+					"required": true,
+					"type": "string",
+					"description": "Effective group id."
+				}
+			}
+		},
+		"ConfigInfo": {
+			"id": "ConfigInfo",
+			"description": "Info about Asterisk configuration",
+			"properties": {
+				"name": {
+					"required": true,
+					"type": "string",
+					"description": "Asterisk system name."
+				},
+				"default_language": {
+					"required": true,
+					"type": "string",
+					"description": "Default language for media playback."
+				},
+				"max_channels": {
+					"required": false,
+					"type": "int",
+					"description": "Maximum number of simultaneous channels."
+				},
+				"max_open_files": {
+					"required": false,
+					"type": "int",
+					"description": "Maximum number of open file handles (files, sockets)."
+				},
+				"max_load": {
+					"required": false,
+					"type": "double",
+					"description": "Maximum load avg on system."
+				},
+				"setid": {
+					"required": true,
+					"type": "SetId",
+					"description": "Effective user/group id for running Asterisk."
+				}
+			}
+		},
+		"StatusInfo": {
+			"id": "StatusInfo",
+			"description": "Info about Asterisk status",
+			"properties": {
+				"startup_time": {
+					"required": true,
+					"type": "Date",
+					"description": "Time when Asterisk was started."
+				},
+				"last_reload_time": {
+					"required": true,
+					"type": "Date",
+					"description": "Time when Asterisk was last reloaded."
+				}
+			}
+		},
 		"AsteriskInfo": {
 			"id": "AsteriskInfo",
 			"description": "Asterisk system information",
-			"properties": {}
+			"properties": {
+				"build": {
+					"required": false,
+					"type": "BuildInfo",
+					"description": "Info about how Asterisk was built"
+				},
+				"system": {
+					"required": false,
+					"type": "SystemInfo",
+					"description": "Info about the system running Asterisk"
+				},
+				"config": {
+					"required": false,
+					"type": "ConfigInfo",
+					"description": "Info about Asterisk configuration"
+				},
+				"status": {
+					"required": false,
+					"type": "StatusInfo",
+					"description": "Info about Asterisk status"
+				}
+			}
 		},
 		"Variable": {
 			"id": "Variable",




More information about the asterisk-commits mailing list