[asterisk-commits] dlee: branch dlee/asterisk-info r395711 - in /team/dlee/asterisk-info: ./ con...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 29 16:14:19 CDT 2013
Author: dlee
Date: Mon Jul 29 16:14:12 2013
New Revision: 395711
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395711
Log:
Multiple revisions 395707-395710
........
r395707 | dlee | 2013-07-29 15:20:43 -0500 (Mon, 29 Jul 2013) | 15 lines
Rename everything Stasis-HTTP to ARI
This renames all files and API calls from several variants of
Stasis-HTTP to ARI including:
* Stasis-HTTP -> ARI
* STASIS_HTTP -> ARI
* stasis_http -> ari (ast_ari for global symbols, file names as well)
* stasis http -> ARI
Review: https://reviewboard.asterisk.org/r/2706/
(closes issue ASTERISK-22136)
........
Merged revisions 395603 from http://svn.asterisk.org/svn/asterisk/trunk
........
r395708 | dlee | 2013-07-29 15:39:11 -0500 (Mon, 29 Jul 2013) | 1 line
Fixed merge conflict
........
r395709 | dlee | 2013-07-29 15:52:43 -0500 (Mon, 29 Jul 2013) | 1 line
Merge fixes to new content
........
r395710 | dlee | 2013-07-29 15:54:41 -0500 (Mon, 29 Jul 2013) | 2 lines
Merged revisions 395619-395686 from http://svn.asterisk.org/svn/asterisk/trunk
........
Merged revisions 395707-395710 from http://svn.asterisk.org/svn/asterisk/team/dlee/allow-multiple
Added:
team/dlee/asterisk-info/include/asterisk/ari.h
- copied unchanged from r395710, team/dlee/allow-multiple/include/asterisk/ari.h
team/dlee/asterisk-info/res/ari/ (props changed)
- copied from r395710, team/dlee/allow-multiple/res/ari/
team/dlee/asterisk-info/res/ari.make
- copied unchanged from r395710, team/dlee/allow-multiple/res/ari.make
team/dlee/asterisk-info/res/res_ari.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari.c
team/dlee/asterisk-info/res/res_ari.exports.in
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari.exports.in
team/dlee/asterisk-info/res/res_ari_asterisk.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_asterisk.c
team/dlee/asterisk-info/res/res_ari_bridges.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_bridges.c
team/dlee/asterisk-info/res/res_ari_channels.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_channels.c
team/dlee/asterisk-info/res/res_ari_endpoints.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_endpoints.c
team/dlee/asterisk-info/res/res_ari_events.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_events.c
team/dlee/asterisk-info/res/res_ari_playback.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_playback.c
team/dlee/asterisk-info/res/res_ari_recordings.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_recordings.c
team/dlee/asterisk-info/res/res_ari_sounds.c
- copied unchanged from r395710, team/dlee/allow-multiple/res/res_ari_sounds.c
team/dlee/asterisk-info/rest-api-templates/ari.make.mustache
- copied unchanged from r395710, team/dlee/allow-multiple/rest-api-templates/ari.make.mustache
team/dlee/asterisk-info/rest-api-templates/ari_resource.c.mustache
- copied unchanged from r395710, team/dlee/allow-multiple/rest-api-templates/ari_resource.c.mustache
team/dlee/asterisk-info/rest-api-templates/ari_resource.h.mustache
- copied unchanged from r395710, team/dlee/allow-multiple/rest-api-templates/ari_resource.h.mustache
team/dlee/asterisk-info/rest-api-templates/res_ari_resource.c.mustache
- copied unchanged from r395710, team/dlee/allow-multiple/rest-api-templates/res_ari_resource.c.mustache
team/dlee/asterisk-info/tests/test_ari.c
- copied unchanged from r395710, team/dlee/allow-multiple/tests/test_ari.c
Removed:
team/dlee/asterisk-info/include/asterisk/stasis_http.h
team/dlee/asterisk-info/res/res_stasis_http.c
team/dlee/asterisk-info/res/res_stasis_http.exports.in
team/dlee/asterisk-info/res/res_stasis_http_asterisk.c
team/dlee/asterisk-info/res/res_stasis_http_bridges.c
team/dlee/asterisk-info/res/res_stasis_http_channels.c
team/dlee/asterisk-info/res/res_stasis_http_endpoints.c
team/dlee/asterisk-info/res/res_stasis_http_events.c
team/dlee/asterisk-info/res/res_stasis_http_playback.c
team/dlee/asterisk-info/res/res_stasis_http_recordings.c
team/dlee/asterisk-info/res/res_stasis_http_sounds.c
team/dlee/asterisk-info/res/stasis_http/
team/dlee/asterisk-info/res/stasis_http.make
team/dlee/asterisk-info/rest-api-templates/res_stasis_http_resource.c.mustache
team/dlee/asterisk-info/rest-api-templates/stasis_http.make.mustache
team/dlee/asterisk-info/rest-api-templates/stasis_http_resource.c.mustache
team/dlee/asterisk-info/rest-api-templates/stasis_http_resource.h.mustache
team/dlee/asterisk-info/tests/test_stasis_http.c
Modified:
team/dlee/asterisk-info/ (props changed)
team/dlee/asterisk-info/configs/ari.conf.sample
team/dlee/asterisk-info/include/asterisk/mixmonitor.h (props changed)
team/dlee/asterisk-info/main/loader.c
team/dlee/asterisk-info/main/mixmonitor.c (contents, props changed)
team/dlee/asterisk-info/main/stasis_config.c
team/dlee/asterisk-info/res/Makefile
team/dlee/asterisk-info/res/ari/ari_model_validators.c
team/dlee/asterisk-info/res/ari/ari_model_validators.h
team/dlee/asterisk-info/res/ari/resource_asterisk.c
team/dlee/asterisk-info/res/parking/parking_devicestate.c (props changed)
team/dlee/asterisk-info/res/res_ari_model.c
team/dlee/asterisk-info/res/res_ari_model.exports.in
team/dlee/asterisk-info/res/res_sip.c
team/dlee/asterisk-info/res/res_statsd.c
team/dlee/asterisk-info/rest-api-templates/ari_model_validators.c.mustache
team/dlee/asterisk-info/rest-api-templates/ari_model_validators.h.mustache
team/dlee/asterisk-info/rest-api-templates/make_ari_stubs.py
team/dlee/asterisk-info/rest-api-templates/param_parsing.mustache
team/dlee/asterisk-info/rest-api-templates/rest_handler.mustache
team/dlee/asterisk-info/tests/test_ari_model.c
team/dlee/asterisk-info/tests/test_cel.c
Propchange: team/dlee/asterisk-info/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul 29 16:14:12 2013
@@ -1,1 +1,1 @@
-/team/dlee/allow-multiple:1-395651
+/team/dlee/allow-multiple:1-395710
Modified: team/dlee/asterisk-info/configs/ari.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/configs/ari.conf.sample?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/configs/ari.conf.sample (original)
+++ team/dlee/asterisk-info/configs/ari.conf.sample Mon Jul 29 16:14:12 2013
@@ -1,6 +1,6 @@
[general]
-enabled = yes ; When set to no, stasis-http support is disabled.
-;pretty = no ; When set to yes, responses from stasis-http are
+enabled = yes ; When set to no, ARI support is disabled.
+;pretty = no ; When set to yes, responses from ARI are
; ; formatted to be human readable.
;allowed_origins = ; Comma separated list of allowed origins, for
; ; Cross-Origin Resource Sharing. May be set to * to
Propchange: team/dlee/asterisk-info/include/asterisk/mixmonitor.h
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Mon Jul 29 16:14:12 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Modified: team/dlee/asterisk-info/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/main/loader.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/main/loader.c (original)
+++ team/dlee/asterisk-info/main/loader.c Mon Jul 29 16:14:12 2013
@@ -50,7 +50,7 @@
#include "asterisk/enum.h"
#include "asterisk/http.h"
#include "asterisk/lock.h"
-#include "asterisk/features.h"
+#include "asterisk/features_config.h"
#include "asterisk/dsp.h"
#include "asterisk/udptl.h"
#include "asterisk/heap.h"
@@ -313,7 +313,7 @@
{ "manager", reload_manager },
{ "http", ast_http_reload },
{ "logger", logger_reload },
- { "features", ast_features_reload },
+ { "features", ast_features_config_reload },
{ "dsp", ast_dsp_reload},
{ "udptl", ast_udptl_reload },
{ "indications", ast_indications_reload },
Modified: team/dlee/asterisk-info/main/mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/main/mixmonitor.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/main/mixmonitor.c (original)
+++ team/dlee/asterisk-info/main/mixmonitor.c Mon Jul 29 16:14:12 2013
@@ -29,7 +29,7 @@
#include "asterisk.h"
-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 390830 $")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/lock.h"
#include "asterisk/logger.h"
Propchange: team/dlee/asterisk-info/main/mixmonitor.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Mon Jul 29 16:14:12 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Modified: team/dlee/asterisk-info/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/main/stasis_config.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/main/stasis_config.c (original)
+++ team/dlee/asterisk-info/main/stasis_config.c Mon Jul 29 16:14:12 2013
@@ -70,7 +70,7 @@
struct stasis_threadpool_conf *threadpool;
};
-/*! \brief Mapping of the stasis http conf struct's globals to the
+/*! \brief Mapping of the stasis conf struct's globals to the
* threadpool context in the config file. */
static struct aco_type threadpool_option = {
.type = ACO_GLOBAL,
Modified: team/dlee/asterisk-info/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/Makefile?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/Makefile (original)
+++ team/dlee/asterisk-info/res/Makefile Mon Jul 29 16:14:12 2013
@@ -73,18 +73,18 @@
ael/pval.o: ael/pval.c
clean::
- rm -f snmp/*.[oi] ael/*.[oi] ais/*.[oi] stasis_http/*.[oi]
+ rm -f snmp/*.[oi] ael/*.[oi] ais/*.[oi] ari/*.[oi]
rm -f res_sip/*.[oi] stasis/*.[oi]
rm -f parking/*.o parking/*.i
$(if $(filter res_parking,$(EMBEDDED_MODS)),modules.link,res_parking.so): $(subst .c,.o,$(wildcard parking/*.c))
$(subst .c,.o,$(wildcard parking/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_parking)
-res_stasis_http.so: stasis_http/cli.o stasis_http/config.o stasis_http/ari_websockets.o
-stasis_http/cli.o stasis_http/config.o stasis_http/ari_websockets.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http)
+res_ari.so: ari/cli.o ari/config.o ari/ari_websockets.o
+ari/cli.o ari/config.o ari/ari_websockets.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari)
-res_ari_model.so: stasis_http/ari_model_validators.o
-stasis_http/ari_model_validators.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_model)
+res_ari_model.so: ari/ari_model_validators.o
+ari/ari_model_validators.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_model)
-# Dependencies for res_stasis_http_*.so are generated, so they're in this file
-include stasis_http.make
+# Dependencies for res_ari_*.so are generated, so they're in this file
+include ari.make
Propchange: team/dlee/asterisk-info/res/ari/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jul 29 16:14:12 2013
@@ -1,0 +1,2 @@
+*.i
+*.o
Modified: team/dlee/asterisk-info/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/ari/ari_model_validators.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/ari/ari_model_validators.c (original)
+++ team/dlee/asterisk-info/res/ari/ari_model_validators.c Mon Jul 29 16:14:12 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 = ast_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 = ast_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 = ast_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 = ast_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 ast_ari_validate_asterisk_info_fn(void)
{
return ast_ari_validate_asterisk_info;
+}
+
+int ast_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 = ast_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 = ast_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 = ast_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 = ast_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 = ast_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 = ast_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 ast_ari_validate_build_info_fn(void)
+{
+ return ast_ari_validate_build_info;
+}
+
+int ast_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 = ast_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 = ast_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 = ast_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 = ast_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 = ast_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 = ast_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 ast_ari_validate_config_info_fn(void)
+{
+ return ast_ari_validate_config_info;
+}
+
+int ast_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 = ast_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 = ast_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 ast_ari_validate_set_id_fn(void)
+{
+ return ast_ari_validate_set_id;
+}
+
+int ast_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 = ast_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 = ast_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 ast_ari_validate_status_info_fn(void)
+{
+ return ast_ari_validate_status_info;
+}
+
+int ast_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 = ast_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 = ast_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 ast_ari_validate_system_info_fn(void)
+{
+ return ast_ari_validate_system_info;
}
int ast_ari_validate_variable(struct ast_json *json)
Modified: team/dlee/asterisk-info/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/ari/ari_model_validators.h?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/ari/ari_model_validators.h (original)
+++ team/dlee/asterisk-info/res/ari/ari_model_validators.h Mon Jul 29 16:14:12 2013
@@ -162,6 +162,96 @@
ari_validator ast_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 ast_ari_validate_build_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_build_info().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_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 ast_ari_validate_config_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_config_info().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_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 ast_ari_validate_set_id(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_set_id().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_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 ast_ari_validate_status_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_status_info().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_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 ast_ari_validate_system_info(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_system_info().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_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/ari/resource_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/ari/resource_asterisk.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/ari/resource_asterisk.c (original)
+++ team/dlee/asterisk-info/res/ari/resource_asterisk.c Mon Jul 29 16:14:12 2013
@@ -18,7 +18,7 @@
/*! \file
*
- * \brief Implementation for ARI stubs.
+ * \brief Implementation for stasis-http stubs.
*
* \author David M. Lee, II <dlee at digium.com>
*/
@@ -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 ast_ari_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct ast_ari_response *response)
+void ast_ari_get_asterisk_info(struct ast_variable *headers,
+ struct ast_get_asterisk_info_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ari_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) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
+
+ ast_ari_response_ok(response, ast_json_ref(json));
}
void ast_ari_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct ast_ari_response *response)
Propchange: team/dlee/asterisk-info/res/parking/parking_devicestate.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Mon Jul 29 16:14:12 2013
@@ -1,1 +1,1 @@
-"Author Date Id Revision"
+Author Date Id Revision
Modified: team/dlee/asterisk-info/res/res_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/res_ari_model.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/res_ari_model.c (original)
+++ team/dlee/asterisk-info/res/res_ari_model.c Mon Jul 29 16:14:12 2013
@@ -31,7 +31,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
@@ -90,18 +90,18 @@
return 1;
}
-int ari_validate_void(struct ast_json *json)
+int ast_ari_validate_void(struct ast_json *json)
{
return check_type(json, AST_JSON_NULL);
}
-int ari_validate_byte(struct ast_json *json)
+int ast_ari_validate_byte(struct ast_json *json)
{
/* Java bytes are signed, which accounts for great fun for all */
return check_range(-128, 255, json);
}
-int ari_validate_boolean(struct ast_json *json)
+int ast_ari_validate_boolean(struct ast_json *json)
{
enum ast_json_type actual = ast_json_typeof(json);
switch (actual) {
@@ -115,34 +115,34 @@
}
}
-int ari_validate_int(struct ast_json *json)
+int ast_ari_validate_int(struct ast_json *json)
{
/* Swagger int's are 32-bit */
return check_range(-2147483648LL, 2147483647LL, json);
}
-int ari_validate_long(struct ast_json *json)
+int ast_ari_validate_long(struct ast_json *json)
{
/* All integral values are valid longs. No need for range check. */
return check_type(json, AST_JSON_INTEGER);
}
-int ari_validate_float(struct ast_json *json)
+int ast_ari_validate_float(struct ast_json *json)
{
return check_type(json, AST_JSON_REAL);
}
-int ari_validate_double(struct ast_json *json)
+int ast_ari_validate_double(struct ast_json *json)
{
return check_type(json, AST_JSON_REAL);
}
-int ari_validate_string(struct ast_json *json)
+int ast_ari_validate_string(struct ast_json *json)
{
return check_type(json, AST_JSON_STRING);
}
-int ari_validate_date(struct ast_json *json)
+int ast_ari_validate_date(struct ast_json *json)
{
/* Dates are ISO-8601 strings */
const char *str;
@@ -158,7 +158,7 @@
return 1;
}
-int ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *))
+int ast_ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *))
{
int res = 1;
size_t i;
Modified: team/dlee/asterisk-info/res/res_ari_model.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/res_ari_model.exports.in?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/res_ari_model.exports.in (original)
+++ team/dlee/asterisk-info/res/res_ari_model.exports.in Mon Jul 29 16:14:12 2013
@@ -1,6 +1,6 @@
{
global:
- LINKER_SYMBOL_PREFIXari_*;
+ LINKER_SYMBOL_PREFIXast_ari_*;
local:
*;
};
Modified: team/dlee/asterisk-info/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/res_sip.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/res_sip.c (original)
+++ team/dlee/asterisk-info/res/res_sip.c Mon Jul 29 16:14:12 2013
@@ -292,17 +292,26 @@
</description>
</configOption>
<configOption name="trust_id_inbound" default="no">
- <synopsis>Trust inbound CallerID information from endpoint</synopsis>
- <description><para>This option determines whether res_sip will accept identification from the endpoint
- received in a P-Asserted-Identity or Remote-Party-ID header. If <literal>no</literal>,
- the configured Caller-ID from res_sip.conf will always be used as the identity for the
- endpoint.</para></description>
+ <synopsis>Accept identification information received from this endpoint</synopsis>
+ <description><para>This option determines whether Asterisk will accept
+ identification from the endpoint from headers such as P-Asserted-Identity
+ or Remote-Party-ID header. This option applies both to calls originating from the
+ endpoint and calls originating from Asterisk. If <literal>no</literal>, the
+ configured Caller-ID from res_sip.conf will always be used as the identity for
+ the endpoint.</para></description>
</configOption>
<configOption name="trust_id_outbound" default="no">
- <synopsis>Trust endpoint with private CallerID information</synopsis>
- <description><para>This option determines whether res_sip will send identification
- information to the endpoint that has been marked as private. If <literal>no</literal>,
- private Caller-ID information will not be forwarded to the endpoint.</para></description>
+ <synopsis>Send private identification details to the endpoint.</synopsis>
+ <description><para>This option determines whether res_sip will send private
+ identification information to the endpoint. If <literal>no</literal>,
+ private Caller-ID information will not be forwarded to the endpoint.
+ "Private" in this case refers to any method of restricting identification.
+ Example: setting <replaceable>callerid_privacy</replaceable> to any
+ <literal>prohib</literal> variation.
+ Example: If <replaceable>trust_id_inbound</replaceable> is set to
+ <literal>yes</literal>, the presence of a <literal>Privacy: id</literal>
+ header in a SIP request or response would indicate the identification
+ provided in the request is private.</para></description>
</configOption>
<configOption name="type">
<synopsis>Must be of type 'endpoint'.</synopsis>
@@ -1789,7 +1798,6 @@
ast_pjsip_endpoint = NULL;
}
pj_caching_pool_destroy(&caching_pool);
- /* XXX Should have a way of stopping monitor thread */
return AST_MODULE_LOAD_DECLINE;
}
Modified: team/dlee/asterisk-info/res/res_statsd.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/res/res_statsd.c?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/res/res_statsd.c (original)
+++ team/dlee/asterisk-info/res/res_statsd.c Mon Jul 29 16:14:12 2013
@@ -34,7 +34,7 @@
<configObject name="global">
<synopsis>Global configuration settings</synopsis>
<configOption name="enabled">
- <synopsis>Enable/disable the stasis-http module</synopsis>
+ <synopsis>Enable/disable the statsd module</synopsis>
</configOption>
<configOption name="server">
<synopsis>Address of the statsd server</synopsis>
@@ -161,7 +161,7 @@
sample_rate);
}
-/*! \brief Mapping of the stasis http conf struct's globals to the
+/*! \brief Mapping of the statsd conf struct's globals to the
* general context in the config file. */
static struct aco_type global_option = {
.type = ACO_GLOBAL,
@@ -173,7 +173,7 @@
static struct aco_type *global_options[] = ACO_TYPES(&global_option);
-/*! \brief Disposes of the stasis http conf object */
+/*! \brief Disposes of the statsd conf object */
static void conf_destructor(void *obj)
{
struct conf *cfg = obj;
Modified: team/dlee/asterisk-info/rest-api-templates/ari_model_validators.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/asterisk-info/rest-api-templates/ari_model_validators.c.mustache?view=diff&rev=395711&r1=395710&r2=395711
==============================================================================
--- team/dlee/asterisk-info/rest-api-templates/ari_model_validators.c.mustache (original)
+++ team/dlee/asterisk-info/rest-api-templates/ari_model_validators.c.mustache Mon Jul 29 16:14:12 2013
@@ -36,7 +36,7 @@
{{#api_declaration}}
{{#models}}
-int ari_validate_{{c_id}}(struct ast_json *json)
[... 1139 lines stripped ...]
More information about the asterisk-commits
mailing list