[asterisk-commits] dlee: branch dlee/record r395712 - in /team/dlee/record: ./ configs/ include/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 29 16:29:52 CDT 2013
Author: dlee
Date: Mon Jul 29 16:29:48 2013
New Revision: 395712
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395712
Log:
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
Added:
team/dlee/record/include/asterisk/ari.h
- copied unchanged from r395603, trunk/include/asterisk/ari.h
team/dlee/record/res/ari/
- copied from r395603, trunk/res/ari/
team/dlee/record/res/ari.make
- copied unchanged from r395603, trunk/res/ari.make
team/dlee/record/res/res_ari.c
- copied unchanged from r395603, trunk/res/res_ari.c
team/dlee/record/res/res_ari.exports.in
- copied unchanged from r395603, trunk/res/res_ari.exports.in
team/dlee/record/res/res_ari_asterisk.c
- copied unchanged from r395603, trunk/res/res_ari_asterisk.c
team/dlee/record/res/res_ari_bridges.c
- copied unchanged from r395603, trunk/res/res_ari_bridges.c
team/dlee/record/res/res_ari_channels.c
- copied unchanged from r395603, trunk/res/res_ari_channels.c
team/dlee/record/res/res_ari_endpoints.c
- copied unchanged from r395603, trunk/res/res_ari_endpoints.c
team/dlee/record/res/res_ari_events.c
- copied unchanged from r395603, trunk/res/res_ari_events.c
team/dlee/record/res/res_ari_playback.c
- copied unchanged from r395603, trunk/res/res_ari_playback.c
team/dlee/record/res/res_ari_recordings.c
- copied, changed from r395603, trunk/res/res_ari_recordings.c
team/dlee/record/res/res_ari_sounds.c
- copied unchanged from r395603, trunk/res/res_ari_sounds.c
team/dlee/record/rest-api-templates/ari.make.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari.make.mustache
team/dlee/record/rest-api-templates/ari_resource.c.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari_resource.c.mustache
team/dlee/record/rest-api-templates/ari_resource.h.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari_resource.h.mustache
team/dlee/record/rest-api-templates/res_ari_resource.c.mustache
- copied unchanged from r395603, trunk/rest-api-templates/res_ari_resource.c.mustache
team/dlee/record/tests/test_ari.c
- copied unchanged from r395603, trunk/tests/test_ari.c
Removed:
team/dlee/record/include/asterisk/stasis_http.h
team/dlee/record/res/res_stasis_http.c
team/dlee/record/res/res_stasis_http.exports.in
team/dlee/record/res/res_stasis_http_asterisk.c
team/dlee/record/res/res_stasis_http_bridges.c
team/dlee/record/res/res_stasis_http_channels.c
team/dlee/record/res/res_stasis_http_endpoints.c
team/dlee/record/res/res_stasis_http_events.c
team/dlee/record/res/res_stasis_http_playback.c
team/dlee/record/res/res_stasis_http_recordings.c
team/dlee/record/res/res_stasis_http_sounds.c
team/dlee/record/res/stasis_http/
team/dlee/record/res/stasis_http.make
team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache
team/dlee/record/rest-api-templates/stasis_http.make.mustache
team/dlee/record/rest-api-templates/stasis_http_resource.c.mustache
team/dlee/record/rest-api-templates/stasis_http_resource.h.mustache
team/dlee/record/tests/test_stasis_http.c
Modified:
team/dlee/record/ (props changed)
team/dlee/record/configs/ari.conf.sample
team/dlee/record/main/mixmonitor.c
team/dlee/record/main/stasis_config.c
team/dlee/record/res/Makefile
team/dlee/record/res/ari/ari_model_validators.c
team/dlee/record/res/ari/ari_model_validators.h
team/dlee/record/res/ari/resource_recordings.c
team/dlee/record/res/ari/resource_recordings.h
team/dlee/record/res/res_ari_model.c
team/dlee/record/res/res_ari_model.exports.in
team/dlee/record/res/res_statsd.c
team/dlee/record/rest-api-templates/ari_model_validators.c.mustache
team/dlee/record/rest-api-templates/ari_model_validators.h.mustache
team/dlee/record/rest-api-templates/make_ari_stubs.py
team/dlee/record/rest-api-templates/rest_handler.mustache
team/dlee/record/tests/test_ari_model.c
Propchange: team/dlee/record/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul 29 16:29:48 2013
@@ -1,1 +1,1 @@
-/trunk:1-395588
+/trunk:1-395603
Modified: team/dlee/record/configs/ari.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/configs/ari.conf.sample?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/configs/ari.conf.sample (original)
+++ team/dlee/record/configs/ari.conf.sample Mon Jul 29 16:29:48 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
Modified: team/dlee/record/main/mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/main/mixmonitor.c?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/main/mixmonitor.c (original)
+++ team/dlee/record/main/mixmonitor.c Mon Jul 29 16:29:48 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"
Modified: team/dlee/record/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/main/stasis_config.c?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/main/stasis_config.c (original)
+++ team/dlee/record/main/stasis_config.c Mon Jul 29 16:29:48 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/record/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/Makefile?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/res/Makefile (original)
+++ team/dlee/record/res/Makefile Mon Jul 29 16:29:48 2013
@@ -73,21 +73,21 @@
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)
res_stasis_recording.so: stasis_recording/stored.o
stasis_recording/stored.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_recording)
-# 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
Modified: team/dlee/record/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/ari/ari_model_validators.c?view=diff&rev=395712&r1=395603&r2=395712
==============================================================================
--- team/dlee/record/res/ari/ari_model_validators.c (original)
+++ team/dlee/record/res/ari/ari_model_validators.c Mon Jul 29 16:29:48 2013
@@ -648,46 +648,27 @@
{
int res = 1;
struct ast_json_iter *iter;
- int has_formats = 0;
- int has_id = 0;
-
- for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
- if (strcmp("duration_seconds", 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 StoredRecording field duration_seconds failed validation\n");
- res = 0;
- }
- } else
- if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
- int prop_is_valid;
- has_formats = 1;
- prop_is_valid = ast_ari_validate_list(
- ast_json_object_iter_value(iter),
- ast_ari_validate_string);
- if (!prop_is_valid) {
- ast_log(LOG_ERROR, "ARI StoredRecording field formats failed validation\n");
- res = 0;
- }
- } else
- if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
- int prop_is_valid;
- has_id = 1;
- prop_is_valid = ast_ari_validate_string(
- ast_json_object_iter_value(iter));
- if (!prop_is_valid) {
- ast_log(LOG_ERROR, "ARI StoredRecording field id failed validation\n");
- res = 0;
- }
- } else
- if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
- int prop_is_valid;
- prop_is_valid = ast_ari_validate_date(
- ast_json_object_iter_value(iter));
- if (!prop_is_valid) {
- ast_log(LOG_ERROR, "ARI StoredRecording field time failed validation\n");
+ int has_format = 0;
+ int has_name = 0;
+
+ for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+ if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
+ int prop_is_valid;
+ has_format = 1;
+ prop_is_valid = ast_ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
+ ast_log(LOG_ERROR, "ARI StoredRecording field format 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 StoredRecording field name failed validation\n");
res = 0;
}
} else
@@ -699,13 +680,13 @@
}
}
- if (!has_formats) {
- ast_log(LOG_ERROR, "ARI StoredRecording missing required field formats\n");
- res = 0;
- }
-
- if (!has_id) {
- ast_log(LOG_ERROR, "ARI StoredRecording missing required field id\n");
+ if (!has_format) {
+ ast_log(LOG_ERROR, "ARI StoredRecording missing required field format\n");
+ res = 0;
+ }
+
+ if (!has_name) {
+ ast_log(LOG_ERROR, "ARI StoredRecording missing required field name\n");
res = 0;
}
Modified: team/dlee/record/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/ari/ari_model_validators.h?view=diff&rev=395712&r1=395603&r2=395712
==============================================================================
--- team/dlee/record/res/ari/ari_model_validators.h (original)
+++ team/dlee/record/res/ari/ari_model_validators.h Mon Jul 29 16:29:48 2013
@@ -820,10 +820,8 @@
* - name: string (required)
* - state: string (required)
* StoredRecording
- * - duration_seconds: int
- * - formats: List[string] (required)
- * - id: string (required)
- * - time: Date
+ * - format: string (required)
+ * - name: string (required)
* FormatLangPair
* - format: string (required)
* - language: string (required)
Modified: team/dlee/record/res/ari/resource_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/ari/resource_recordings.c?view=diff&rev=395712&r1=395603&r2=395712
==============================================================================
--- team/dlee/record/res/ari/resource_recordings.c (original)
+++ team/dlee/record/res/ari/resource_recordings.c Mon Jul 29 16:29:48 2013
@@ -30,21 +30,111 @@
#include "asterisk/stasis_app_recording.h"
#include "resource_recordings.h"
-void ast_ari_get_stored_recordings(struct ast_variable *headers, struct ast_get_stored_recordings_args *args, struct ast_ari_response *response)
+void ast_ari_get_stored_recordings(struct ast_variable *headers,
+ struct ast_get_stored_recordings_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_get_stored_recordings\n");
+ RAII_VAR(struct ao2_container *, recordings, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+ struct ao2_iterator i;
+ void *obj;
+
+ recordings = stasis_app_stored_recording_find_all();
+
+ if (!recordings) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
+
+ json = ast_json_array_create();
+ if (!json) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
+
+ i = ao2_iterator_init(recordings, 0);
+ while ((obj = ao2_iterator_next(&i))) {
+ RAII_VAR(struct stasis_app_stored_recording *, recording, obj,
+ ao2_cleanup);
+
+ int r = ast_json_array_append(
+ json, stasis_app_stored_recording_to_json(recording));
+ if (r != 0) {
+ ast_ari_response_alloc_failed(response);
+ ao2_iterator_destroy(&i);
+ return;
+ }
+ }
+ ao2_iterator_destroy(&i);
+
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void ast_ari_get_stored_recording(struct ast_variable *headers, struct ast_get_stored_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_get_stored_recording(struct ast_variable *headers,
+ struct ast_get_stored_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_get_stored_recording\n");
+ RAII_VAR(struct stasis_app_stored_recording *, recording, NULL,
+ ao2_cleanup);
+ RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+
+ recording = stasis_app_stored_recording_find_by_name(
+ args->recording_name);
+ if (recording == NULL) {
+ ast_ari_response_error(response, 404, "Not Found",
+ "Recording not found");
+ return;
+ }
+
+ json = stasis_app_stored_recording_to_json(recording);
+ if (json == NULL) {
+ ast_ari_response_error(response, 500,
+ "Internal Server Error", "Error building response");
+ return;
+ }
+
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void ast_ari_delete_stored_recording(struct ast_variable *headers, struct ast_delete_stored_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_delete_stored_recording(struct ast_variable *headers,
+ struct ast_delete_stored_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_delete_stored_recording\n");
-}
-void ast_ari_get_live_recordings(struct ast_variable *headers, struct ast_get_live_recordings_args *args, struct ast_ari_response *response)
-{
- ast_log(LOG_ERROR, "TODO: ast_ari_get_live_recordings\n");
+ RAII_VAR(struct stasis_app_stored_recording *, recording, NULL,
+ ao2_cleanup);
+ int res;
+
+ recording = stasis_app_stored_recording_find_by_name(
+ args->recording_name);
+ if (recording == NULL) {
+ ast_ari_response_error(response, 404, "Not Found",
+ "Recording not found");
+ return;
+ }
+
+ res = stasis_app_stored_recording_delete(recording);
+
+ if (res != 0) {
+ switch (errno) {
+ case EACCES:
+ case EPERM:
+ ast_ari_response_error(response, 500,
+ "Internal Server Error",
+ "Delete failed");
+ break;
+ default:
+ ast_log(LOG_WARNING,
+ "Unexpected error deleting recording %s: %s\n",
+ args->recording_name, strerror(errno));
+ ast_ari_response_error(response, 500,
+ "Internal Server Error",
+ "Delete failed");
+ break;
+ }
+ return;
+ }
+
+ ast_ari_response_no_content(response);
}
void ast_ari_get_live_recording(struct ast_variable *headers,
Modified: team/dlee/record/res/ari/resource_recordings.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/ari/resource_recordings.h?view=diff&rev=395712&r1=395603&r2=395712
==============================================================================
--- team/dlee/record/res/ari/resource_recordings.h (original)
+++ team/dlee/record/res/ari/resource_recordings.h Mon Jul 29 16:29:48 2013
@@ -76,17 +76,6 @@
* \param[out] response HTTP response
*/
void ast_ari_delete_stored_recording(struct ast_variable *headers, struct ast_delete_stored_recording_args *args, struct ast_ari_response *response);
-/*! \brief Argument struct for ast_ari_get_live_recordings() */
-struct ast_get_live_recordings_args {
-};
-/*!
- * \brief List libe recordings.
- *
- * \param headers HTTP headers
- * \param args Swagger parameters
- * \param[out] response HTTP response
- */
-void ast_ari_get_live_recordings(struct ast_variable *headers, struct ast_get_live_recordings_args *args, struct ast_ari_response *response);
/*! \brief Argument struct for ast_ari_get_live_recording() */
struct ast_get_live_recording_args {
/*! \brief The name of the recording */
Modified: team/dlee/record/res/res_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_ari_model.c?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/res/res_ari_model.c (original)
+++ team/dlee/record/res/res_ari_model.c Mon Jul 29 16:29:48 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/record/res/res_ari_model.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_ari_model.exports.in?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/res/res_ari_model.exports.in (original)
+++ team/dlee/record/res/res_ari_model.exports.in Mon Jul 29 16:29:48 2013
@@ -1,6 +1,6 @@
{
global:
- LINKER_SYMBOL_PREFIXari_*;
+ LINKER_SYMBOL_PREFIXast_ari_*;
local:
*;
};
Copied: team/dlee/record/res/res_ari_recordings.c (from r395603, trunk/res/res_ari_recordings.c)
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_ari_recordings.c?view=diff&rev=395712&p1=trunk/res/res_ari_recordings.c&r1=395603&p2=team/dlee/record/res/res_ari_recordings.c&r2=395712
==============================================================================
--- trunk/res/res_ari_recordings.c (original)
+++ team/dlee/record/res/res_ari_recordings.c Mon Jul 29 16:29:48 2013
@@ -129,6 +129,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -183,6 +184,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -203,52 +205,6 @@
#endif /* AST_DEVMODE */
}
/*!
- * \brief Parameter parsing callback for /recordings/live.
- * \param get_params GET parameters in the HTTP request.
- * \param path_vars Path variables extracted from the request.
- * \param headers HTTP headers.
- * \param[out] response Response to the HTTP request.
- */
-static void ast_ari_get_live_recordings_cb(
- struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
-{
-#if defined(AST_DEVMODE)
- int is_valid;
- int code;
-#endif /* AST_DEVMODE */
-
- struct ast_get_live_recordings_args args = {};
- ast_ari_get_live_recordings(headers, &args, response);
-#if defined(AST_DEVMODE)
- code = response->response_code;
-
- switch (code) {
- case 0: /* Implementation is still a stub, or the code wasn't set */
- is_valid = response->message == NULL;
- break;
- case 500: /* Internal Server Error */
- case 501: /* Not Implemented */
- is_valid = 1;
- break;
- default:
- if (200 <= code && code <= 299) {
- is_valid = ast_ari_validate_list(response->message,
- ast_ari_validate_live_recording_fn());
- } else {
- ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live\n", code);
- is_valid = 0;
- }
- }
-
- if (!is_valid) {
- ast_log(LOG_ERROR, "Response validation failed for /recordings/live\n");
- ast_ari_response_error(response, 500,
- "Internal Server Error", "Response validation failed");
- }
-#endif /* AST_DEVMODE */
-}
-/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}.
* \param get_params GET parameters in the HTTP request.
* \param path_vars Path variables extracted from the request.
@@ -283,6 +239,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -337,6 +294,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -391,6 +349,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -445,6 +404,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -499,6 +459,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -553,6 +514,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -607,6 +569,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -707,7 +670,6 @@
static struct stasis_rest_handlers recordings_live = {
.path_segment = "live",
.callbacks = {
- [AST_HTTP_GET] = ast_ari_get_live_recordings_cb,
},
.num_children = 1,
.children = { &recordings_live_recordingName, }
Modified: team/dlee/record/res/res_statsd.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_statsd.c?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/res/res_statsd.c (original)
+++ team/dlee/record/res/res_statsd.c Mon Jul 29 16:29:48 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/record/rest-api-templates/ari_model_validators.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/rest-api-templates/ari_model_validators.c.mustache?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/rest-api-templates/ari_model_validators.c.mustache (original)
+++ team/dlee/record/rest-api-templates/ari_model_validators.c.mustache Mon Jul 29 16:29:48 2013
@@ -36,7 +36,7 @@
{{#api_declaration}}
{{#models}}
-int ari_validate_{{c_id}}(struct ast_json *json)
+int ast_ari_validate_{{c_id}}(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
@@ -59,7 +59,7 @@
} else
{{#subtypes}}
if (strcmp("{{id}}", discriminator) == 0) {
- return ari_validate_{{c_id}}(json);
+ return ast_ari_validate_{{c_id}}(json);
} else
{{/subtypes}}
{
@@ -78,12 +78,12 @@
{{/required}}
{{#type}}
{{#is_list}}
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_{{c_singular_name}});
+ ast_ari_validate_{{c_singular_name}});
{{/is_list}}
{{^is_list}}
- prop_is_valid = ari_validate_{{c_name}}(
+ prop_is_valid = ast_ari_validate_{{c_name}}(
ast_json_object_iter_value(iter));
{{/is_list}}
{{/type}}
@@ -113,9 +113,9 @@
return res;
}
-ari_validator ari_validate_{{c_id}}_fn(void)
+ari_validator ast_ari_validate_{{c_id}}_fn(void)
{
- return ari_validate_{{c_id}};
+ return ast_ari_validate_{{c_id}};
}
{{/models}}
{{/api_declaration}}
Modified: team/dlee/record/rest-api-templates/ari_model_validators.h.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/rest-api-templates/ari_model_validators.h.mustache?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/rest-api-templates/ari_model_validators.h.mustache (original)
+++ team/dlee/record/rest-api-templates/ari_model_validators.h.mustache Mon Jul 29 16:29:48 2013
@@ -19,7 +19,7 @@
* \brief Generated file - Build validators for ARI model objects.
*
* In addition to the normal validation functions one would normally expect,
- * each validator has a ari_validate_{id}_fn() companion function that returns
+ * each validator has a ast_ari_validate_{id}_fn() companion function that returns
* the validator's function pointer.
*
* The reason for this seamingly useless indirection is the way function
@@ -50,7 +50,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_void(struct ast_json *json);
+int ast_ari_validate_void(struct ast_json *json);
/*!
* \brief Validator for native Swagger byte.
@@ -59,7 +59,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_byte(struct ast_json *json);
+int ast_ari_validate_byte(struct ast_json *json);
/*!
* \brief Validator for native Swagger boolean.
@@ -68,7 +68,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_boolean(struct ast_json *json);
+int ast_ari_validate_boolean(struct ast_json *json);
/*!
* \brief Validator for native Swagger int.
@@ -77,7 +77,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_int(struct ast_json *json);
+int ast_ari_validate_int(struct ast_json *json);
/*!
* \brief Validator for native Swagger long.
@@ -86,7 +86,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_long(struct ast_json *json);
+int ast_ari_validate_long(struct ast_json *json);
/*!
* \brief Validator for native Swagger float.
@@ -95,7 +95,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_float(struct ast_json *json);
+int ast_ari_validate_float(struct ast_json *json);
/*!
* \brief Validator for native Swagger double.
@@ -104,7 +104,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_double(struct ast_json *json);
+int ast_ari_validate_double(struct ast_json *json);
/*!
* \brief Validator for native Swagger string.
@@ -113,7 +113,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_string(struct ast_json *json);
+int ast_ari_validate_string(struct ast_json *json);
/*!
* \brief Validator for native Swagger date.
@@ -122,7 +122,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_date(struct ast_json *json);
+int ast_ari_validate_date(struct ast_json *json);
/*!
* \brief Validator for a Swagger List[]/JSON array.
@@ -132,7 +132,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-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 *));
/*! @} */
@@ -153,14 +153,14 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_{{c_id}}(struct ast_json *json);
+int ast_ari_validate_{{c_id}}(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_{{c_id}}().
+ * \brief Function pointer to ast_ari_validate_{{c_id}}().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_{{c_id}}_fn(void);
+ari_validator ast_ari_validate_{{c_id}}_fn(void);
{{/models}}
{{/api_declaration}}
{{/apis}}
Modified: team/dlee/record/rest-api-templates/make_ari_stubs.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/rest-api-templates/make_ari_stubs.py?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/rest-api-templates/make_ari_stubs.py (original)
+++ team/dlee/record/rest-api-templates/make_ari_stubs.py Mon Jul 29 16:29:48 2013
@@ -44,22 +44,22 @@
API_TRANSFORMS = [
Transform(rel('api.wiki.mustache'),
'doc/rest-api/%s {{name_title}} REST API.wiki' % WIKI_PREFIX),
- Transform(rel('res_stasis_http_resource.c.mustache'),
- 'res/res_stasis_http_{{name}}.c'),
- Transform(rel('stasis_http_resource.h.mustache'),
- 'res/stasis_http/resource_{{name}}.h'),
- Transform(rel('stasis_http_resource.c.mustache'),
- 'res/stasis_http/resource_{{name}}.c', overwrite=False),
+ Transform(rel('res_ari_resource.c.mustache'),
+ 'res/res_ari_{{name}}.c'),
+ Transform(rel('ari_resource.h.mustache'),
+ 'res/ari/resource_{{name}}.h'),
+ Transform(rel('ari_resource.c.mustache'),
+ 'res/ari/resource_{{name}}.c', overwrite=False),
]
RESOURCES_TRANSFORMS = [
Transform(rel('models.wiki.mustache'),
'doc/rest-api/%s REST Data Models.wiki' % WIKI_PREFIX),
- Transform(rel('stasis_http.make.mustache'), 'res/stasis_http.make'),
+ Transform(rel('ari.make.mustache'), 'res/ari.make'),
Transform(rel('ari_model_validators.h.mustache'),
- 'res/stasis_http/ari_model_validators.h'),
+ 'res/ari/ari_model_validators.h'),
Transform(rel('ari_model_validators.c.mustache'),
- 'res/stasis_http/ari_model_validators.c'),
+ 'res/ari/ari_model_validators.c'),
]
Modified: team/dlee/record/rest-api-templates/rest_handler.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/rest-api-templates/rest_handler.mustache?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/rest-api-templates/rest_handler.mustache (original)
+++ team/dlee/record/rest-api-templates/rest_handler.mustache Mon Jul 29 16:29:48 2013
@@ -17,7 +17,7 @@
}}
{{!
* Recursive partial template to render a rest_handler. Used in
- * res_stasis_http_resource.c.mustache.
+ * res_ari_resource.c.mustache.
}}
{{#children}}
{{> rest_handler}}
@@ -31,7 +31,7 @@
.callbacks = {
{{#operations}}
{{#is_req}}
- [{{c_http_method}}] = stasis_http_{{c_nickname}}_cb,
+ [{{c_http_method}}] = ast_ari_{{c_nickname}}_cb,
{{/is_req}}
{{/operations}}
},
Modified: team/dlee/record/tests/test_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/tests/test_ari_model.c?view=diff&rev=395712&r1=395711&r2=395712
==============================================================================
--- team/dlee/record/tests/test_ari_model.c (original)
+++ team/dlee/record/tests/test_ari_model.c Mon Jul 29 16:29:48 2013
@@ -36,7 +36,7 @@
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
-#include "../res/stasis_http/ari_model_validators.h"
+#include "../res/ari/ari_model_validators.h"
AST_TEST_DEFINE(validate_byte)
{
@@ -58,34 +58,34 @@
uut = ast_json_integer_create(-128);
ast_test_validate(test, NULL != uut);
- ast_test_validate(test, ari_validate_byte(uut));
+ ast_test_validate(test, ast_ari_validate_byte(uut));
res = ast_json_integer_set(uut, 0);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_byte(uut));
+ ast_test_validate(test, ast_ari_validate_byte(uut));
res = ast_json_integer_set(uut, 255);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_byte(uut));
+ ast_test_validate(test, ast_ari_validate_byte(uut));
res = ast_json_integer_set(uut, -129);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_byte(uut));
+ ast_test_validate(test, !ast_ari_validate_byte(uut));
res = ast_json_integer_set(uut, 256);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_byte(uut));
+ ast_test_validate(test, !ast_ari_validate_byte(uut));
str = ast_json_string_create("not a byte");
ast_test_validate(test, NULL != str);
- ast_test_validate(test, !ari_validate_byte(str));
+ ast_test_validate(test, !ast_ari_validate_byte(str));
/* Even if the string has an integral value */
res = ast_json_string_set(str, "0");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_byte(str));
-
- ast_test_validate(test, !ari_validate_byte(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_byte(str));
+
+ ast_test_validate(test, !ast_ari_validate_byte(ast_json_null()));
return AST_TEST_PASS;
}
@@ -107,24 +107,24 @@
break;
}
- ast_test_validate(test, ari_validate_boolean(ast_json_true()));
- ast_test_validate(test, ari_validate_boolean(ast_json_false()));
+ ast_test_validate(test, ast_ari_validate_boolean(ast_json_true()));
+ ast_test_validate(test, ast_ari_validate_boolean(ast_json_false()));
str = ast_json_string_create("not a bool");
ast_test_validate(test, NULL != str);
- ast_test_validate(test, !ari_validate_boolean(str));
+ ast_test_validate(test, !ast_ari_validate_boolean(str));
/* Even if the string has a boolean value */
res = ast_json_string_set(str, "true");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_boolean(str));
+ ast_test_validate(test, !ast_ari_validate_boolean(str));
/* Even if the string has a boolean text in it */
res = ast_json_string_set(str, "true");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_boolean(str));
-
- ast_test_validate(test, !ari_validate_boolean(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_boolean(str));
+
+ ast_test_validate(test, !ast_ari_validate_boolean(ast_json_null()));
return AST_TEST_PASS;
}
@@ -149,34 +149,34 @@
uut = ast_json_integer_create(-2147483648LL);
ast_test_validate(test, NULL != uut);
- ast_test_validate(test, ari_validate_int(uut));
+ ast_test_validate(test, ast_ari_validate_int(uut));
res = ast_json_integer_set(uut, 0);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_int(uut));
+ ast_test_validate(test, ast_ari_validate_int(uut));
res = ast_json_integer_set(uut, 2147483647LL);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_int(uut));
+ ast_test_validate(test, ast_ari_validate_int(uut));
res = ast_json_integer_set(uut, -2147483649LL);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_int(uut));
+ ast_test_validate(test, !ast_ari_validate_int(uut));
res = ast_json_integer_set(uut, 2147483648LL);
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_int(uut));
+ ast_test_validate(test, !ast_ari_validate_int(uut));
str = ast_json_string_create("not a int");
ast_test_validate(test, NULL != str);
- ast_test_validate(test, !ari_validate_int(str));
+ ast_test_validate(test, !ast_ari_validate_int(str));
/* Even if the string has an integral value */
res = ast_json_string_set(str, "0");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_int(str));
-
- ast_test_validate(test, !ari_validate_int(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_int(str));
+
+ ast_test_validate(test, !ast_ari_validate_int(ast_json_null()));
return AST_TEST_PASS;
}
@@ -201,18 +201,18 @@
uut = ast_json_integer_create(0);
ast_test_validate(test, NULL != uut);
- ast_test_validate(test, ari_validate_long(uut));
+ ast_test_validate(test, ast_ari_validate_long(uut));
str = ast_json_string_create("not a long");
ast_test_validate(test, NULL != str);
- ast_test_validate(test, !ari_validate_long(str));
+ ast_test_validate(test, !ast_ari_validate_long(str));
/* Even if the string has an integral value */
res = ast_json_string_set(str, "0");
[... 85 lines stripped ...]
More information about the asterisk-commits
mailing list