[asterisk-commits] dlee: branch dlee/record-controls r395713 - in /team/dlee/record-controls: ./...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 29 16:39:32 CDT 2013
Author: dlee
Date: Mon Jul 29 16:39:29 2013
New Revision: 395713
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395713
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-controls/include/asterisk/ari.h
- copied unchanged from r395603, trunk/include/asterisk/ari.h
team/dlee/record-controls/res/ari/
- copied from r395603, trunk/res/ari/
team/dlee/record-controls/res/ari.make
- copied unchanged from r395603, trunk/res/ari.make
team/dlee/record-controls/res/res_ari.c
- copied unchanged from r395603, trunk/res/res_ari.c
team/dlee/record-controls/res/res_ari.exports.in
- copied unchanged from r395603, trunk/res/res_ari.exports.in
team/dlee/record-controls/res/res_ari_asterisk.c
- copied unchanged from r395603, trunk/res/res_ari_asterisk.c
team/dlee/record-controls/res/res_ari_bridges.c
- copied unchanged from r395603, trunk/res/res_ari_bridges.c
team/dlee/record-controls/res/res_ari_channels.c
- copied unchanged from r395603, trunk/res/res_ari_channels.c
team/dlee/record-controls/res/res_ari_endpoints.c
- copied unchanged from r395603, trunk/res/res_ari_endpoints.c
team/dlee/record-controls/res/res_ari_events.c
- copied unchanged from r395603, trunk/res/res_ari_events.c
team/dlee/record-controls/res/res_ari_playback.c
- copied unchanged from r395603, trunk/res/res_ari_playback.c
team/dlee/record-controls/res/res_ari_recordings.c
- copied, changed from r395603, trunk/res/res_ari_recordings.c
team/dlee/record-controls/res/res_ari_sounds.c
- copied unchanged from r395603, trunk/res/res_ari_sounds.c
team/dlee/record-controls/rest-api-templates/ari.make.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari.make.mustache
team/dlee/record-controls/rest-api-templates/ari_resource.c.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari_resource.c.mustache
team/dlee/record-controls/rest-api-templates/ari_resource.h.mustache
- copied unchanged from r395603, trunk/rest-api-templates/ari_resource.h.mustache
team/dlee/record-controls/rest-api-templates/res_ari_resource.c.mustache
- copied unchanged from r395603, trunk/rest-api-templates/res_ari_resource.c.mustache
team/dlee/record-controls/tests/test_ari.c
- copied unchanged from r395603, trunk/tests/test_ari.c
Removed:
team/dlee/record-controls/include/asterisk/stasis_http.h
team/dlee/record-controls/res/res_stasis_http.c
team/dlee/record-controls/res/res_stasis_http.exports.in
team/dlee/record-controls/res/res_stasis_http_asterisk.c
team/dlee/record-controls/res/res_stasis_http_bridges.c
team/dlee/record-controls/res/res_stasis_http_channels.c
team/dlee/record-controls/res/res_stasis_http_endpoints.c
team/dlee/record-controls/res/res_stasis_http_events.c
team/dlee/record-controls/res/res_stasis_http_playback.c
team/dlee/record-controls/res/res_stasis_http_recordings.c
team/dlee/record-controls/res/res_stasis_http_sounds.c
team/dlee/record-controls/res/stasis_http/
team/dlee/record-controls/res/stasis_http.make
team/dlee/record-controls/rest-api-templates/res_stasis_http_resource.c.mustache
team/dlee/record-controls/rest-api-templates/stasis_http.make.mustache
team/dlee/record-controls/rest-api-templates/stasis_http_resource.c.mustache
team/dlee/record-controls/rest-api-templates/stasis_http_resource.h.mustache
team/dlee/record-controls/tests/test_stasis_http.c
Modified:
team/dlee/record-controls/ (props changed)
team/dlee/record-controls/configs/ari.conf.sample
team/dlee/record-controls/main/mixmonitor.c
team/dlee/record-controls/main/stasis_config.c
team/dlee/record-controls/res/Makefile
team/dlee/record-controls/res/ari/resource_recordings.c
team/dlee/record-controls/res/ari/resource_recordings.h
team/dlee/record-controls/res/res_ari_model.c
team/dlee/record-controls/res/res_ari_model.exports.in
team/dlee/record-controls/res/res_statsd.c
team/dlee/record-controls/rest-api-templates/ari_model_validators.c.mustache
team/dlee/record-controls/rest-api-templates/ari_model_validators.h.mustache
team/dlee/record-controls/rest-api-templates/make_ari_stubs.py
team/dlee/record-controls/rest-api-templates/rest_handler.mustache
team/dlee/record-controls/tests/test_ari_model.c
Propchange: team/dlee/record-controls/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul 29 16:39:29 2013
@@ -1,1 +1,1 @@
-/trunk:1-395588
+/trunk:1-395603
Modified: team/dlee/record-controls/configs/ari.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/configs/ari.conf.sample?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/configs/ari.conf.sample (original)
+++ team/dlee/record-controls/configs/ari.conf.sample Mon Jul 29 16:39:29 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-controls/main/mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/main/mixmonitor.c?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/main/mixmonitor.c (original)
+++ team/dlee/record-controls/main/mixmonitor.c Mon Jul 29 16:39:29 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-controls/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/main/stasis_config.c?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/main/stasis_config.c (original)
+++ team/dlee/record-controls/main/stasis_config.c Mon Jul 29 16:39:29 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-controls/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/Makefile?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/res/Makefile (original)
+++ team/dlee/record-controls/res/Makefile Mon Jul 29 16:39:29 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
Modified: team/dlee/record-controls/res/ari/resource_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/ari/resource_recordings.c?view=diff&rev=395713&r1=395603&r2=395713
==============================================================================
--- team/dlee/record-controls/res/ari/resource_recordings.c (original)
+++ team/dlee/record-controls/res/ari/resource_recordings.c Mon Jul 29 16:39:29 2013
@@ -71,27 +71,81 @@
ast_ari_response_ok(response, ast_json_ref(json));
}
-void ast_ari_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct ast_ari_response *response)
+static void control_recording(const char *name,
+ enum stasis_app_recording_media_operation operation,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_cancel_recording\n");
+ RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+ enum stasis_app_recording_oper_results res;
+
+ recording = stasis_app_recording_find_by_name(name);
+ if (recording == NULL) {
+ ast_ari_response_error(response, 404, "Not Found",
+ "Recording not found");
+ return;
+ }
+
+ res = stasis_app_recording_operation(recording, operation);
+
+ switch (res) {
+ case STASIS_APP_RECORDING_OPER_OK:
+ ast_ari_response_no_content(response);
+ return;
+ case STASIS_APP_RECORDING_OPER_FAILED:
+ ast_ari_response_error(response, 500,
+ "Internal Server Error", "Recording operation failed");
+ return;
+ case STASIS_APP_RECORDING_OPER_NOT_RECORDING:
+ ast_ari_response_error(response, 409,
+ "Conflict", "Recording not in session");
+ }
}
-void ast_ari_stop_recording(struct ast_variable *headers, struct ast_stop_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_cancel_recording(struct ast_variable *headers,
+ struct ast_cancel_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_stop_recording\n");
+ control_recording(args->recording_name, STASIS_APP_RECORDING_CANCEL,
+ response);
}
-void ast_ari_pause_recording(struct ast_variable *headers, struct ast_pause_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_stop_recording(struct ast_variable *headers,
+ struct ast_stop_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_pause_recording\n");
+ control_recording(args->recording_name, STASIS_APP_RECORDING_STOP,
+ response);
}
-void ast_ari_unpause_recording(struct ast_variable *headers, struct ast_unpause_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_pause_recording(struct ast_variable *headers,
+ struct ast_pause_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_unpause_recording\n");
+ control_recording(args->recording_name, STASIS_APP_RECORDING_PAUSE,
+ response);
}
-void ast_ari_mute_recording(struct ast_variable *headers, struct ast_mute_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_unpause_recording(struct ast_variable *headers,
+ struct ast_unpause_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_mute_recording\n");
+ control_recording(args->recording_name, STASIS_APP_RECORDING_UNPAUSE,
+ response);
}
-void ast_ari_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct ast_ari_response *response)
+
+void ast_ari_mute_recording(struct ast_variable *headers,
+ struct ast_mute_recording_args *args,
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: ast_ari_unmute_recording\n");
+ control_recording(args->recording_name, STASIS_APP_RECORDING_MUTE,
+ response);
}
+
+void ast_ari_unmute_recording(struct ast_variable *headers,
+ struct ast_unmute_recording_args *args,
+ struct ast_ari_response *response)
+{
+ control_recording(args->recording_name, STASIS_APP_RECORDING_UNMUTE,
+ response);
+}
Modified: team/dlee/record-controls/res/ari/resource_recordings.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/ari/resource_recordings.h?view=diff&rev=395713&r1=395603&r2=395713
==============================================================================
--- team/dlee/record-controls/res/ari/resource_recordings.h (original)
+++ team/dlee/record-controls/res/ari/resource_recordings.h Mon Jul 29 16:39:29 2013
@@ -134,7 +134,7 @@
/*!
* \brief Pause a live recording.
*
- * Pausing a recording suspends silence detection, which will be restarted when the recording is unpaused.
+ * Pausing a recording suspends silence detection, which will be restarted when the recording is unpaused. Paused time is not included in the accounting for maxDurationSeconds.
*
* \param headers HTTP headers
* \param args Swagger parameters
Modified: team/dlee/record-controls/res/res_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/res_ari_model.c?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/res/res_ari_model.c (original)
+++ team/dlee/record-controls/res/res_ari_model.c Mon Jul 29 16:39:29 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-controls/res/res_ari_model.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/res_ari_model.exports.in?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/res/res_ari_model.exports.in (original)
+++ team/dlee/record-controls/res/res_ari_model.exports.in Mon Jul 29 16:39:29 2013
@@ -1,6 +1,6 @@
{
global:
- LINKER_SYMBOL_PREFIXari_*;
+ LINKER_SYMBOL_PREFIXast_ari_*;
local:
*;
};
Copied: team/dlee/record-controls/res/res_ari_recordings.c (from r395603, trunk/res/res_ari_recordings.c)
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/res_ari_recordings.c?view=diff&rev=395713&p1=trunk/res/res_ari_recordings.c&r1=395603&p2=team/dlee/record-controls/res/res_ari_recordings.c&r2=395713
==============================================================================
--- trunk/res/res_ari_recordings.c (original)
+++ team/dlee/record-controls/res/res_ari_recordings.c Mon Jul 29 16:39:29 2013
@@ -283,6 +283,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -337,6 +338,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -391,6 +393,7 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
is_valid = 1;
break;
default:
@@ -445,6 +448,8 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
+ case 409: /* Recording not in session */
is_valid = 1;
break;
default:
@@ -499,6 +504,8 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
+ case 409: /* Recording not in session */
is_valid = 1;
break;
default:
@@ -553,6 +560,8 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
+ case 409: /* Recording not in session */
is_valid = 1;
break;
default:
@@ -607,6 +616,8 @@
break;
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
+ case 404: /* Recording not found */
+ case 409: /* Recording not in session */
is_valid = 1;
break;
default:
Modified: team/dlee/record-controls/res/res_statsd.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/res/res_statsd.c?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/res/res_statsd.c (original)
+++ team/dlee/record-controls/res/res_statsd.c Mon Jul 29 16:39:29 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-controls/rest-api-templates/ari_model_validators.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/rest-api-templates/ari_model_validators.c.mustache?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/rest-api-templates/ari_model_validators.c.mustache (original)
+++ team/dlee/record-controls/rest-api-templates/ari_model_validators.c.mustache Mon Jul 29 16:39:29 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-controls/rest-api-templates/ari_model_validators.h.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/rest-api-templates/ari_model_validators.h.mustache?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/rest-api-templates/ari_model_validators.h.mustache (original)
+++ team/dlee/record-controls/rest-api-templates/ari_model_validators.h.mustache Mon Jul 29 16:39:29 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-controls/rest-api-templates/make_ari_stubs.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/rest-api-templates/make_ari_stubs.py?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/rest-api-templates/make_ari_stubs.py (original)
+++ team/dlee/record-controls/rest-api-templates/make_ari_stubs.py Mon Jul 29 16:39:29 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-controls/rest-api-templates/rest_handler.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/rest-api-templates/rest_handler.mustache?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/rest-api-templates/rest_handler.mustache (original)
+++ team/dlee/record-controls/rest-api-templates/rest_handler.mustache Mon Jul 29 16:39:29 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-controls/tests/test_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/tests/test_ari_model.c?view=diff&rev=395713&r1=395712&r2=395713
==============================================================================
--- team/dlee/record-controls/tests/test_ari_model.c (original)
+++ team/dlee/record-controls/tests/test_ari_model.c Mon Jul 29 16:39:29 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");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_long(str));
-
- ast_test_validate(test, !ari_validate_long(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_long(str));
+
+ ast_test_validate(test, !ast_ari_validate_long(ast_json_null()));
return AST_TEST_PASS;
}
@@ -237,13 +237,13 @@
uut = ast_json_string_create("text");
ast_test_validate(test, NULL != uut);
- ast_test_validate(test, ari_validate_string(uut));
+ ast_test_validate(test, ast_ari_validate_string(uut));
res = ast_json_string_set(uut, "");
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_string(uut));
-
- ast_test_validate(test, !ari_validate_string(ast_json_null()));
+ ast_test_validate(test, ast_ari_validate_string(uut));
+
+ ast_test_validate(test, !ast_ari_validate_string(ast_json_null()));
return AST_TEST_PASS;
}
@@ -341,7 +341,7 @@
for (i = 0; i < ARRAY_LEN(valid_dates); ++i) {
res = ast_json_string_set(uut, valid_dates[i]);
ast_test_validate(test, 0 == res);
- if (!ari_validate_date(uut)) {
+ if (!ast_ari_validate_date(uut)) {
ast_test_status_update(test,
"Expected '%s' to be a valid date\n",
valid_dates[i]);
@@ -352,7 +352,7 @@
for (i = 0; i < ARRAY_LEN(invalid_dates); ++i) {
res = ast_json_string_set(uut, invalid_dates[i]);
ast_test_validate(test, 0 == res);
- if (ari_validate_date(uut)) {
+ if (ast_ari_validate_date(uut)) {
ast_test_status_update(test,
"Expected '%s' to be an invalid date\n",
invalid_dates[i]);
@@ -360,7 +360,7 @@
}
}
- ast_test_validate(test, !ari_validate_string(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_string(ast_json_null()));
return test_res;
}
@@ -385,21 +385,21 @@
uut = ast_json_array_create();
ast_test_validate(test, NULL != uut);
- ast_test_validate(test, ari_validate_list(uut, ari_validate_string));
- ast_test_validate(test, ari_validate_list(uut, ari_validate_int));
+ ast_test_validate(test, ast_ari_validate_list(uut, ast_ari_validate_string));
+ ast_test_validate(test, ast_ari_validate_list(uut, ast_ari_validate_int));
res = ast_json_array_append(uut, ast_json_string_create(""));
ast_test_validate(test, 0 == res);
- ast_test_validate(test, ari_validate_list(uut, ari_validate_string));
- ast_test_validate(test, !ari_validate_list(uut, ari_validate_int));
+ ast_test_validate(test, ast_ari_validate_list(uut, ast_ari_validate_string));
+ ast_test_validate(test, !ast_ari_validate_list(uut, ast_ari_validate_int));
res = ast_json_array_append(uut, ast_json_integer_create(0));
ast_test_validate(test, 0 == res);
- ast_test_validate(test, !ari_validate_list(uut, ari_validate_string));
- ast_test_validate(test, !ari_validate_list(uut, ari_validate_int));
+ ast_test_validate(test, !ast_ari_validate_list(uut, ast_ari_validate_string));
+ ast_test_validate(test, !ast_ari_validate_list(uut, ast_ari_validate_int));
ast_test_validate(test,
- !ari_validate_list(ast_json_null(), ari_validate_string));
+ !ast_ari_validate_list(ast_json_null(), ast_ari_validate_string));
return AST_TEST_PASS;
}
More information about the asterisk-commits
mailing list