[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
* at the top of the source tree.
*/
-#ifndef _ASTERISK_STASIS_HTTP_H
-#define _ASTERISK_STASIS_HTTP_H
+#ifndef _ASTERISK_ARI_H
+#define _ASTERISK_ARI_H
/*! \file
*
* \brief Stasis RESTful API hooks.
*
* This header file is used mostly as glue code between generated declarations
- * and res_stasis_http.c.
+ * and res_ari.c.
*
* \author David M. Lee, II <dlee@digium.com>
*/
* \brief Configured encoding format for JSON output.
* \return JSON output encoding (compact, pretty, etc.)
*/
-enum ast_json_encoding_format stasis_http_json_format(void);
+enum ast_json_encoding_format ast_ari_json_format(void);
-struct stasis_http_response;
+struct ast_ari_response;
/*!
* \brief Callback type for RESTful method handlers.
typedef void (*stasis_rest_callback)(struct ast_variable *get_params,
struct ast_variable *path_vars,
struct ast_variable *headers,
- struct stasis_http_response *response);
+ struct ast_ari_response *response);
/*!
* \brief Handler for a single RESTful path segment.
/*!
* Response type for RESTful requests
*/
-struct stasis_http_response {
+struct ast_ari_response {
/*! Response message */
struct ast_json *message;
/*! \r\n seperated response headers */
* \return 0 on success.
* \return non-zero on failure.
*/
-int stasis_http_add_handler(struct stasis_rest_handlers *handler);
+int ast_ari_add_handler(struct stasis_rest_handlers *handler);
/*!
* Remove a resource for REST handling.
* \return 0 on success.
* \return non-zero on failure.
*/
-int stasis_http_remove_handler(struct stasis_rest_handlers *handler);
+int ast_ari_remove_handler(struct stasis_rest_handlers *handler);
/*!
* \internal
* \brief Stasis RESTful invocation handler.
*
- * Only call from res_stasis_http and test_stasis_http. Only public to allow
+ * Only call from res_ari and test_ari. Only public to allow
* for unit testing.
*
* \param ser TCP/TLS connection.
* \param headers HTTP headers.
* \param[out] response RESTful HTTP response.
*/
-void stasis_http_invoke(struct ast_tcptls_session_instance *ser,
+void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
const char *uri, enum ast_http_method method,
struct ast_variable *get_params, struct ast_variable *headers,
- struct stasis_http_response *response);
+ struct ast_ari_response *response);
/*!
* \internal
* \brief Service function for API declarations.
*
- * Only call from res_stasis_http and test_stasis_http. Only public to allow
+ * Only call from res_ari and test_ari. Only public to allow
* for unit testing.
*
* \param uri Requested URI, relative to the docs path.
* \param headers HTTP headers.
* \param[out] response RESTful HTTP response.
*/
-void stasis_http_get_docs(const char *uri, struct ast_variable *headers, struct stasis_http_response *response);
+void ast_ari_get_docs(const char *uri, struct ast_variable *headers, struct ast_ari_response *response);
/*! \brief Abstraction for reading/writing JSON to a WebSocket */
-struct ari_websocket_session;
+struct ast_ari_websocket_session;
/*!
* \brief Create an ARI WebSocket session.
* \return New ARI WebSocket session.
* \return \c NULL on error.
*/
-struct ari_websocket_session *ari_websocket_session_create(
+struct ast_ari_websocket_session *ast_ari_websocket_session_create(
struct ast_websocket *ws_session, int (*validator)(struct ast_json *));
/*!
* \return Message received.
* \return \c NULL if WebSocket could not be read.
*/
-struct ast_json *ari_websocket_session_read(
- struct ari_websocket_session *session);
+struct ast_json *ast_ari_websocket_session_read(
+ struct ast_ari_websocket_session *session);
/*!
* \brief Send a message to an ARI WebSocket.
* \return 0 on success.
* \return Non-zero on error.
*/
-int ari_websocket_session_write(struct ari_websocket_session *session,
+int ast_ari_websocket_session_write(struct ast_ari_websocket_session *session,
struct ast_json *message);
/*!
*
* \return JSON message specifying an out-of-memory error.
*/
-struct ast_json *ari_oom_json(void);
+struct ast_json *ast_ari_oom_json(void);
/*!
- * \brief Fill in an error \a stasis_http_response.
+ * \brief Fill in an error \a ast_ari_response.
* \param response Response to fill in.
* \param response_code HTTP response code.
* \param response_text Text corresponding to the HTTP response code.
* \param message_fmt Error message format string.
*/
-void stasis_http_response_error(struct stasis_http_response *response,
+void ast_ari_response_error(struct ast_ari_response *response,
int response_code,
const char *response_text,
const char *message_fmt, ...)
__attribute__((format(printf, 4, 5)));
/*!
- * \brief Fill in an \c OK (200) \a stasis_http_response.
+ * \brief Fill in an \c OK (200) \a ast_ari_response.
* \param response Response to fill in.
* \param message JSON response. This reference is stolen, so just \ref
* ast_json_incref if you need to keep a reference to it.
*/
-void stasis_http_response_ok(struct stasis_http_response *response,
+void ast_ari_response_ok(struct ast_ari_response *response,
struct ast_json *message);
/*!
- * \brief Fill in a <tt>No Content</tt> (204) \a stasis_http_response.
+ * \brief Fill in a <tt>No Content</tt> (204) \a ast_ari_response.
*/
-void stasis_http_response_no_content(struct stasis_http_response *response);
+void ast_ari_response_no_content(struct ast_ari_response *response);
/*!
- * \brief Fill in a <tt>Created</tt> (201) \a stasis_http_response.
+ * \brief Fill in a <tt>Created</tt> (201) \a ast_ari_response.
*/
-void stasis_http_response_created(struct stasis_http_response *response,
+void ast_ari_response_created(struct ast_ari_response *response,
const char *url, struct ast_json *message);
/*!
* \brief Fill in \a response with a 500 message for allocation failures.
* \param response Response to fill in.
*/
-void stasis_http_response_alloc_failed(struct stasis_http_response *response);
+void ast_ari_response_alloc_failed(struct ast_ari_response *response);
-#endif /* _ASTERISK_STASIS_HTTP_H */
+#endif /* _ASTERISK_ARI_H */
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,
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
--- /dev/null
+#
+# Asterisk -- A telephony toolkit for Linux.
+#
+# Generated Makefile for res_ari dependencies.
+#
+# Copyright (C) 2013, Digium, Inc.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License
+#
+
+#
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# !!!!! DO NOT EDIT !!!!!
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# This file is generated by a template. Please see the original template at
+# rest-api-templates/ari.make.mustache
+#
+
+res_ari_asterisk.so: ari/resource_asterisk.o
+
+ari/resource_asterisk.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_asterisk)
+
+res_ari_endpoints.so: ari/resource_endpoints.o
+
+ari/resource_endpoints.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_endpoints)
+
+res_ari_channels.so: ari/resource_channels.o
+
+ari/resource_channels.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_channels)
+
+res_ari_bridges.so: ari/resource_bridges.o
+
+ari/resource_bridges.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_bridges)
+
+res_ari_recordings.so: ari/resource_recordings.o
+
+ari/resource_recordings.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_recordings)
+
+res_ari_sounds.so: ari/resource_sounds.o
+
+ari/resource_sounds.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_sounds)
+
+res_ari_playback.so: ari/resource_playback.o
+
+ari/resource_playback.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_playback)
+
+res_ari_events.so: ari/resource_events.o
+
+ari/resource_events.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_events)
+
#include "asterisk/module.h"
#include "ari_model_validators.h"
-int ari_validate_asterisk_info(struct ast_json *json)
+int ast_ari_validate_asterisk_info(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
return res;
}
-ari_validator ari_validate_asterisk_info_fn(void)
+ari_validator ast_ari_validate_asterisk_info_fn(void)
{
- return ari_validate_asterisk_info;
+ return ast_ari_validate_asterisk_info;
}
-int ari_validate_variable(struct ast_json *json)
+int ast_ari_validate_variable(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_value = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Variable field value failed validation\n");
return res;
}
-ari_validator ari_validate_variable_fn(void)
+ari_validator ast_ari_validate_variable_fn(void)
{
- return ari_validate_variable;
+ return ast_ari_validate_variable;
}
-int ari_validate_endpoint(struct ast_json *json)
+int ast_ari_validate_endpoint(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("channel_ids", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel_ids = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_string);
+ ast_ari_validate_string);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field channel_ids failed validation\n");
res = 0;
if (strcmp("resource", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_resource = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field resource failed validation\n");
} else
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field state failed validation\n");
if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_technology = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Endpoint field technology failed validation\n");
return res;
}
-ari_validator ari_validate_endpoint_fn(void)
+ari_validator ast_ari_validate_endpoint_fn(void)
{
- return ari_validate_endpoint;
+ return ast_ari_validate_endpoint;
}
-int ari_validate_caller_id(struct ast_json *json)
+int ast_ari_validate_caller_id(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_name = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI CallerID field name failed validation\n");
if (strcmp("number", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_number = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI CallerID field number failed validation\n");
return res;
}
-ari_validator ari_validate_caller_id_fn(void)
+ari_validator ast_ari_validate_caller_id_fn(void)
{
- return ari_validate_caller_id;
+ return ast_ari_validate_caller_id;
}
-int ari_validate_channel(struct ast_json *json)
+int ast_ari_validate_channel(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("accountcode", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_accountcode = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field accountcode failed validation\n");
if (strcmp("caller", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_caller = 1;
- prop_is_valid = ari_validate_caller_id(
+ prop_is_valid = ast_ari_validate_caller_id(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field caller failed validation\n");
if (strcmp("connected", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_connected = 1;
- prop_is_valid = ari_validate_caller_id(
+ prop_is_valid = ast_ari_validate_caller_id(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field connected failed validation\n");
if (strcmp("creationtime", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_creationtime = 1;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field creationtime failed validation\n");
if (strcmp("dialplan", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_dialplan = 1;
- prop_is_valid = ari_validate_dialplan_cep(
+ prop_is_valid = ast_ari_validate_dialplan_cep(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field dialplan failed validation\n");
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_id = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field id failed validation\n");
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_name = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field name failed validation\n");
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_state = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Channel field state failed validation\n");
return res;
}
-ari_validator ari_validate_channel_fn(void)
+ari_validator ast_ari_validate_channel_fn(void)
{
- return ari_validate_channel;
+ return ast_ari_validate_channel;
}
-int ari_validate_dialed(struct ast_json *json)
+int ast_ari_validate_dialed(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
return res;
}
-ari_validator ari_validate_dialed_fn(void)
+ari_validator ast_ari_validate_dialed_fn(void)
{
- return ari_validate_dialed;
+ return ast_ari_validate_dialed;
}
-int ari_validate_dialplan_cep(struct ast_json *json)
+int ast_ari_validate_dialplan_cep(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("context", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_context = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field context failed validation\n");
if (strcmp("exten", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_exten = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field exten failed validation\n");
if (strcmp("priority", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_priority = 1;
- prop_is_valid = ari_validate_long(
+ prop_is_valid = ast_ari_validate_long(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI DialplanCEP field priority failed validation\n");
return res;
}
-ari_validator ari_validate_dialplan_cep_fn(void)
+ari_validator ast_ari_validate_dialplan_cep_fn(void)
{
- return ari_validate_dialplan_cep;
+ return ast_ari_validate_dialplan_cep;
}
-int ari_validate_bridge(struct ast_json *json)
+int ast_ari_validate_bridge(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("bridge_class", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge_class = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field bridge_class failed validation\n");
if (strcmp("bridge_type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field bridge_type failed validation\n");
if (strcmp("channels", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channels = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_string);
+ ast_ari_validate_string);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field channels failed validation\n");
res = 0;
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_id = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
if (strcmp("technology", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_technology = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Bridge field technology failed validation\n");
return res;
}
-ari_validator ari_validate_bridge_fn(void)
+ari_validator ast_ari_validate_bridge_fn(void)
{
- return ari_validate_bridge;
+ return ast_ari_validate_bridge;
}
-int ari_validate_live_recording(struct ast_json *json)
+int ast_ari_validate_live_recording(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_format = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI LiveRecording field format failed validation\n");
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_name = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI LiveRecording field name failed validation\n");
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_state = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
return res;
}
-ari_validator ari_validate_live_recording_fn(void)
+ari_validator ast_ari_validate_live_recording_fn(void)
{
- return ari_validate_live_recording;
+ return ast_ari_validate_live_recording;
}
-int ari_validate_stored_recording(struct ast_json *json)
+int ast_ari_validate_stored_recording(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
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 = ari_validate_int(
+ 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");
if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_formats = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_string);
+ ast_ari_validate_string);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StoredRecording field formats failed validation\n");
res = 0;
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_id = 1;
- prop_is_valid = ari_validate_string(
+ 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");
} else
if (strcmp("time", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ 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");
return res;
}
-ari_validator ari_validate_stored_recording_fn(void)
+ari_validator ast_ari_validate_stored_recording_fn(void)
{
- return ari_validate_stored_recording;
+ return ast_ari_validate_stored_recording;
}
-int ari_validate_format_lang_pair(struct ast_json *json)
+int ast_ari_validate_format_lang_pair(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("format", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_format = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI FormatLangPair field format failed validation\n");
if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_language = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI FormatLangPair field language failed validation\n");
return res;
}
-ari_validator ari_validate_format_lang_pair_fn(void)
+ari_validator ast_ari_validate_format_lang_pair_fn(void)
{
- return ari_validate_format_lang_pair;
+ return ast_ari_validate_format_lang_pair;
}
-int ari_validate_sound(struct ast_json *json)
+int ast_ari_validate_sound(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("formats", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_formats = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_format_lang_pair);
+ ast_ari_validate_format_lang_pair);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field formats failed validation\n");
res = 0;
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_id = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field id failed validation\n");
} else
if (strcmp("text", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Sound field text failed validation\n");
return res;
}
-ari_validator ari_validate_sound_fn(void)
+ari_validator ast_ari_validate_sound_fn(void)
{
- return ari_validate_sound;
+ return ast_ari_validate_sound;
}
-int ari_validate_playback(struct ast_json *json)
+int ast_ari_validate_playback(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_id = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field id failed validation\n");
} else
if (strcmp("language", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field language failed validation\n");
if (strcmp("media_uri", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_media_uri = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field media_uri failed validation\n");
if (strcmp("state", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_state = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field state failed validation\n");
if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_target_uri = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Playback field target_uri failed validation\n");
return res;
}
-ari_validator ari_validate_playback_fn(void)
+ari_validator ast_ari_validate_playback_fn(void)
{
- return ari_validate_playback;
+ return ast_ari_validate_playback;
}
-int ari_validate_application_replaced(struct ast_json *json)
+int ast_ari_validate_application_replaced(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ApplicationReplaced field timestamp failed validation\n");
return res;
}
-ari_validator ari_validate_application_replaced_fn(void)
+ari_validator ast_ari_validate_application_replaced_fn(void)
{
- return ari_validate_application_replaced;
+ return ast_ari_validate_application_replaced;
}
-int ari_validate_bridge_created(struct ast_json *json)
+int ast_ari_validate_bridge_created(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field timestamp failed validation\n");
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeCreated field bridge failed validation\n");
return res;
}
-ari_validator ari_validate_bridge_created_fn(void)
+ari_validator ast_ari_validate_bridge_created_fn(void)
{
- return ari_validate_bridge_created;
+ return ast_ari_validate_bridge_created;
}
-int ari_validate_bridge_destroyed(struct ast_json *json)
+int ast_ari_validate_bridge_destroyed(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field timestamp failed validation\n");
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeDestroyed field bridge failed validation\n");
return res;
}
-ari_validator ari_validate_bridge_destroyed_fn(void)
+ari_validator ast_ari_validate_bridge_destroyed_fn(void)
{
- return ari_validate_bridge_destroyed;
+ return ast_ari_validate_bridge_destroyed;
}
-int ari_validate_bridge_merged(struct ast_json *json)
+int ast_ari_validate_bridge_merged(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field timestamp failed validation\n");
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field bridge failed validation\n");
if (strcmp("bridge_from", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge_from = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI BridgeMerged field bridge_from failed validation\n");
return res;
}
-ari_validator ari_validate_bridge_merged_fn(void)
+ari_validator ast_ari_validate_bridge_merged_fn(void)
{
- return ari_validate_bridge_merged;
+ return ast_ari_validate_bridge_merged;
}
-int ari_validate_channel_caller_id(struct ast_json *json)
+int ast_ari_validate_channel_caller_id(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field timestamp failed validation\n");
if (strcmp("caller_presentation", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_caller_presentation = 1;
- prop_is_valid = ari_validate_int(
+ prop_is_valid = ast_ari_validate_int(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation failed validation\n");
if (strcmp("caller_presentation_txt", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_caller_presentation_txt = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field caller_presentation_txt failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCallerId field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_caller_id_fn(void)
+ari_validator ast_ari_validate_channel_caller_id_fn(void)
{
- return ari_validate_channel_caller_id;
+ return ast_ari_validate_channel_caller_id;
}
-int ari_validate_channel_created(struct ast_json *json)
+int ast_ari_validate_channel_created(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelCreated field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_created_fn(void)
+ari_validator ast_ari_validate_channel_created_fn(void)
{
- return ari_validate_channel_created;
+ return ast_ari_validate_channel_created;
}
-int ari_validate_channel_destroyed(struct ast_json *json)
+int ast_ari_validate_channel_destroyed(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field timestamp failed validation\n");
if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_cause = 1;
- prop_is_valid = ari_validate_int(
+ prop_is_valid = ast_ari_validate_int(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause failed validation\n");
if (strcmp("cause_txt", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_cause_txt = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field cause_txt failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDestroyed field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_destroyed_fn(void)
+ari_validator ast_ari_validate_channel_destroyed_fn(void)
{
- return ari_validate_channel_destroyed;
+ return ast_ari_validate_channel_destroyed;
}
-int ari_validate_channel_dialplan(struct ast_json *json)
+int ast_ari_validate_channel_dialplan(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field channel failed validation\n");
if (strcmp("dialplan_app", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_dialplan_app = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app failed validation\n");
if (strcmp("dialplan_app_data", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_dialplan_app_data = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDialplan field dialplan_app_data failed validation\n");
return res;
}
-ari_validator ari_validate_channel_dialplan_fn(void)
+ari_validator ast_ari_validate_channel_dialplan_fn(void)
{
- return ari_validate_channel_dialplan;
+ return ast_ari_validate_channel_dialplan;
}
-int ari_validate_channel_dtmf_received(struct ast_json *json)
+int ast_ari_validate_channel_dtmf_received(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field channel failed validation\n");
if (strcmp("digit", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_digit = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field digit failed validation\n");
if (strcmp("duration_ms", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_duration_ms = 1;
- prop_is_valid = ari_validate_int(
+ prop_is_valid = ast_ari_validate_int(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelDtmfReceived field duration_ms failed validation\n");
return res;
}
-ari_validator ari_validate_channel_dtmf_received_fn(void)
+ari_validator ast_ari_validate_channel_dtmf_received_fn(void)
{
- return ari_validate_channel_dtmf_received;
+ return ast_ari_validate_channel_dtmf_received;
}
-int ari_validate_channel_entered_bridge(struct ast_json *json)
+int ast_ari_validate_channel_entered_bridge(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field timestamp failed validation\n");
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field bridge failed validation\n");
} else
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelEnteredBridge field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_entered_bridge_fn(void)
+ari_validator ast_ari_validate_channel_entered_bridge_fn(void)
{
- return ari_validate_channel_entered_bridge;
+ return ast_ari_validate_channel_entered_bridge;
}
-int ari_validate_channel_hangup_request(struct ast_json *json)
+int ast_ari_validate_channel_hangup_request(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field timestamp failed validation\n");
} else
if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_int(
+ prop_is_valid = ast_ari_validate_int(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field cause failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field channel failed validation\n");
} else
if (strcmp("soft", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_boolean(
+ prop_is_valid = ast_ari_validate_boolean(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelHangupRequest field soft failed validation\n");
return res;
}
-ari_validator ari_validate_channel_hangup_request_fn(void)
+ari_validator ast_ari_validate_channel_hangup_request_fn(void)
{
- return ari_validate_channel_hangup_request;
+ return ast_ari_validate_channel_hangup_request;
}
-int ari_validate_channel_left_bridge(struct ast_json *json)
+int ast_ari_validate_channel_left_bridge(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge field timestamp failed validation\n");
if (strcmp("bridge", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_bridge = 1;
- prop_is_valid = ari_validate_bridge(
+ prop_is_valid = ast_ari_validate_bridge(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge field bridge failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelLeftBridge field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_left_bridge_fn(void)
+ari_validator ast_ari_validate_channel_left_bridge_fn(void)
{
- return ari_validate_channel_left_bridge;
+ return ast_ari_validate_channel_left_bridge;
}
-int ari_validate_channel_state_change(struct ast_json *json)
+int ast_ari_validate_channel_state_change(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelStateChange field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelStateChange field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelStateChange field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelStateChange field channel failed validation\n");
return res;
}
-ari_validator ari_validate_channel_state_change_fn(void)
+ari_validator ast_ari_validate_channel_state_change_fn(void)
{
- return ari_validate_channel_state_change;
+ return ast_ari_validate_channel_state_change;
}
-int ari_validate_channel_userevent(struct ast_json *json)
+int ast_ari_validate_channel_userevent(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelUserevent field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelUserevent field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelUserevent field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelUserevent field channel failed validation\n");
if (strcmp("eventname", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_eventname = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelUserevent field eventname failed validation\n");
return res;
}
-ari_validator ari_validate_channel_userevent_fn(void)
+ari_validator ast_ari_validate_channel_userevent_fn(void)
{
- return ari_validate_channel_userevent;
+ return ast_ari_validate_channel_userevent;
}
-int ari_validate_channel_varset(struct ast_json *json)
+int ast_ari_validate_channel_varset(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field timestamp failed validation\n");
} else
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field channel failed validation\n");
if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_value = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field value failed validation\n");
if (strcmp("variable", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_variable = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI ChannelVarset field variable failed validation\n");
return res;
}
-ari_validator ari_validate_channel_varset_fn(void)
+ari_validator ast_ari_validate_channel_varset_fn(void)
{
- return ari_validate_channel_varset;
+ return ast_ari_validate_channel_varset;
}
-int ari_validate_event(struct ast_json *json)
+int ast_ari_validate_event(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
/* Self type; fall through */
} else
if (strcmp("ApplicationReplaced", discriminator) == 0) {
- return ari_validate_application_replaced(json);
+ return ast_ari_validate_application_replaced(json);
} else
if (strcmp("BridgeCreated", discriminator) == 0) {
- return ari_validate_bridge_created(json);
+ return ast_ari_validate_bridge_created(json);
} else
if (strcmp("BridgeDestroyed", discriminator) == 0) {
- return ari_validate_bridge_destroyed(json);
+ return ast_ari_validate_bridge_destroyed(json);
} else
if (strcmp("BridgeMerged", discriminator) == 0) {
- return ari_validate_bridge_merged(json);
+ return ast_ari_validate_bridge_merged(json);
} else
if (strcmp("ChannelCallerId", discriminator) == 0) {
- return ari_validate_channel_caller_id(json);
+ return ast_ari_validate_channel_caller_id(json);
} else
if (strcmp("ChannelCreated", discriminator) == 0) {
- return ari_validate_channel_created(json);
+ return ast_ari_validate_channel_created(json);
} else
if (strcmp("ChannelDestroyed", discriminator) == 0) {
- return ari_validate_channel_destroyed(json);
+ return ast_ari_validate_channel_destroyed(json);
} else
if (strcmp("ChannelDialplan", discriminator) == 0) {
- return ari_validate_channel_dialplan(json);
+ return ast_ari_validate_channel_dialplan(json);
} else
if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
- return ari_validate_channel_dtmf_received(json);
+ return ast_ari_validate_channel_dtmf_received(json);
} else
if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
- return ari_validate_channel_entered_bridge(json);
+ return ast_ari_validate_channel_entered_bridge(json);
} else
if (strcmp("ChannelHangupRequest", discriminator) == 0) {
- return ari_validate_channel_hangup_request(json);
+ return ast_ari_validate_channel_hangup_request(json);
} else
if (strcmp("ChannelLeftBridge", discriminator) == 0) {
- return ari_validate_channel_left_bridge(json);
+ return ast_ari_validate_channel_left_bridge(json);
} else
if (strcmp("ChannelStateChange", discriminator) == 0) {
- return ari_validate_channel_state_change(json);
+ return ast_ari_validate_channel_state_change(json);
} else
if (strcmp("ChannelUserevent", discriminator) == 0) {
- return ari_validate_channel_userevent(json);
+ return ast_ari_validate_channel_userevent(json);
} else
if (strcmp("ChannelVarset", discriminator) == 0) {
- return ari_validate_channel_varset(json);
+ return ast_ari_validate_channel_varset(json);
} else
if (strcmp("PlaybackFinished", discriminator) == 0) {
- return ari_validate_playback_finished(json);
+ return ast_ari_validate_playback_finished(json);
} else
if (strcmp("PlaybackStarted", discriminator) == 0) {
- return ari_validate_playback_started(json);
+ return ast_ari_validate_playback_started(json);
} else
if (strcmp("StasisEnd", discriminator) == 0) {
- return ari_validate_stasis_end(json);
+ return ast_ari_validate_stasis_end(json);
} else
if (strcmp("StasisStart", discriminator) == 0) {
- return ari_validate_stasis_start(json);
+ return ast_ari_validate_stasis_start(json);
} else
{
ast_log(LOG_ERROR, "ARI Event has undocumented subtype %s\n",
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Event field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Event field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Event field timestamp failed validation\n");
return res;
}
-ari_validator ari_validate_event_fn(void)
+ari_validator ast_ari_validate_event_fn(void)
{
- return ari_validate_event;
+ return ast_ari_validate_event;
}
-int ari_validate_message(struct ast_json *json)
+int ast_ari_validate_message(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
/* Self type; fall through */
} else
if (strcmp("ApplicationReplaced", discriminator) == 0) {
- return ari_validate_application_replaced(json);
+ return ast_ari_validate_application_replaced(json);
} else
if (strcmp("BridgeCreated", discriminator) == 0) {
- return ari_validate_bridge_created(json);
+ return ast_ari_validate_bridge_created(json);
} else
if (strcmp("BridgeDestroyed", discriminator) == 0) {
- return ari_validate_bridge_destroyed(json);
+ return ast_ari_validate_bridge_destroyed(json);
} else
if (strcmp("BridgeMerged", discriminator) == 0) {
- return ari_validate_bridge_merged(json);
+ return ast_ari_validate_bridge_merged(json);
} else
if (strcmp("ChannelCallerId", discriminator) == 0) {
- return ari_validate_channel_caller_id(json);
+ return ast_ari_validate_channel_caller_id(json);
} else
if (strcmp("ChannelCreated", discriminator) == 0) {
- return ari_validate_channel_created(json);
+ return ast_ari_validate_channel_created(json);
} else
if (strcmp("ChannelDestroyed", discriminator) == 0) {
- return ari_validate_channel_destroyed(json);
+ return ast_ari_validate_channel_destroyed(json);
} else
if (strcmp("ChannelDialplan", discriminator) == 0) {
- return ari_validate_channel_dialplan(json);
+ return ast_ari_validate_channel_dialplan(json);
} else
if (strcmp("ChannelDtmfReceived", discriminator) == 0) {
- return ari_validate_channel_dtmf_received(json);
+ return ast_ari_validate_channel_dtmf_received(json);
} else
if (strcmp("ChannelEnteredBridge", discriminator) == 0) {
- return ari_validate_channel_entered_bridge(json);
+ return ast_ari_validate_channel_entered_bridge(json);
} else
if (strcmp("ChannelHangupRequest", discriminator) == 0) {
- return ari_validate_channel_hangup_request(json);
+ return ast_ari_validate_channel_hangup_request(json);
} else
if (strcmp("ChannelLeftBridge", discriminator) == 0) {
- return ari_validate_channel_left_bridge(json);
+ return ast_ari_validate_channel_left_bridge(json);
} else
if (strcmp("ChannelStateChange", discriminator) == 0) {
- return ari_validate_channel_state_change(json);
+ return ast_ari_validate_channel_state_change(json);
} else
if (strcmp("ChannelUserevent", discriminator) == 0) {
- return ari_validate_channel_userevent(json);
+ return ast_ari_validate_channel_userevent(json);
} else
if (strcmp("ChannelVarset", discriminator) == 0) {
- return ari_validate_channel_varset(json);
+ return ast_ari_validate_channel_varset(json);
} else
if (strcmp("Event", discriminator) == 0) {
- return ari_validate_event(json);
+ return ast_ari_validate_event(json);
} else
if (strcmp("MissingParams", discriminator) == 0) {
- return ari_validate_missing_params(json);
+ return ast_ari_validate_missing_params(json);
} else
if (strcmp("PlaybackFinished", discriminator) == 0) {
- return ari_validate_playback_finished(json);
+ return ast_ari_validate_playback_finished(json);
} else
if (strcmp("PlaybackStarted", discriminator) == 0) {
- return ari_validate_playback_started(json);
+ return ast_ari_validate_playback_started(json);
} else
if (strcmp("StasisEnd", discriminator) == 0) {
- return ari_validate_stasis_end(json);
+ return ast_ari_validate_stasis_end(json);
} else
if (strcmp("StasisStart", discriminator) == 0) {
- return ari_validate_stasis_start(json);
+ return ast_ari_validate_stasis_start(json);
} else
{
ast_log(LOG_ERROR, "ARI Message has undocumented subtype %s\n",
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI Message field type failed validation\n");
return res;
}
-ari_validator ari_validate_message_fn(void)
+ari_validator ast_ari_validate_message_fn(void)
{
- return ari_validate_message;
+ return ast_ari_validate_message;
}
-int ari_validate_missing_params(struct ast_json *json)
+int ast_ari_validate_missing_params(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI MissingParams field type failed validation\n");
if (strcmp("params", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_params = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_string);
+ ast_ari_validate_string);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI MissingParams field params failed validation\n");
res = 0;
return res;
}
-ari_validator ari_validate_missing_params_fn(void)
+ari_validator ast_ari_validate_missing_params_fn(void)
{
- return ari_validate_missing_params;
+ return ast_ari_validate_missing_params;
}
-int ari_validate_playback_finished(struct ast_json *json)
+int ast_ari_validate_playback_finished(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackFinished field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackFinished field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackFinished field timestamp failed validation\n");
if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_playback = 1;
- prop_is_valid = ari_validate_playback(
+ prop_is_valid = ast_ari_validate_playback(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackFinished field playback failed validation\n");
return res;
}
-ari_validator ari_validate_playback_finished_fn(void)
+ari_validator ast_ari_validate_playback_finished_fn(void)
{
- return ari_validate_playback_finished;
+ return ast_ari_validate_playback_finished;
}
-int ari_validate_playback_started(struct ast_json *json)
+int ast_ari_validate_playback_started(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackStarted field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackStarted field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackStarted field timestamp failed validation\n");
if (strcmp("playback", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_playback = 1;
- prop_is_valid = ari_validate_playback(
+ prop_is_valid = ast_ari_validate_playback(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI PlaybackStarted field playback failed validation\n");
return res;
}
-ari_validator ari_validate_playback_started_fn(void)
+ari_validator ast_ari_validate_playback_started_fn(void)
{
- return ari_validate_playback_started;
+ return ast_ari_validate_playback_started;
}
-int ari_validate_stasis_end(struct ast_json *json)
+int ast_ari_validate_stasis_end(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisEnd field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisEnd field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisEnd field timestamp failed validation\n");
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisEnd field channel failed validation\n");
return res;
}
-ari_validator ari_validate_stasis_end_fn(void)
+ari_validator ast_ari_validate_stasis_end_fn(void)
{
- return ari_validate_stasis_end;
+ return ast_ari_validate_stasis_end;
}
-int ari_validate_stasis_start(struct ast_json *json)
+int ast_ari_validate_stasis_start(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
if (strcmp("type", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_type = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisStart field type failed validation\n");
if (strcmp("application", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_application = 1;
- prop_is_valid = ari_validate_string(
+ prop_is_valid = ast_ari_validate_string(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisStart field application failed validation\n");
} else
if (strcmp("timestamp", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ari_validate_date(
+ prop_is_valid = ast_ari_validate_date(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisStart field timestamp failed validation\n");
if (strcmp("args", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_args = 1;
- prop_is_valid = ari_validate_list(
+ prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
- ari_validate_string);
+ ast_ari_validate_string);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisStart field args failed validation\n");
res = 0;
if (strcmp("channel", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
has_channel = 1;
- prop_is_valid = ari_validate_channel(
+ prop_is_valid = ast_ari_validate_channel(
ast_json_object_iter_value(iter));
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI StasisStart field channel failed validation\n");
return res;
}
-ari_validator ari_validate_stasis_start_fn(void)
+ari_validator ast_ari_validate_stasis_start_fn(void)
{
- return ari_validate_stasis_start;
+ return ast_ari_validate_stasis_start;
}
* \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
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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 *));
/*! @} */
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_asterisk_info(struct ast_json *json);
+int ast_ari_validate_asterisk_info(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_asterisk_info().
+ * \brief Function pointer to ast_ari_validate_asterisk_info().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_asterisk_info_fn(void);
+ari_validator ast_ari_validate_asterisk_info_fn(void);
/*!
* \brief Validator for Variable.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_variable(struct ast_json *json);
+int ast_ari_validate_variable(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_variable().
+ * \brief Function pointer to ast_ari_validate_variable().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_variable_fn(void);
+ari_validator ast_ari_validate_variable_fn(void);
/*!
* \brief Validator for Endpoint.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_endpoint(struct ast_json *json);
+int ast_ari_validate_endpoint(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_endpoint().
+ * \brief Function pointer to ast_ari_validate_endpoint().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_endpoint_fn(void);
+ari_validator ast_ari_validate_endpoint_fn(void);
/*!
* \brief Validator for CallerID.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_caller_id(struct ast_json *json);
+int ast_ari_validate_caller_id(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_caller_id().
+ * \brief Function pointer to ast_ari_validate_caller_id().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_caller_id_fn(void);
+ari_validator ast_ari_validate_caller_id_fn(void);
/*!
* \brief Validator for Channel.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel(struct ast_json *json);
+int ast_ari_validate_channel(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel().
+ * \brief Function pointer to ast_ari_validate_channel().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_fn(void);
+ari_validator ast_ari_validate_channel_fn(void);
/*!
* \brief Validator for Dialed.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_dialed(struct ast_json *json);
+int ast_ari_validate_dialed(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_dialed().
+ * \brief Function pointer to ast_ari_validate_dialed().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_dialed_fn(void);
+ari_validator ast_ari_validate_dialed_fn(void);
/*!
* \brief Validator for DialplanCEP.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_dialplan_cep(struct ast_json *json);
+int ast_ari_validate_dialplan_cep(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_dialplan_cep().
+ * \brief Function pointer to ast_ari_validate_dialplan_cep().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_dialplan_cep_fn(void);
+ari_validator ast_ari_validate_dialplan_cep_fn(void);
/*!
* \brief Validator for Bridge.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_bridge(struct ast_json *json);
+int ast_ari_validate_bridge(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_bridge().
+ * \brief Function pointer to ast_ari_validate_bridge().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_bridge_fn(void);
+ari_validator ast_ari_validate_bridge_fn(void);
/*!
* \brief Validator for LiveRecording.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_live_recording(struct ast_json *json);
+int ast_ari_validate_live_recording(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_live_recording().
+ * \brief Function pointer to ast_ari_validate_live_recording().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_live_recording_fn(void);
+ari_validator ast_ari_validate_live_recording_fn(void);
/*!
* \brief Validator for StoredRecording.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_stored_recording(struct ast_json *json);
+int ast_ari_validate_stored_recording(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_stored_recording().
+ * \brief Function pointer to ast_ari_validate_stored_recording().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_stored_recording_fn(void);
+ari_validator ast_ari_validate_stored_recording_fn(void);
/*!
* \brief Validator for FormatLangPair.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_format_lang_pair(struct ast_json *json);
+int ast_ari_validate_format_lang_pair(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_format_lang_pair().
+ * \brief Function pointer to ast_ari_validate_format_lang_pair().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_format_lang_pair_fn(void);
+ari_validator ast_ari_validate_format_lang_pair_fn(void);
/*!
* \brief Validator for Sound.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_sound(struct ast_json *json);
+int ast_ari_validate_sound(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_sound().
+ * \brief Function pointer to ast_ari_validate_sound().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_sound_fn(void);
+ari_validator ast_ari_validate_sound_fn(void);
/*!
* \brief Validator for Playback.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_playback(struct ast_json *json);
+int ast_ari_validate_playback(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_playback().
+ * \brief Function pointer to ast_ari_validate_playback().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_playback_fn(void);
+ari_validator ast_ari_validate_playback_fn(void);
/*!
* \brief Validator for ApplicationReplaced.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_application_replaced(struct ast_json *json);
+int ast_ari_validate_application_replaced(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_application_replaced().
+ * \brief Function pointer to ast_ari_validate_application_replaced().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_application_replaced_fn(void);
+ari_validator ast_ari_validate_application_replaced_fn(void);
/*!
* \brief Validator for BridgeCreated.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_bridge_created(struct ast_json *json);
+int ast_ari_validate_bridge_created(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_bridge_created().
+ * \brief Function pointer to ast_ari_validate_bridge_created().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_bridge_created_fn(void);
+ari_validator ast_ari_validate_bridge_created_fn(void);
/*!
* \brief Validator for BridgeDestroyed.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_bridge_destroyed(struct ast_json *json);
+int ast_ari_validate_bridge_destroyed(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_bridge_destroyed().
+ * \brief Function pointer to ast_ari_validate_bridge_destroyed().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_bridge_destroyed_fn(void);
+ari_validator ast_ari_validate_bridge_destroyed_fn(void);
/*!
* \brief Validator for BridgeMerged.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_bridge_merged(struct ast_json *json);
+int ast_ari_validate_bridge_merged(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_bridge_merged().
+ * \brief Function pointer to ast_ari_validate_bridge_merged().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_bridge_merged_fn(void);
+ari_validator ast_ari_validate_bridge_merged_fn(void);
/*!
* \brief Validator for ChannelCallerId.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_caller_id(struct ast_json *json);
+int ast_ari_validate_channel_caller_id(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_caller_id().
+ * \brief Function pointer to ast_ari_validate_channel_caller_id().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_caller_id_fn(void);
+ari_validator ast_ari_validate_channel_caller_id_fn(void);
/*!
* \brief Validator for ChannelCreated.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_created(struct ast_json *json);
+int ast_ari_validate_channel_created(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_created().
+ * \brief Function pointer to ast_ari_validate_channel_created().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_created_fn(void);
+ari_validator ast_ari_validate_channel_created_fn(void);
/*!
* \brief Validator for ChannelDestroyed.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_destroyed(struct ast_json *json);
+int ast_ari_validate_channel_destroyed(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_destroyed().
+ * \brief Function pointer to ast_ari_validate_channel_destroyed().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_destroyed_fn(void);
+ari_validator ast_ari_validate_channel_destroyed_fn(void);
/*!
* \brief Validator for ChannelDialplan.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_dialplan(struct ast_json *json);
+int ast_ari_validate_channel_dialplan(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_dialplan().
+ * \brief Function pointer to ast_ari_validate_channel_dialplan().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_dialplan_fn(void);
+ari_validator ast_ari_validate_channel_dialplan_fn(void);
/*!
* \brief Validator for ChannelDtmfReceived.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_dtmf_received(struct ast_json *json);
+int ast_ari_validate_channel_dtmf_received(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_dtmf_received().
+ * \brief Function pointer to ast_ari_validate_channel_dtmf_received().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_dtmf_received_fn(void);
+ari_validator ast_ari_validate_channel_dtmf_received_fn(void);
/*!
* \brief Validator for ChannelEnteredBridge.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_entered_bridge(struct ast_json *json);
+int ast_ari_validate_channel_entered_bridge(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_entered_bridge().
+ * \brief Function pointer to ast_ari_validate_channel_entered_bridge().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_entered_bridge_fn(void);
+ari_validator ast_ari_validate_channel_entered_bridge_fn(void);
/*!
* \brief Validator for ChannelHangupRequest.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_hangup_request(struct ast_json *json);
+int ast_ari_validate_channel_hangup_request(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_hangup_request().
+ * \brief Function pointer to ast_ari_validate_channel_hangup_request().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_hangup_request_fn(void);
+ari_validator ast_ari_validate_channel_hangup_request_fn(void);
/*!
* \brief Validator for ChannelLeftBridge.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_left_bridge(struct ast_json *json);
+int ast_ari_validate_channel_left_bridge(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_left_bridge().
+ * \brief Function pointer to ast_ari_validate_channel_left_bridge().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_left_bridge_fn(void);
+ari_validator ast_ari_validate_channel_left_bridge_fn(void);
/*!
* \brief Validator for ChannelStateChange.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_state_change(struct ast_json *json);
+int ast_ari_validate_channel_state_change(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_state_change().
+ * \brief Function pointer to ast_ari_validate_channel_state_change().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_state_change_fn(void);
+ari_validator ast_ari_validate_channel_state_change_fn(void);
/*!
* \brief Validator for ChannelUserevent.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_userevent(struct ast_json *json);
+int ast_ari_validate_channel_userevent(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_userevent().
+ * \brief Function pointer to ast_ari_validate_channel_userevent().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_userevent_fn(void);
+ari_validator ast_ari_validate_channel_userevent_fn(void);
/*!
* \brief Validator for ChannelVarset.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_channel_varset(struct ast_json *json);
+int ast_ari_validate_channel_varset(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_channel_varset().
+ * \brief Function pointer to ast_ari_validate_channel_varset().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_channel_varset_fn(void);
+ari_validator ast_ari_validate_channel_varset_fn(void);
/*!
* \brief Validator for Event.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_event(struct ast_json *json);
+int ast_ari_validate_event(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_event().
+ * \brief Function pointer to ast_ari_validate_event().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_event_fn(void);
+ari_validator ast_ari_validate_event_fn(void);
/*!
* \brief Validator for Message.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_message(struct ast_json *json);
+int ast_ari_validate_message(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_message().
+ * \brief Function pointer to ast_ari_validate_message().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_message_fn(void);
+ari_validator ast_ari_validate_message_fn(void);
/*!
* \brief Validator for MissingParams.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_missing_params(struct ast_json *json);
+int ast_ari_validate_missing_params(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_missing_params().
+ * \brief Function pointer to ast_ari_validate_missing_params().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_missing_params_fn(void);
+ari_validator ast_ari_validate_missing_params_fn(void);
/*!
* \brief Validator for PlaybackFinished.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_playback_finished(struct ast_json *json);
+int ast_ari_validate_playback_finished(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_playback_finished().
+ * \brief Function pointer to ast_ari_validate_playback_finished().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_playback_finished_fn(void);
+ari_validator ast_ari_validate_playback_finished_fn(void);
/*!
* \brief Validator for PlaybackStarted.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_playback_started(struct ast_json *json);
+int ast_ari_validate_playback_started(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_playback_started().
+ * \brief Function pointer to ast_ari_validate_playback_started().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_playback_started_fn(void);
+ari_validator ast_ari_validate_playback_started_fn(void);
/*!
* \brief Validator for StasisEnd.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_stasis_end(struct ast_json *json);
+int ast_ari_validate_stasis_end(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_stasis_end().
+ * \brief Function pointer to ast_ari_validate_stasis_end().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_stasis_end_fn(void);
+ari_validator ast_ari_validate_stasis_end_fn(void);
/*!
* \brief Validator for StasisStart.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
-int ari_validate_stasis_start(struct ast_json *json);
+int ast_ari_validate_stasis_start(struct ast_json *json);
/*!
- * \brief Function pointer to ari_validate_stasis_start().
+ * \brief Function pointer to ast_ari_validate_stasis_start().
*
- * See \ref ari_model_validators.h for more details.
+ * See \ref ast_ari_model_validators.h for more details.
*/
-ari_validator ari_validate_stasis_start_fn(void);
+ari_validator ast_ari_validate_stasis_start_fn(void);
/*
* JSON models
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/astobj2.h"
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
/*! \file
*
* \author David M. Lee, II <dlee@digium.com>
*/
-struct ari_websocket_session {
+struct ast_ari_websocket_session {
struct ast_websocket *ws_session;
int (*validator)(struct ast_json *);
};
static void websocket_session_dtor(void *obj)
{
- struct ari_websocket_session *session = obj;
+ struct ast_ari_websocket_session *session = obj;
ast_websocket_unref(session->ws_session);
session->ws_session = NULL;
return 1;
}
-struct ari_websocket_session *ari_websocket_session_create(
+struct ast_ari_websocket_session *ast_ari_websocket_session_create(
struct ast_websocket *ws_session, int (*validator)(struct ast_json *))
{
- RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_websocket_session *, session, NULL, ao2_cleanup);
if (ws_session == NULL) {
return NULL;
return session;
}
-struct ast_json *ari_websocket_session_read(
- struct ari_websocket_session *session)
+struct ast_json *ast_ari_websocket_session_read(
+ struct ast_ari_websocket_session *session)
{
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
" \"message\": \"Message validation failed\"" \
"}"
-int ari_websocket_session_write(struct ari_websocket_session *session,
+int ast_ari_websocket_session_write(struct ast_ari_websocket_session *session,
struct ast_json *message)
{
RAII_VAR(char *, str, NULL, ast_free);
}
#endif
- str = ast_json_dump_string_format(message, stasis_http_json_format());
+ str = ast_json_dump_string_format(message, ast_ari_json_format());
if (str == NULL) {
ast_log(LOG_ERROR, "Failed to encode JSON object\n");
static char *ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
switch (cmd) {
case CLI_INIT:
return CLI_SHOWUSAGE;
}
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
ast_cli(a->fd, "Error getting ARI configuration\n");
static int show_users_cb(void *obj, void *arg, int flags)
{
- struct ari_conf_user *user = obj;
+ struct ast_ari_conf_user *user = obj;
struct ast_cli_args *a = arg;
ast_cli(a->fd, "%-4s %s\n",
static char *ari_show_users(struct ast_cli_entry *e, int cmd,
struct ast_cli_args *a)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
switch (cmd) {
case CLI_INIT:
return CLI_SHOWUSAGE;
}
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
ast_cli(a->fd, "Error getting ARI configuration\n");
return CLI_FAILURE;
static char *complete_ari_user(struct ast_cli_args *a)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
- RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
struct user_complete search = {
.state = a->n,
};
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
ast_cli(a->fd, "Error getting ARI configuration\n");
return CLI_FAILURE;
static char *ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
- RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
switch (cmd) {
case CLI_INIT:
return CLI_SHOWUSAGE;
}
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
ast_cli(a->fd, "Error getting ARI configuration\n");
AST_CLI_DEFINE(ari_mkpasswd, "Encrypts a password"),
};
-int ari_cli_register(void) {
+int ast_ari_cli_register(void) {
return ast_cli_register_multiple(cli_ari, ARRAY_LEN(cli_ari));
}
-void ari_cli_unregister(void) {
+void ast_ari_cli_unregister(void) {
ast_cli_unregister_multiple(cli_ari, ARRAY_LEN(cli_ari));
}
/*! \brief Locking container for safe configuration access. */
static AO2_GLOBAL_OBJ_STATIC(confs);
-/*! \brief Mapping of the stasis http conf struct's globals to the
+/*! \brief Mapping of the ARI conf struct's globals to the
* general context in the config file. */
static struct aco_type general_option = {
.type = ACO_GLOBAL,
.name = "general",
- .item_offset = offsetof(struct ari_conf, general),
+ .item_offset = offsetof(struct ast_ari_conf, general),
.category = "^general$",
.category_match = ACO_WHITELIST,
};
static int encoding_format_handler(const struct aco_option *opt,
struct ast_variable *var, void *obj)
{
- struct ari_conf_general *general = obj;
+ struct ast_ari_conf_general *general = obj;
if (!strcasecmp(var->name, "pretty")) {
general->format = ast_true(var->value) ?
return 0;
}
-/*! \brief Parses the ari_password_format enum from a config file */
+/*! \brief Parses the ast_ari_password_format enum from a config file */
static int password_format_handler(const struct aco_option *opt,
struct ast_variable *var, void *obj)
{
- struct ari_conf_user *user = obj;
+ struct ast_ari_conf_user *user = obj;
if (strcasecmp(var->value, "plain") == 0) {
user->password_format = ARI_PASSWORD_FORMAT_PLAIN;
return 0;
}
-/*! \brief Destructor for \ref ari_conf_user */
+/*! \brief Destructor for \ref ast_ari_conf_user */
static void user_dtor(void *obj)
{
- struct ari_conf_user *user = obj;
+ struct ast_ari_conf_user *user = obj;
ast_debug(3, "Disposing of user %s\n", user->username);
ast_free(user->username);
}
-/*! \brief Allocate an \ref ari_conf_user for config parsing */
+/*! \brief Allocate an \ref ast_ari_conf_user for config parsing */
static void *user_alloc(const char *cat)
{
- RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
if (!cat) {
return NULL;
/*! \brief Sorting function for use with red/black tree */
static int user_sort_cmp(const void *obj_left, const void *obj_right, int flags)
{
- const struct ari_conf_user *user_left = obj_left;
+ const struct ast_ari_conf_user *user_left = obj_left;
if (flags & OBJ_PARTIAL_KEY) {
const char *key_right = obj_right;
const char *key_right = obj_right;
return strcasecmp(user_left->username, key_right);
} else {
- const struct ari_conf_user *user_right = obj_right;
+ const struct ast_ari_conf_user *user_right = obj_right;
const char *key_right = user_right->username;
return strcasecmp(user_left->username, key_right);
}
.matchvalue = "user",
.item_alloc = user_alloc,
.item_find = user_find,
- .item_offset = offsetof(struct ari_conf, users),
+ .item_offset = offsetof(struct ast_ari_conf, users),
};
static struct aco_type *user[] = ACO_TYPES(&user_option);
-/*! \brief \ref ari_conf destructor. */
+/*! \brief \ref ast_ari_conf destructor. */
static void conf_destructor(void *obj)
{
- struct ari_conf *cfg = obj;
+ struct ast_ari_conf *cfg = obj;
ast_string_field_free_memory(cfg->general);
ao2_cleanup(cfg->users);
}
-/*! \brief Allocate an \ref ari_conf for config parsing */
+/*! \brief Allocate an \ref ast_ari_conf for config parsing */
static void *conf_alloc(void)
{
- RAII_VAR(struct ari_conf *, cfg, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, cfg, NULL, ao2_cleanup);
cfg = ao2_alloc_options(sizeof(*cfg), conf_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
CONFIG_INFO_STANDARD(cfg_info, confs, conf_alloc,
.files = ACO_FILES(&conf_file));
-struct ari_conf *ari_config_get(void)
+struct ast_ari_conf *ast_ari_config_get(void)
{
- struct ari_conf *res = ao2_global_obj_ref(confs);
+ struct ast_ari_conf *res = ao2_global_obj_ref(confs);
if (!res) {
ast_log(LOG_ERROR,
"Error obtaining config from " CONF_FILENAME "\n");
return res;
}
-struct ari_conf_user *ari_config_validate_user(const char *username,
+struct ast_ari_conf_user *ast_ari_config_validate_user(const char *username,
const char *password)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
- RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
int is_valid = 0;
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
return NULL;
}
/*! \brief Callback to validate a user object */
static int validate_user_cb(void *obj, void *arg, int flags)
{
- struct ari_conf_user *user = obj;
+ struct ast_ari_conf_user *user = obj;
if (ast_strlen_zero(user->password)) {
ast_log(LOG_WARNING, "User '%s' missing password\n",
/*! \brief Load (or reload) configuration. */
static int process_config(int reload)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
switch (aco_process_config(&cfg_info, reload)) {
case ACO_PROCESS_ERROR:
break;
}
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf) {
ast_assert(0); /* We just configured; it should be there */
return -1;
return 0;
}
-int ari_config_init(void)
+int ast_ari_config_init(void)
{
if (aco_info_init(&cfg_info)) {
aco_info_destroy(&cfg_info);
aco_option_register(&cfg_info, "enabled", ACO_EXACT, general_options,
"yes", OPT_BOOL_T, 1,
- FLDSET(struct ari_conf_general, enabled));
+ FLDSET(struct ast_ari_conf_general, enabled));
aco_option_register_custom(&cfg_info, "pretty", ACO_EXACT,
general_options, "no", encoding_format_handler, 0);
aco_option_register(&cfg_info, "auth_realm", ACO_EXACT, general_options,
"Asterisk REST Interface", OPT_CHAR_ARRAY_T, 0,
- FLDSET(struct ari_conf_general, auth_realm),
+ FLDSET(struct ast_ari_conf_general, auth_realm),
ARI_AUTH_REALM_LEN);
aco_option_register(&cfg_info, "allowed_origins", ACO_EXACT, general_options,
"", OPT_STRINGFIELD_T, 0,
- STRFLDSET(struct ari_conf_general, allowed_origins));
+ STRFLDSET(struct ast_ari_conf_general, allowed_origins));
aco_option_register(&cfg_info, "type", ACO_EXACT, user, NULL,
OPT_NOOP_T, 0, 0);
aco_option_register(&cfg_info, "read_only", ACO_EXACT, user,
"no", OPT_BOOL_T, 1,
- FLDSET(struct ari_conf_user, read_only));
+ FLDSET(struct ast_ari_conf_user, read_only));
aco_option_register(&cfg_info, "password", ACO_EXACT, user,
"", OPT_CHAR_ARRAY_T, 0,
- FLDSET(struct ari_conf_user, password), ARI_PASSWORD_LEN);
+ FLDSET(struct ast_ari_conf_user, password), ARI_PASSWORD_LEN);
aco_option_register_custom(&cfg_info, "password_format", ACO_EXACT,
user, "plain", password_format_handler, 0);
return process_config(0);
}
-int ari_config_reload(void)
+int ast_ari_config_reload(void)
{
return process_config(1);
}
-void ari_config_destroy(void)
+void ast_ari_config_destroy(void)
{
aco_info_destroy(&cfg_info);
ao2_global_obj_release(confs);
* at the top of the source tree.
*/
-#ifndef STASIS_HTTP_INTERNAL_H_
-#define STASIS_HTTP_INTERNAL_H_
+#ifndef ARI_INTERNAL_H_
+#define ARI_INTERNAL_H_
/*! \file
*
- * \brief Internal API's for res_stasis_http.
+ * \brief Internal API's for res_ari.
* \author David M. Lee, II <dlee@digium.com>
*/
* \return 0 on success.
* \return Non-zero on error.
*/
-int ari_cli_register(void);
+int ast_ari_cli_register(void);
/*!
* \brief Unregister CLI commands for ARI.
*/
-void ari_cli_unregister(void);
+void ast_ari_cli_unregister(void);
/*! @} */
/*! @{ */
-struct ari_conf_general;
+struct ast_ari_conf_general;
-/*! \brief All configuration options for stasis http. */
-struct ari_conf {
+/*! \brief All configuration options for ARI. */
+struct ast_ari_conf {
/*! The general section configuration options. */
- struct ari_conf_general *general;
+ struct ast_ari_conf_general *general;
/*! Configured users */
struct ao2_container *users;
};
/*! Max length for auth_realm field */
#define ARI_AUTH_REALM_LEN 80
-/*! \brief Global configuration options for stasis http. */
-struct ari_conf_general {
+/*! \brief Global configuration options for ARI. */
+struct ast_ari_conf_general {
/*! Enabled by default, disabled if false. */
int enabled;
/*! Encoding format used during output (default compact). */
};
/*! \brief Password format */
-enum ari_password_format {
+enum ast_ari_password_format {
/*! \brief Plaintext password */
ARI_PASSWORD_FORMAT_PLAIN,
/*! crypt(3) password */
#define ARI_PASSWORD_LEN 256
/*! \brief Per-user configuration options */
-struct ari_conf_user {
+struct ast_ari_conf_user {
/*! Username for authentication */
char *username;
/*! User's password. */
char password[ARI_PASSWORD_LEN];
/*! Format for the password field */
- enum ari_password_format password_format;
+ enum ast_ari_password_format password_format;
/*! If true, user cannot execute change operations */
int read_only;
};
/*!
* \brief Initialize the ARI configuration
*/
-int ari_config_init(void);
+int ast_ari_config_init(void);
/*!
* \brief Reload the ARI configuration
*/
-int ari_config_reload(void);
+int ast_ari_config_reload(void);
/*!
* \brief Destroy the ARI configuration
*/
-void ari_config_destroy(void);
+void ast_ari_config_destroy(void);
/*!
* \brief Get the current ARI configuration.
* \return ARI configuration object.
* \return \c NULL on error.
*/
-struct ari_conf *ari_config_get(void);
+struct ast_ari_conf *ast_ari_config_get(void);
/*!
* \brief Validated a user's credentials.
* \return User object.
* \return \c NULL if username or password is invalid.
*/
-struct ari_conf_user *ari_config_validate_user(const char *username,
+struct ast_ari_conf_user *ast_ari_config_validate_user(const char *username,
const char *password);
/*! @} */
-#endif /* STASIS_HTTP_INTERNAL_H_ */
+#endif /* ARI_INTERNAL_H_ */
/*! \file
*
- * \brief Implementation for stasis-http stubs.
+ * \brief Implementation for ARI stubs.
*
* \author David M. Lee, II <dlee@digium.com>
*/
#include "resource_asterisk.h"
#include "asterisk/pbx.h"
-void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response)
+void 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: stasis_http_get_asterisk_info\n");
+ ast_log(LOG_ERROR, "TODO: ari_get_asterisk_info\n");
}
-void stasis_http_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct stasis_http_response *response)
+void ast_ari_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
RAII_VAR(struct ast_str *, tmp, ast_str_create(32), ast_free);
ast_assert(response != NULL);
if (!tmp) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
value = ast_str_retrieve_variable(&tmp, 0, NULL, NULL, args->variable);
if (!(json = ast_json_pack("{s: s}", "value", S_OR(value, "")))) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_set_global_var(struct ast_variable *headers, struct ast_set_global_var_args *args, struct stasis_http_response *response)
+void ast_ari_set_global_var(struct ast_variable *headers, struct ast_set_global_var_args *args, struct ast_ari_response *response)
{
ast_assert(response != NULL);
if (ast_strlen_zero(args->variable)) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Variable name is required");
return;
pbx_builtin_setvar_helper(NULL, args->variable, args->value);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_asterisk.c
+ * res/ari/resource_asterisk.c
*
* Asterisk resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_ASTERISK_H
#define _ASTERISK_RESOURCE_ASTERISK_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_asterisk_info() */
+/*! \brief Argument struct for ast_ari_get_asterisk_info() */
struct ast_get_asterisk_info_args {
/*! \brief Filter information returned */
const char *only;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_global_var() */
+void ast_ari_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_global_var() */
struct ast_get_global_var_args {
/*! \brief The variable to get */
const char *variable;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_set_global_var() */
+void ast_ari_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_set_global_var() */
struct ast_set_global_var_args {
/*! \brief The variable to set */
const char *variable;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_set_global_var(struct ast_variable *headers, struct ast_set_global_var_args *args, struct stasis_http_response *response);
+void ast_ari_set_global_var(struct ast_variable *headers, struct ast_set_global_var_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_ASTERISK_H */
/*! \file
*
- * \brief Implementation for stasis-http stubs.
+ * \brief Implementation for ARI stubs.
*
* \author David M. Lee, II <dlee@digium.com>
*/
* \return \c NULL if bridge does not exist.
*/
static struct ast_bridge *find_bridge(
- struct stasis_http_response *response,
+ struct ast_ari_response *response,
const char *bridge_id)
{
RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
RAII_VAR(struct ast_bridge_snapshot *, snapshot,
ast_bridge_snapshot_get_latest(bridge_id), ao2_cleanup);
if (!snapshot) {
- stasis_http_response_error(response, 404, "Not found",
+ ast_ari_response_error(response, 404, "Not found",
"Bridge not found");
return NULL;
}
- stasis_http_response_error(response, 409, "Conflict",
+ ast_ari_response_error(response, 409, "Conflict",
"Bridge not in Stasis application");
return NULL;
}
* \return \c NULL if control object does not exist.
*/
static struct stasis_app_control *find_channel_control(
- struct stasis_http_response *response,
+ struct ast_ari_response *response,
const char *channel_id)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
control = stasis_app_control_find_by_channel_id(channel_id);
if (control == NULL) {
- stasis_http_response_error(response, 422, "Unprocessable Entity",
+ ast_ari_response_error(response, 422, "Unprocessable Entity",
"Channel not in Stasis application");
return NULL;
}
return control;
}
-void stasis_http_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_channel_to_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_channel_to_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, find_bridge(response, args->bridge_id), ao2_cleanup);
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
stasis_app_control_add_channel_to_bridge(control, bridge);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, find_bridge(response, args->bridge_id), ao2_cleanup);
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
* is added to the channel snapshot. A 409 response should be issued if the bridge
* uniqueids don't match */
if (stasis_app_control_remove_channel_from_bridge(control, bridge)) {
- stasis_http_response_error(response, 500, "Internal Error",
+ ast_ari_response_error(response, 500, "Internal Error",
"Could not remove channel from bridge");
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
struct bridge_channel_control_thread_data {
return ast_request(type, cap, NULL, "ARI", NULL);
}
-void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_play_on_bridge(struct ast_variable *headers, struct ast_play_on_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, find_bridge(response, args->bridge_id), ao2_cleanup);
RAII_VAR(struct ast_channel *, play_channel, NULL, ast_hangup);
}
if (!(play_channel = prepare_bridge_media_channel("Announcer"))) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error", "Could not create playback channel");
return;
}
ast_debug(1, "Created announcer channel '%s'\n", ast_channel_name(play_channel));
if (ast_unreal_channel_push_to_bridge(play_channel, bridge)) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error", "Failed to put playback channel into the bridge");
return;
}
control = stasis_app_control_create(play_channel);
if (control == NULL) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
snapshot = stasis_app_control_get_snapshot(control);
if (!snapshot) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error", "Failed to get control snapshot");
return;
}
args->offsetms);
if (!playback) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
stasis_app_playback_get_id(playback));
if (!playback_url) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = stasis_app_playback_to_json(playback);
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
/* Give play_channel and control reference to the thread data */
thread_data = ast_calloc(1, sizeof(*thread_data));
if (!thread_data) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
thread_data->control = control;
if (ast_pthread_create_detached(&threadid, NULL, bridge_channel_control_thread, thread_data)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
ast_free(thread_data);
return;
}
play_channel = NULL;
control = NULL;
- stasis_http_response_created(response, playback_url, json);
+ ast_ari_response_created(response, playback_url, json);
}
-void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, find_bridge(response, args->bridge_id), ao2_cleanup);
RAII_VAR(struct ast_channel *, record_channel, NULL, ast_hangup);
}
if (!(record_channel = prepare_bridge_media_channel("Recorder"))) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error", "Failed to create recording channel");
return;
}
if (ast_unreal_channel_push_to_bridge(record_channel, bridge)) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error", "Failed to put recording channel into the bridge");
return;
}
control = stasis_app_control_create(record_channel);
if (control == NULL) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
options = stasis_app_recording_options_create(args->name, args->format);
if (options == NULL) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
/* While the arguments are invalid, we should have
* caught them prior to calling record.
*/
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Error parsing request");
break;
case EEXIST:
- stasis_http_response_error(response, 409, "Conflict",
+ ast_ari_response_error(response, 409, "Conflict",
"Recording '%s' already in progress",
args->name);
break;
case ENOMEM:
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
break;
case EPERM:
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Recording name invalid");
break;
ast_log(LOG_WARNING,
"Unrecognized recording error: %s\n",
strerror(errno));
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Internal Server Error");
break;
uri_name_maxlen = strlen(args->name) * 3;
uri_encoded_name = ast_malloc(uri_name_maxlen);
if (!uri_encoded_name) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
ast_uri_encode(args->name, uri_encoded_name, uri_name_maxlen, ast_uri_http);
ast_asprintf(&recording_url, "/recordings/live/%s", uri_encoded_name);
if (!recording_url) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = stasis_app_recording_to_json(recording);
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
thread_data = ast_calloc(1, sizeof(*thread_data));
if (!thread_data) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
thread_data->control = control;
if (ast_pthread_create_detached(&threadid, NULL, bridge_channel_control_thread, thread_data)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
ast_free(thread_data);
return;
}
record_channel = NULL;
control = NULL;
- stasis_http_response_created(response, recording_url, json);
+ ast_ari_response_created(response, recording_url, json);
}
-void stasis_http_get_bridge(struct ast_variable *headers, struct ast_get_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_get_bridge(struct ast_variable *headers, struct ast_get_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge_snapshot *, snapshot, ast_bridge_snapshot_get_latest(args->bridge_id), ao2_cleanup);
if (!snapshot) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Bridge not found");
return;
}
- stasis_http_response_ok(response,
+ ast_ari_response_ok(response,
ast_bridge_snapshot_to_json(snapshot));
}
-void stasis_http_delete_bridge(struct ast_variable *headers, struct ast_delete_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_delete_bridge(struct ast_variable *headers, struct ast_delete_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, find_bridge(response, args->bridge_id), ao2_cleanup);
if (!bridge) {
}
stasis_app_bridge_destroy(args->bridge_id);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct stasis_http_response *response)
+void ast_ari_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
caching_topic = ast_bridge_topic_all_cached();
if (!caching_topic) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
snapshots = stasis_cache_dump(caching_topic, ast_bridge_snapshot_type());
if (!snapshots) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = ast_json_array_create();
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
RAII_VAR(struct stasis_message *, msg, obj, ao2_cleanup);
struct ast_bridge_snapshot *snapshot = stasis_message_data(msg);
if (ast_json_array_append(json, ast_bridge_snapshot_to_json(snapshot))) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
}
ao2_iterator_destroy(&i);
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct stasis_http_response *response)
+void ast_ari_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_bridge *, bridge, stasis_app_bridge_create(args->type), ao2_cleanup);
RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
if (!bridge) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error",
"Unable to create bridge");
return;
snapshot = ast_bridge_snapshot_create(bridge);
if (!snapshot) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Error",
"Unable to create snapshot for new bridge");
return;
}
- stasis_http_response_ok(response,
+ ast_ari_response_ok(response,
ast_bridge_snapshot_to_json(snapshot));
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_bridges.c
+ * res/ari/resource_bridges.c
*
* Bridge resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_BRIDGES_H
#define _ASTERISK_RESOURCE_BRIDGES_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_bridges() */
+/*! \brief Argument struct for ast_ari_get_bridges() */
struct ast_get_bridges_args {
};
/*!
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_new_bridge() */
+void ast_ari_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_new_bridge() */
struct ast_new_bridge_args {
/*! \brief Type of bridge to create. */
const char *type;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_bridge() */
+void ast_ari_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_bridge() */
struct ast_get_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_bridge(struct ast_variable *headers, struct ast_get_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_delete_bridge() */
+void ast_ari_get_bridge(struct ast_variable *headers, struct ast_get_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_delete_bridge() */
struct ast_delete_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_delete_bridge(struct ast_variable *headers, struct ast_delete_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_add_channel_to_bridge() */
+void ast_ari_delete_bridge(struct ast_variable *headers, struct ast_delete_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_add_channel_to_bridge() */
struct ast_add_channel_to_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_channel_to_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_remove_channel_from_bridge() */
+void ast_ari_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_channel_to_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_remove_channel_from_bridge() */
struct ast_remove_channel_from_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_play_on_bridge() */
+void ast_ari_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_play_on_bridge() */
struct ast_play_on_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on_bridge_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_record_bridge() */
+void ast_ari_play_on_bridge(struct ast_variable *headers, struct ast_play_on_bridge_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_record_bridge() */
struct ast_record_bridge_args {
/*! \brief Bridge's id */
const char *bridge_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct stasis_http_response *response);
+void ast_ari_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_BRIDGES_H */
/*! \file
*
- * \brief Implementation for stasis-http stubs.
+ * \brief Implementation for ARI stubs.
*
* \author David M. Lee, II <dlee@digium.com>
*/
* \return \c NULL if control object does not exist.
*/
static struct stasis_app_control *find_control(
- struct stasis_http_response *response,
+ struct ast_ari_response *response,
const char *channel_id)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel *, chan, NULL, ao2_cleanup);
chan = ast_channel_get_by_name(channel_id);
if (chan == NULL) {
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"Channel not found");
return NULL;
}
- stasis_http_response_error(response, 409, "Conflict",
+ ast_ari_response_error(response, 409, "Conflict",
"Channel not in Stasis application");
return NULL;
}
return control;
}
-void stasis_http_dial(struct ast_variable *headers, struct ast_dial_args *args, struct stasis_http_response *response)
+void ast_ari_dial(struct ast_variable *headers, struct ast_dial_args *args, struct ast_ari_response *response)
{
struct stasis_app_control *control;
}
if (stasis_app_control_dial(control, args->endpoint, args->timeout)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_continue_in_dialplan(
+void ast_ari_continue_in_dialplan(
struct ast_variable *headers,
struct ast_continue_in_dialplan_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
if (stasis_app_control_continue(control, args->context, args->extension, args->priority)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_answer_channel(struct ast_variable *headers,
+void ast_ari_answer_channel(struct ast_variable *headers,
struct ast_answer_channel_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
if (stasis_app_control_answer(control) != 0) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Failed to answer channel");
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_mute_channel(struct ast_variable *headers, struct ast_mute_channel_args *args, struct stasis_http_response *response)
+void ast_ari_mute_channel(struct ast_variable *headers, struct ast_mute_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
unsigned int direction = 0;
} else if (!strcmp(args->direction, "both")) {
direction = AST_MUTE_DIRECTION_READ | AST_MUTE_DIRECTION_WRITE;
} else {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Invalid direction specified");
return;
stasis_app_control_mute(control, direction, frametype);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct stasis_http_response *response)
+void ast_ari_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
unsigned int direction = 0;
} else if (!strcmp(args->direction, "both")) {
direction = AST_MUTE_DIRECTION_READ | AST_MUTE_DIRECTION_WRITE;
} else {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Invalid direction specified");
return;
stasis_app_control_unmute(control, direction, frametype);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response)
+void ast_ari_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
stasis_app_control_hold(control);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response)
+void ast_ari_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
stasis_app_control_unhold(control);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct stasis_http_response *response)
+void ast_ari_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
stasis_app_control_moh_start(control, args->moh_class);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct stasis_http_response *response)
+void ast_ari_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
stasis_app_control_moh_stop(control);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_play_on_channel(struct ast_variable *headers,
+void ast_ari_play_on_channel(struct ast_variable *headers,
struct ast_play_on_channel_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
snapshot = stasis_app_control_get_snapshot(control);
if (!snapshot) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Channel not found");
return;
}
if (args->skipms < 0) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"skipms cannot be negative");
return;
}
if (args->offsetms < 0) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"offsetms cannot be negative");
return;
playback = stasis_app_control_play_uri(control, args->media, language,
args->channel_id, STASIS_PLAYBACK_TARGET_CHANNEL, args->skipms, args->offsetms);
if (!playback) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Failed to queue media for playback");
return;
ast_asprintf(&playback_url, "/playback/%s",
stasis_app_playback_get_id(playback));
if (!playback_url) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
return;
json = stasis_app_playback_to_json(playback);
if (!json) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
return;
}
- stasis_http_response_created(response, playback_url, json);
+ ast_ari_response_created(response, playback_url, json);
}
-void stasis_http_record_channel(struct ast_variable *headers,
+void ast_ari_record_channel(struct ast_variable *headers,
struct ast_record_channel_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
ast_assert(response != NULL);
if (args->max_duration_seconds < 0) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"max_duration_seconds cannot be negative");
return;
}
if (args->max_silence_seconds < 0) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"max_silence_seconds cannot be negative");
return;
options = stasis_app_recording_options_create(args->name, args->format);
if (options == NULL) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
}
options->beep = args->beep;
if (options->terminate_on == STASIS_APP_RECORDING_TERMINATE_INVALID) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"terminateOn invalid");
return;
}
if (options->if_exists == -1) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"ifExists invalid");
return;
/* While the arguments are invalid, we should have
* caught them prior to calling record.
*/
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Error parsing request");
break;
case EEXIST:
- stasis_http_response_error(response, 409, "Conflict",
+ ast_ari_response_error(response, 409, "Conflict",
"Recording '%s' already in progress",
args->name);
break;
case ENOMEM:
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
break;
case EPERM:
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Recording name invalid");
break;
ast_log(LOG_WARNING,
"Unrecognized recording error: %s\n",
strerror(errno));
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Internal Server Error");
break;
uri_name_maxlen = strlen(args->name) * 3;
uri_encoded_name = ast_malloc(uri_name_maxlen);
if (!uri_encoded_name) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
return;
ast_asprintf(&recording_url, "/recordings/live/%s", uri_encoded_name);
if (!recording_url) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
return;
json = stasis_app_recording_to_json(recording);
if (!json) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Out of memory");
return;
}
- stasis_http_response_created(response, recording_url, json);
+ ast_ari_response_created(response, recording_url, json);
}
-void stasis_http_get_channel(struct ast_variable *headers,
+void ast_ari_get_channel(struct ast_variable *headers,
struct ast_get_channel_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
struct stasis_caching_topic *caching_topic;
caching_topic = ast_channel_topic_all_cached();
if (!caching_topic) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
msg = stasis_cache_get(caching_topic, ast_channel_snapshot_type(),
args->channel_id);
if (!msg) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Channel not found");
return;
snapshot = stasis_message_data(msg);
ast_assert(snapshot != NULL);
- stasis_http_response_ok(response,
+ ast_ari_response_ok(response,
ast_channel_snapshot_to_json(snapshot));
}
-void stasis_http_delete_channel(struct ast_variable *headers,
+void ast_ari_delete_channel(struct ast_variable *headers,
struct ast_delete_channel_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct ast_channel *, chan, NULL, ao2_cleanup);
chan = ast_channel_get_by_name(args->channel_id);
if (chan == NULL) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Channel not found");
return;
ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_get_channels(struct ast_variable *headers,
+void ast_ari_get_channels(struct ast_variable *headers,
struct ast_get_channels_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
caching_topic = ast_channel_topic_all_cached();
if (!caching_topic) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
snapshots = stasis_cache_dump(caching_topic, ast_channel_snapshot_type());
if (!snapshots) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = ast_json_array_create();
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
int r = ast_json_array_append(
json, ast_channel_snapshot_to_json(snapshot));
if (r != 0) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
}
ao2_iterator_destroy(&i);
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_originate(struct ast_variable *headers,
+void ast_ari_originate(struct ast_variable *headers,
struct ast_originate_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
char *dialtech;
char dialdevice[AST_CHANNEL_NAME];
char *stuff;
if (ast_strlen_zero(args->endpoint)) {
- stasis_http_response_error(response, 400, "Bad Request",
+ ast_ari_response_error(response, 400, "Bad Request",
"Endpoint must be specified");
return;
}
}
if (ast_strlen_zero(dialtech) || ast_strlen_zero(dialdevice)) {
- stasis_http_response_error(response, 400, "Bad Request",
+ ast_ari_response_error(response, 400, "Bad Request",
"Invalid endpoint specified");
return;
}
RAII_VAR(struct ast_str *, appdata, ast_str_create(64), ast_free);
if (!appdata) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
/* originate a channel, putting it into an application */
if (ast_pbx_outgoing_app(dialtech, NULL, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, NULL, NULL, NULL)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
} else if (!ast_strlen_zero(args->extension)) {
/* originate a channel, sending it to an extension */
if (ast_pbx_outgoing_exten(dialtech, NULL, dialdevice, timeout, S_OR(args->context, "default"), args->extension, args->priority ? args->priority : 1, NULL, 0, cid_num, cid_name, NULL, NULL, NULL, 0)) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
} else {
- stasis_http_response_error(response, 400, "Bad Request",
+ ast_ari_response_error(response, 400, "Bad Request",
"Application or extension must be specified");
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
-void stasis_http_get_channel_var(struct ast_variable *headers, struct ast_get_channel_var_args *args, struct stasis_http_response *response)
+void ast_ari_get_channel_var(struct ast_variable *headers, struct ast_get_channel_var_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
value = stasis_app_control_get_channel_var(control, args->variable);
if (!(json = ast_json_pack("{s: s}", "value", S_OR(value, "")))) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_set_channel_var(struct ast_variable *headers, struct ast_set_channel_var_args *args, struct stasis_http_response *response)
+void ast_ari_set_channel_var(struct ast_variable *headers, struct ast_set_channel_var_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
}
if (ast_strlen_zero(args->variable)) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Variable name is required");
return;
}
if (stasis_app_control_set_channel_var(control, args->variable, args->value)) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 400, "Bad Request",
"Failed to execute function");
return;
}
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_channels.c
+ * res/ari/resource_channels.c
*
* Channel resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_CHANNELS_H
#define _ASTERISK_RESOURCE_CHANNELS_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_channels() */
+/*! \brief Argument struct for ast_ari_get_channels() */
struct ast_get_channels_args {
};
/*!
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_channels(struct ast_variable *headers, struct ast_get_channels_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_originate() */
+void ast_ari_get_channels(struct ast_variable *headers, struct ast_get_channels_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_originate() */
struct ast_originate_args {
/*! \brief Endpoint to call. */
const char *endpoint;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_originate(struct ast_variable *headers, struct ast_originate_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_channel() */
+void ast_ari_originate(struct ast_variable *headers, struct ast_originate_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_channel() */
struct ast_get_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_channel(struct ast_variable *headers, struct ast_get_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_delete_channel() */
+void ast_ari_get_channel(struct ast_variable *headers, struct ast_get_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_delete_channel() */
struct ast_delete_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_delete_channel(struct ast_variable *headers, struct ast_delete_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_dial() */
+void ast_ari_delete_channel(struct ast_variable *headers, struct ast_delete_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_dial() */
struct ast_dial_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_dial(struct ast_variable *headers, struct ast_dial_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_continue_in_dialplan() */
+void ast_ari_dial(struct ast_variable *headers, struct ast_dial_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_continue_in_dialplan() */
struct ast_continue_in_dialplan_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_continue_in_dialplan(struct ast_variable *headers, struct ast_continue_in_dialplan_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_answer_channel() */
+void ast_ari_continue_in_dialplan(struct ast_variable *headers, struct ast_continue_in_dialplan_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_answer_channel() */
struct ast_answer_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_answer_channel(struct ast_variable *headers, struct ast_answer_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_mute_channel() */
+void ast_ari_answer_channel(struct ast_variable *headers, struct ast_answer_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_mute_channel() */
struct ast_mute_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_mute_channel(struct ast_variable *headers, struct ast_mute_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_unmute_channel() */
+void ast_ari_mute_channel(struct ast_variable *headers, struct ast_mute_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_unmute_channel() */
struct ast_unmute_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_hold_channel() */
+void ast_ari_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_hold_channel() */
struct ast_hold_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_unhold_channel() */
+void ast_ari_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_unhold_channel() */
struct ast_unhold_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_moh_start_channel() */
+void ast_ari_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_moh_start_channel() */
struct ast_moh_start_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_moh_stop_channel() */
+void ast_ari_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_moh_stop_channel() */
struct ast_moh_stop_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_play_on_channel() */
+void ast_ari_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_play_on_channel() */
struct ast_play_on_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_play_on_channel(struct ast_variable *headers, struct ast_play_on_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_record_channel() */
+void ast_ari_play_on_channel(struct ast_variable *headers, struct ast_play_on_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_record_channel() */
struct ast_record_channel_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_record_channel(struct ast_variable *headers, struct ast_record_channel_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_channel_var() */
+void ast_ari_record_channel(struct ast_variable *headers, struct ast_record_channel_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_channel_var() */
struct ast_get_channel_var_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_channel_var(struct ast_variable *headers, struct ast_get_channel_var_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_set_channel_var() */
+void ast_ari_get_channel_var(struct ast_variable *headers, struct ast_get_channel_var_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_set_channel_var() */
struct ast_set_channel_var_args {
/*! \brief Channel's id */
const char *channel_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_set_channel_var(struct ast_variable *headers, struct ast_set_channel_var_args *args, struct stasis_http_response *response);
+void ast_ari_set_channel_var(struct ast_variable *headers, struct ast_set_channel_var_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_CHANNELS_H */
#include "asterisk/stasis.h"
#include "asterisk/stasis_endpoints.h"
-void stasis_http_get_endpoints(struct ast_variable *headers,
+void ast_ari_get_endpoints(struct ast_variable *headers,
struct ast_get_endpoints_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
caching_topic = ast_endpoint_topic_all_cached();
if (!caching_topic) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
snapshots = stasis_cache_dump(caching_topic, ast_endpoint_snapshot_type());
if (!snapshots) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = ast_json_array_create();
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
int r = ast_json_array_append(
json, ast_endpoint_snapshot_to_json(snapshot));
if (r != 0) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
}
ao2_iterator_destroy(&i);
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_get_endpoints_by_tech(struct ast_variable *headers,
+void ast_ari_get_endpoints_by_tech(struct ast_variable *headers,
struct ast_get_endpoints_by_tech_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
caching_topic = ast_endpoint_topic_all_cached();
if (!caching_topic) {
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
snapshots = stasis_cache_dump(caching_topic, ast_endpoint_snapshot_type());
if (!snapshots) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
json = ast_json_array_create();
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
r = ast_json_array_append(
json, ast_endpoint_snapshot_to_json(snapshot));
if (r != 0) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
}
ao2_iterator_destroy(&i);
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_get_endpoint(struct ast_variable *headers,
+void ast_ari_get_endpoint(struct ast_variable *headers,
struct ast_get_endpoint_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
RAII_VAR(struct ast_endpoint_snapshot *, snapshot, NULL, ao2_cleanup);
snapshot = ast_endpoint_latest_snapshot(args->tech, args->resource, 0);
if (!snapshot) {
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"Endpoint not found");
return;
}
json = ast_endpoint_snapshot_to_json(snapshot);
if (!json) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_endpoints.c
+ * res/ari/resource_endpoints.c
*
* Endpoint resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_ENDPOINTS_H
#define _ASTERISK_RESOURCE_ENDPOINTS_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_endpoints() */
+/*! \brief Argument struct for ast_ari_get_endpoints() */
struct ast_get_endpoints_args {
};
/*!
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_endpoints_by_tech() */
+void ast_ari_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_endpoints_by_tech() */
struct ast_get_endpoints_by_tech_args {
/*! \brief Technology of the endpoints (sip,iax2,...) */
const char *tech;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, struct ast_get_endpoints_by_tech_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_endpoint() */
+void ast_ari_get_endpoints_by_tech(struct ast_variable *headers, struct ast_get_endpoints_by_tech_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_endpoint() */
struct ast_get_endpoint_args {
/*! \brief Technology of the endpoint */
const char *tech;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct stasis_http_response *response);
+void ast_ari_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_ENDPOINTS_H */
/*! \brief A connection to the event WebSocket */
struct event_session {
- struct ari_websocket_session *ws_session;
+ struct ast_ari_websocket_session *ws_session;
struct ao2_container *websocket_apps;
};
}
static struct event_session *session_create(
- struct ari_websocket_session *ws_session)
+ struct ast_ari_websocket_session *ws_session)
{
RAII_VAR(struct event_session *, session, NULL, ao2_cleanup);
const char *msg_application = S_OR(
ast_json_string_get(ast_json_object_get(message, "application")),
"");
-
+
/* Determine if we've been replaced */
if (strcmp(msg_type, "ApplicationReplaced") == 0 &&
strcmp(msg_application, app_name) == 0) {
ao2_lock(session);
if (session->ws_session) {
- ari_websocket_session_write(session->ws_session, message);
+ ast_ari_websocket_session_write(session->ws_session, message);
}
ao2_unlock(session);
}
to_free = apps = ast_strdup(app_list);
if (!apps) {
- ari_websocket_session_write(session->ws_session, ari_oom_json());
+ ast_ari_websocket_session_write(session->ws_session, ast_ari_oom_json());
return -1;
}
while ((app_name = strsep(&apps, ","))) {
if (ast_str_container_add(session->websocket_apps, app_name)) {
- ari_websocket_session_write(session->ws_session, ari_oom_json());
+ ast_ari_websocket_session_write(session->ws_session, ast_ari_oom_json());
return -1;
}
return 0;
}
-void ari_websocket_event_websocket(struct ari_websocket_session *ws_session,
+void ast_ari_websocket_event_websocket(struct ast_ari_websocket_session *ws_session,
struct ast_variable *headers,
struct ast_event_websocket_args *args)
{
session = session_create(ws_session);
if (!session) {
- ari_websocket_session_write(ws_session, ari_oom_json());
+ ast_ari_websocket_session_write(ws_session, ast_ari_oom_json());
return;
}
"type", "MissingParams",
"params", "app");
if (!msg) {
- msg = ast_json_ref(ari_oom_json());
+ msg = ast_json_ref(ast_ari_oom_json());
}
- ari_websocket_session_write(session->ws_session, msg);
+ ast_ari_websocket_session_write(session->ws_session, msg);
return;
}
res = session_register_apps(session, args->app);
if (res != 0) {
- ari_websocket_session_write(ws_session, ari_oom_json());
+ ast_ari_websocket_session_write(ws_session, ast_ari_oom_json());
return;
}
/* We don't process any input, but we'll consume it waiting for EOF */
- while ((msg = ari_websocket_session_read(ws_session))) {
+ while ((msg = ast_ari_websocket_session_read(ws_session))) {
ast_json_unref(msg);
}
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_events.c
+ * res/ari/resource_events.c
*
* WebSocket resource
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_EVENTS_H
#define _ASTERISK_RESOURCE_EVENTS_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_event_websocket() */
+/*! \brief Argument struct for ast_ari_event_websocket() */
struct ast_event_websocket_args {
/*! \brief Comma seperated list of applications to subscribe to. */
const char *app;
* \param headers HTTP headers.
* \param args Swagger parameters.
*/
-void ari_websocket_event_websocket(struct ari_websocket_session *session, struct ast_variable *headers, struct ast_event_websocket_args *args);
+void ast_ari_websocket_event_websocket(struct ast_ari_websocket_session *session, struct ast_variable *headers, struct ast_event_websocket_args *args);
#endif /* _ASTERISK_RESOURCE_EVENTS_H */
#include "asterisk/stasis_app_playback.h"
#include "resource_playback.h"
-void stasis_http_get_playback(struct ast_variable *headers,
+void ast_ari_get_playback(struct ast_variable *headers,
struct ast_get_playback_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
playback = stasis_app_playback_find_by_id(args->playback_id);
if (playback == NULL) {
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"Playback not found");
return;
}
json = stasis_app_playback_to_json(playback);
if (json == NULL) {
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Error building response");
return;
}
- stasis_http_response_ok(response, ast_json_ref(json));
+ ast_ari_response_ok(response, ast_json_ref(json));
}
-void stasis_http_stop_playback(struct ast_variable *headers,
+void ast_ari_stop_playback(struct ast_variable *headers,
struct ast_stop_playback_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
enum stasis_playback_oper_results res;
playback = stasis_app_playback_find_by_id(args->playback_id);
if (playback == NULL) {
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"Playback not found");
return;
}
switch (res) {
case STASIS_PLAYBACK_OPER_OK:
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
return;
case STASIS_PLAYBACK_OPER_FAILED:
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Could not stop playback");
return;
case STASIS_PLAYBACK_OPER_NOT_PLAYING:
/* Stop operation should be valid even when not playing */
ast_assert(0);
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Could not stop playback");
return;
}
}
-void stasis_http_control_playback(struct ast_variable *headers,
+void ast_ari_control_playback(struct ast_variable *headers,
struct ast_control_playback_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
enum stasis_app_playback_media_operation oper;
} else if (strcmp(args->operation, "forward") == 0) {
oper = STASIS_PLAYBACK_FORWARD;
} else {
- stasis_http_response_error(response, 400,
+ ast_ari_response_error(response, 400,
"Bad Request", "Invalid operation %s",
args->operation);
return;
playback = stasis_app_playback_find_by_id(args->playback_id);
if (playback == NULL) {
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"Playback not found");
return;
}
switch (res) {
case STASIS_PLAYBACK_OPER_OK:
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
return;
case STASIS_PLAYBACK_OPER_FAILED:
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Could not %s playback",
args->operation);
return;
case STASIS_PLAYBACK_OPER_NOT_PLAYING:
- stasis_http_response_error(response, 409, "Conflict",
+ ast_ari_response_error(response, 409, "Conflict",
"Can only %s while media is playing", args->operation);
return;
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_playback.c
+ * res/ari/resource_playback.c
*
* Playback control resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_PLAYBACK_H
#define _ASTERISK_RESOURCE_PLAYBACK_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_playback() */
+/*! \brief Argument struct for ast_ari_get_playback() */
struct ast_get_playback_args {
/*! \brief Playback's id */
const char *playback_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_playback(struct ast_variable *headers, struct ast_get_playback_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_stop_playback() */
+void ast_ari_get_playback(struct ast_variable *headers, struct ast_get_playback_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_stop_playback() */
struct ast_stop_playback_args {
/*! \brief Playback's id */
const char *playback_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_stop_playback(struct ast_variable *headers, struct ast_stop_playback_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_control_playback() */
+void ast_ari_stop_playback(struct ast_variable *headers, struct ast_stop_playback_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_control_playback() */
struct ast_control_playback_args {
/*! \brief Playback's id */
const char *playback_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response);
+void ast_ari_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
--- /dev/null
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2012 - 2013, Digium, Inc.
+ *
+ * David M. Lee, II <dlee@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief /api-docs/recordings.{format} implementation- Recording resources
+ *
+ * \author David M. Lee, II <dlee@digium.com>
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#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)
+{
+ ast_log(LOG_ERROR, "TODO: ast_ari_get_stored_recordings\n");
+}
+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");
+}
+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");
+}
+
+void ast_ari_get_live_recording(struct ast_variable *headers,
+ struct ast_get_live_recording_args *args,
+ struct ast_ari_response *response)
+{
+ RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+
+ recording = stasis_app_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_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_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct ast_ari_response *response)
+{
+ ast_log(LOG_ERROR, "TODO: ast_ari_cancel_recording\n");
+}
+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_stop_recording\n");
+}
+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_pause_recording\n");
+}
+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_unpause_recording\n");
+}
+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_mute_recording\n");
+}
+void ast_ari_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct ast_ari_response *response)
+{
+ ast_log(LOG_ERROR, "TODO: ast_ari_unmute_recording\n");
+}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_recordings.c
+ * res/ari/resource_recordings.c
*
* Recording resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_RECORDINGS_H
#define _ASTERISK_RESOURCE_RECORDINGS_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_stored_recordings() */
+/*! \brief Argument struct for ast_ari_get_stored_recordings() */
struct ast_get_stored_recordings_args {
};
/*!
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_stored_recordings(struct ast_variable *headers, struct ast_get_stored_recordings_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_stored_recording() */
+void ast_ari_get_stored_recordings(struct ast_variable *headers, struct ast_get_stored_recordings_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_stored_recording() */
struct ast_get_stored_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_stored_recording(struct ast_variable *headers, struct ast_get_stored_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_delete_stored_recording() */
+void ast_ari_get_stored_recording(struct ast_variable *headers, struct ast_get_stored_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_delete_stored_recording() */
struct ast_delete_stored_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_delete_stored_recording(struct ast_variable *headers, struct ast_delete_stored_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_live_recordings() */
+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 {
};
/*!
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_live_recordings(struct ast_variable *headers, struct ast_get_live_recordings_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_live_recording() */
+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 */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_live_recording(struct ast_variable *headers, struct ast_get_live_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_cancel_recording() */
+void ast_ari_get_live_recording(struct ast_variable *headers, struct ast_get_live_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_cancel_recording() */
struct ast_cancel_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_stop_recording() */
+void ast_ari_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_stop_recording() */
struct ast_stop_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_stop_recording(struct ast_variable *headers, struct ast_stop_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_pause_recording() */
+void ast_ari_stop_recording(struct ast_variable *headers, struct ast_stop_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_pause_recording() */
struct ast_pause_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_pause_recording(struct ast_variable *headers, struct ast_pause_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_unpause_recording() */
+void ast_ari_pause_recording(struct ast_variable *headers, struct ast_pause_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_unpause_recording() */
struct ast_unpause_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_unpause_recording(struct ast_variable *headers, struct ast_unpause_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_mute_recording() */
+void ast_ari_unpause_recording(struct ast_variable *headers, struct ast_unpause_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_mute_recording() */
struct ast_mute_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_mute_recording(struct ast_variable *headers, struct ast_mute_recording_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_unmute_recording() */
+void ast_ari_mute_recording(struct ast_variable *headers, struct ast_mute_recording_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_unmute_recording() */
struct ast_unmute_recording_args {
/*! \brief The name of the recording */
const char *recording_name;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct stasis_http_response *response);
+void ast_ari_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_RECORDINGS_H */
return 0;
}
-void stasis_http_get_sounds(struct ast_variable *headers, struct ast_get_sounds_args *args, struct stasis_http_response *response)
+void ast_ari_get_sounds(struct ast_variable *headers, struct ast_get_sounds_args *args, struct ast_ari_response *response)
{
RAII_VAR(struct ao2_container *, sound_files, NULL, ao2_cleanup);
struct ast_json *sounds_blob;
RAII_VAR(struct ast_media_index *, sounds_index, ast_sounds_get_index(), ao2_cleanup);
if (!sounds_index) {
- stasis_http_response_error(response, 500, "Internal Error", "Sounds index not available");
+ ast_ari_response_error(response, 500, "Internal Error", "Sounds index not available");
return;
}
sound_files = ast_media_get_media(sounds_index);
if (!sound_files) {
- stasis_http_response_error(response, 500, "Internal Error", "Allocation Error");
+ ast_ari_response_error(response, 500, "Internal Error", "Allocation Error");
return;
}
sounds_blob = ast_json_array_create();
if (!sounds_blob) {
- stasis_http_response_error(response, 500, "Internal Error", "Allocation Error");
+ ast_ari_response_error(response, 500, "Internal Error", "Allocation Error");
return;
}
ao2_callback_data(sound_files, OBJ_NODATA, append_sound_cb, sounds_blob, args);
if (!ast_json_array_size(sounds_blob)) {
- stasis_http_response_error(response, 404, "Not Found", "No sounds found that matched the query");
+ ast_ari_response_error(response, 404, "Not Found", "No sounds found that matched the query");
return;
}
- stasis_http_response_ok(response, sounds_blob);
+ ast_ari_response_ok(response, sounds_blob);
}
-void stasis_http_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct stasis_http_response *response)
+void ast_ari_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct ast_ari_response *response)
{
struct ast_json *sound_blob;
sound_blob = create_sound_blob(args->sound_id, NULL);
if (!sound_blob) {
- stasis_http_response_error(response, 404, "Not Found", "Sound not found");
+ ast_ari_response_error(response, 404, "Not Found", "Sound not found");
return;
}
- stasis_http_response_ok(response, sound_blob);
+ ast_ari_response_ok(response, sound_blob);
}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_sounds.c
+ * res/ari/resource_sounds.c
*
* Sound resources
*
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_SOUNDS_H
#define _ASTERISK_RESOURCE_SOUNDS_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
-/*! \brief Argument struct for stasis_http_get_sounds() */
+/*! \brief Argument struct for ast_ari_get_sounds() */
struct ast_get_sounds_args {
const char *lang;
const char *format;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_sounds(struct ast_variable *headers, struct ast_get_sounds_args *args, struct stasis_http_response *response);
-/*! \brief Argument struct for stasis_http_get_stored_sound() */
+void ast_ari_get_sounds(struct ast_variable *headers, struct ast_get_sounds_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_get_stored_sound() */
struct ast_get_stored_sound_args {
/*! \brief Sound's id */
const char *sound_id;
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct stasis_http_response *response);
+void ast_ari_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct ast_ari_response *response);
#endif /* _ASTERISK_RESOURCE_SOUNDS_H */
*
* The structure of the generated code is:
*
- * - res/stasis_http/resource_{resource}.h
+ * - res/ari/resource_{resource}.h
* - For each operation in the resouce, a generated argument structure
* (holding the parsed arguments from the request) and function
- * declarations (to implement in res/stasis_http/resource_{resource}.c)
- * - res_stasis_http_{resource}.c
+ * declarations (to implement in res/ari/resource_{resource}.c)
+ * - res_ari_{resource}.c
* - A set of \ref stasis_rest_callback functions, which glue the two
* together. They parse out path variables and request parameters to
* populate a specific \c *_args which is passed to the specific request
- * handler (in res/stasis_http/resource_{resource}.c)
+ * handler (in res/ari/resource_{resource}.c)
* - A tree of \ref stasis_rest_handlers for routing requests to its
* \ref stasis_rest_callback
*
* The basic flow of an HTTP request is:
*
- * - stasis_http_callback()
+ * - ast_ari_callback()
* 1. Initial request validation
- * 2. Routes as either a doc request (stasis_http_get_docs) or API
- * request (stasis_http_invoke)
- * - stasis_http_invoke()
+ * 2. Routes as either a doc request (ast_ari_get_docs) or API
+ * request (ast_ari_invoke)
+ * - ast_ari_invoke()
* 1. Further request validation
* 2. Routes the request through the tree of generated
* \ref stasis_rest_handlers.
* 3. Dispatch to the generated callback
- * - \c stasis_http_*_cb
+ * - \c ast_ari_*_cb
* 1. Populate \c *_args struct with path and get params
* 2. Invoke the request handler
* 3. Validates and sends response
***/
/*** DOCUMENTATION
- <configInfo name="res_stasis_http" language="en_US">
+ <configInfo name="res_ari" language="en_US">
<synopsis>HTTP binding for the Stasis API</synopsis>
<configFile name="ari.conf">
<configObject name="general">
<synopsis>General configuration settings</synopsis>
<configOption name="enabled">
- <synopsis>Enable/disable the stasis-http module</synopsis>
+ <synopsis>Enable/disable the ARI module</synopsis>
</configOption>
<configOption name="pretty">
- <synopsis>Responses from stasis-http are formatted to be human readable</synopsis>
+ <synopsis>Responses from ARI are formatted to be human readable</synopsis>
</configOption>
<configOption name="auth_realm">
<synopsis>Realm to use for authentication. Defaults to Asterisk REST Interface.</synopsis>
#include "asterisk/astobj2.h"
#include "asterisk/module.h"
#include "asterisk/paths.h"
-#include "asterisk/stasis_http.h"
-#include "stasis_http/internal.h"
+#include "asterisk/ari.h"
+#include "ari/internal.h"
#include <string.h>
#include <sys/stat.h>
/*! \brief Helper function to check if module is enabled. */
static int is_enabled(void)
{
- RAII_VAR(struct ari_conf *, cfg, ari_config_get(), ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, cfg, ast_ari_config_get(), ao2_cleanup);
return cfg && cfg->general && cfg->general->enabled;
}
/*! Pre-defined message for allocation failures. */
static struct ast_json *oom_json;
-struct ast_json *ari_oom_json(void)
+struct ast_json *ast_ari_oom_json(void)
{
return oom_json;
}
-int stasis_http_add_handler(struct stasis_rest_handlers *handler)
+int ast_ari_add_handler(struct stasis_rest_handlers *handler)
{
RAII_VAR(struct stasis_rest_handlers *, new_handler, NULL, ao2_cleanup);
size_t old_size, new_size;
return 0;
}
-int stasis_http_remove_handler(struct stasis_rest_handlers *handler)
+int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
{
RAII_VAR(struct stasis_rest_handlers *, new_handler, NULL, ao2_cleanup);
size_t size, i, j;
return handler;
}
-void stasis_http_response_error(struct stasis_http_response *response,
+void ast_ari_response_error(struct ast_ari_response *response,
int response_code,
const char *response_text,
const char *message_fmt, ...)
response->response_text = response_text;
}
-void stasis_http_response_ok(struct stasis_http_response *response,
+void ast_ari_response_ok(struct ast_ari_response *response,
struct ast_json *message)
{
response->message = ast_json_ref(message);
response->response_text = "OK";
}
-void stasis_http_response_no_content(struct stasis_http_response *response)
+void ast_ari_response_no_content(struct ast_ari_response *response)
{
response->message = ast_json_null();
response->response_code = 204;
response->response_text = "No Content";
}
-void stasis_http_response_alloc_failed(struct stasis_http_response *response)
+void ast_ari_response_alloc_failed(struct ast_ari_response *response)
{
response->message = ast_json_ref(oom_json);
response->response_code = 500;
response->response_text = "Internal Server Error";
}
-void stasis_http_response_created(struct stasis_http_response *response,
+void ast_ari_response_created(struct ast_ari_response *response,
const char *url, struct ast_json *message)
{
response->message = ast_json_ref(message);
}
static void add_allow_header(struct stasis_rest_handlers *handler,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
enum ast_http_method m;
ast_str_append(&response->headers, 0,
static int origin_allowed(const char *origin)
{
- RAII_VAR(struct ari_conf *, cfg, ari_config_get(), ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, cfg, ast_ari_config_get(), ao2_cleanup);
char *allowed = ast_strdupa(cfg->general->allowed_origins);
char *current;
*/
static void handle_options(struct stasis_rest_handlers *handler,
struct ast_variable *headers,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
struct ast_variable *header;
char const *acr_method = NULL;
/* Regular OPTIONS response */
add_allow_header(handler, response);
- stasis_http_response_no_content(response);
+ ast_ari_response_no_content(response);
/* Parse CORS headers */
for (header = headers; header != NULL; header = header->next) {
allow = ast_str_create(20);
if (!allow) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
}
}
-void stasis_http_invoke(struct ast_tcptls_session_instance *ser,
+void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
const char *uri, enum ast_http_method method,
struct ast_variable *get_params, struct ast_variable *headers,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
RAII_VAR(char *, response_text, NULL, ast_free);
RAII_VAR(struct stasis_rest_handlers *, root, NULL, ao2_cleanup);
if (found_handler == NULL) {
/* resource not found */
ast_debug(3, " Handler not found\n");
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Resource not found");
return;
if (method < 0 || method >= AST_HTTP_MAX_METHOD) {
add_allow_header(handler, response);
- stasis_http_response_error(
+ ast_ari_response_error(
response, 405, "Method Not Allowed",
"Invalid method");
return;
callback = handler->callbacks[method];
if (callback == NULL) {
add_allow_header(handler, response);
- stasis_http_response_error(
+ ast_ari_response_error(
response, 405, "Method Not Allowed",
"Invalid method");
return;
/* Really should not happen */
ast_log(LOG_ERROR, "ARI %s %s not implemented\n",
ast_get_http_method(method), uri);
- stasis_http_response_error(
+ ast_ari_response_error(
response, 501, "Not Implemented",
"Method not implemented");
}
}
-void stasis_http_get_docs(const char *uri, struct ast_variable *headers,
- struct stasis_http_response *response)
+void ast_ari_get_docs(const char *uri, struct ast_variable *headers,
+ struct ast_ari_response *response)
{
RAII_VAR(struct ast_str *, absolute_path_builder, NULL, ast_free);
RAII_VAR(char *, absolute_api_dirname, NULL, free);
absolute_path_builder = ast_str_create(80);
if (absolute_path_builder == NULL) {
- stasis_http_response_alloc_failed(response);
+ ast_ari_response_alloc_failed(response);
return;
}
absolute_api_dirname = realpath(ast_str_buffer(absolute_path_builder), NULL);
if (absolute_api_dirname == NULL) {
ast_log(LOG_ERROR, "Error determining real directory for rest-api\n");
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Cannot find rest-api directory");
return;
case ENAMETOOLONG:
case ENOENT:
case ENOTDIR:
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Resource not found");
break;
case EACCES:
- stasis_http_response_error(
+ ast_ari_response_error(
response, 403, "Forbidden",
"Permission denied");
break;
ast_log(LOG_ERROR,
"Error determining real path for uri '%s': %s\n",
uri, strerror(errno));
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Cannot find file");
break;
ast_log(LOG_ERROR,
"Invalid attempt to access '%s' (not in %s)\n",
absolute_filename, absolute_api_dirname);
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Resource not found");
return;
if (stat(absolute_filename, &file_stat) == 0) {
if (!(file_stat.st_mode & S_IFREG)) {
/* Not a file */
- stasis_http_response_error(
+ ast_ari_response_error(
response, 403, "Forbidden",
"Invalid access");
return;
}
} else {
/* Does not exist */
- stasis_http_response_error(
+ ast_ari_response_error(
response, 404, "Not Found",
"Resource not found");
return;
if (obj == NULL) {
ast_log(LOG_ERROR, "Error parsing resource file: %s:%d(%d) %s\n",
error.source, error.line, error.column, error.text);
- stasis_http_response_error(
+ ast_ari_response_error(
response, 500, "Internal Server Error",
"Yikes! Cannot parse resource");
return;
}
}
- stasis_http_response_ok(response, obj);
+ ast_ari_response_ok(response, obj);
}
static void remove_trailing_slash(const char *uri,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
char *slashless = ast_strdupa(uri);
slashless[strlen(slashless) - 1] = '\0';
* Given all of that, a 404 with a nice message telling them what to do
* is probably our best bet.
*/
- stasis_http_response_error(response, 404, "Not Found",
+ ast_ari_response_error(response, 404, "Not Found",
"ARI URLs do not end with a slash. Try /ari/%s", slashless);
}
* See http://www.w3.org/TR/cors/ for the spec. Especially section 6.1.
*/
static void process_cors_request(struct ast_variable *headers,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
char const *origin = NULL;
struct ast_variable *header;
*/
}
-enum ast_json_encoding_format stasis_http_json_format(void)
+enum ast_json_encoding_format ast_ari_json_format(void)
{
- RAII_VAR(struct ari_conf *, cfg, NULL, ao2_cleanup);
- cfg = ari_config_get();
+ RAII_VAR(struct ast_ari_conf *, cfg, NULL, ao2_cleanup);
+ cfg = ast_ari_config_get();
return cfg->general->format;
}
* \return User object for the authenticated user.
* \return \c NULL if authentication failed.
*/
-static struct ari_conf_user *authenticate_api_key(const char *api_key)
+static struct ast_ari_conf_user *authenticate_api_key(const char *api_key)
{
RAII_VAR(char *, copy, NULL, ast_free);
char *username;
return NULL;
}
- return ari_config_validate_user(username, password);
+ return ast_ari_config_validate_user(username, password);
}
/*!
* \return User object for the authenticated user.
* \return \c NULL if authentication failed.
*/
-static struct ari_conf_user *authenticate_user(struct ast_variable *get_params,
+static struct ast_ari_conf_user *authenticate_user(struct ast_variable *get_params,
struct ast_variable *headers)
{
RAII_VAR(struct ast_http_auth *, http_auth, NULL, ao2_cleanup);
/* HTTP Basic authentication */
http_auth = ast_http_get_auth(headers);
if (http_auth) {
- return ari_config_validate_user(http_auth->userid,
+ return ast_ari_config_validate_user(http_auth->userid,
http_auth->password);
}
/*!
* \internal
- * \brief Stasis HTTP handler.
+ * \brief ARI HTTP handler.
*
* This handler takes the HTTP request and turns it into the appropriate
* RESTful request (conversion to JSON, routing, etc.)
* \param get_params HTTP \c GET params.
* \param headers HTTP headers.
*/
-static int stasis_http_callback(struct ast_tcptls_session_instance *ser,
+static int ast_ari_callback(struct ast_tcptls_session_instance *ser,
const struct ast_http_uri *urih,
const char *uri,
enum ast_http_method method,
struct ast_variable *get_params,
struct ast_variable *headers)
{
- RAII_VAR(struct ari_conf *, conf, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_conf *, conf, NULL, ao2_cleanup);
RAII_VAR(struct ast_str *, response_headers, ast_str_create(40), ast_free);
RAII_VAR(struct ast_str *, response_body, ast_str_create(256), ast_free);
- RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
- struct stasis_http_response response = {};
+ RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
+ struct ast_ari_response response = {};
int ret = 0;
if (!response_headers || !response_body) {
return -1;
}
- conf = ari_config_get();
+ conf = ast_ari_config_get();
if (!conf || !conf->general) {
return -1;
}
response.response_text = "Method Not Allowed";
} else {
/* Skip the api-docs prefix */
- stasis_http_get_docs(strchr(uri, '/') + 1, headers, &response);
+ ast_ari_get_docs(strchr(uri, '/') + 1, headers, &response);
}
} else {
/* Other RESTful resources */
- stasis_http_invoke(ser, uri, method, get_params, headers,
+ ast_ari_invoke(ser, uri, method, get_params, headers,
&response);
}
}
static struct ast_http_uri http_uri = {
- .callback = stasis_http_callback,
+ .callback = ast_ari_callback,
.description = "Asterisk RESTful API",
.uri = "ari",
return AST_MODULE_LOAD_FAILURE;
}
- if (ari_config_init() != 0) {
+ if (ast_ari_config_init() != 0) {
return AST_MODULE_LOAD_DECLINE;
}
ast_debug(3, "ARI disabled\n");
}
- if (ari_cli_register() != 0) {
+ if (ast_ari_cli_register() != 0) {
return AST_MODULE_LOAD_FAILURE;
}
static int unload_module(void)
{
- ari_cli_unregister();
+ ast_ari_cli_unregister();
if (is_enabled()) {
ast_debug(3, "Disabling ARI\n");
ast_http_uri_unlink(&http_uri);
}
- ari_config_destroy();
+ ast_ari_config_destroy();
ao2_cleanup(root_handler);
root_handler = NULL;
{
char was_enabled = is_enabled();
- if (ari_config_reload() != 0) {
+ if (ast_ari_config_reload() != 0) {
return AST_MODULE_LOAD_DECLINE;
}
--- /dev/null
+{
+ global:
+ LINKER_SYMBOL_PREFIXast_ari_*;
+ local:
+ *;
+};
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_asterisk.h"
+#include "ari/resource_asterisk.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_asterisk_info_cb(
+static void ast_ari_get_asterisk_info_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_asterisk_info(headers, &args, response);
+ ast_ari_get_asterisk_info(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_asterisk_info(
+ is_valid = ast_ari_validate_asterisk_info(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /asterisk/info\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /asterisk/info\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_global_var_cb(
+static void ast_ari_get_global_var_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_global_var(headers, &args, response);
+ ast_ari_get_global_var(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_variable(
+ is_valid = ast_ari_validate_variable(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /asterisk/variable\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /asterisk/variable\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_set_global_var_cb(
+static void ast_ari_set_global_var_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_set_global_var(headers, &args, response);
+ ast_ari_set_global_var(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /asterisk/variable\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /asterisk/variable\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
static struct stasis_rest_handlers asterisk_info = {
.path_segment = "info",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_asterisk_info_cb,
+ [AST_HTTP_GET] = ast_ari_get_asterisk_info_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers asterisk_variable = {
.path_segment = "variable",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_global_var_cb,
- [AST_HTTP_POST] = stasis_http_set_global_var_cb,
+ [AST_HTTP_GET] = ast_ari_get_global_var_cb,
+ [AST_HTTP_POST] = ast_ari_set_global_var_cb,
},
.num_children = 0,
.children = { }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&asterisk);
+ res |= ast_ari_add_handler(&asterisk);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&asterisk);
+ ast_ari_remove_handler(&asterisk);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Asterisk resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_bridges.h"
+#include "ari/resource_bridges.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_bridges_cb(
+static void ast_ari_get_bridges_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
struct ast_get_bridges_args args = {};
- stasis_http_get_bridges(headers, &args, response);
+ ast_ari_get_bridges(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_bridge_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_bridge_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_new_bridge_cb(
+static void ast_ari_new_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_new_bridge(headers, &args, response);
+ ast_ari_new_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_bridge(
+ is_valid = ast_ari_validate_bridge(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_bridge_cb(
+static void ast_ari_get_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_bridge(headers, &args, response);
+ ast_ari_get_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_bridge(
+ is_valid = ast_ari_validate_bridge(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_delete_bridge_cb(
+static void ast_ari_delete_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_delete_bridge(headers, &args, response);
+ ast_ari_delete_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_add_channel_to_bridge_cb(
+static void ast_ari_add_channel_to_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_add_channel_to_bridge(headers, &args, response);
+ ast_ari_add_channel_to_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/addChannel\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/addChannel\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_remove_channel_from_bridge_cb(
+static void ast_ari_remove_channel_from_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_remove_channel_from_bridge(headers, &args, response);
+ ast_ari_remove_channel_from_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/removeChannel\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/removeChannel\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_play_on_bridge_cb(
+static void ast_ari_play_on_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_play_on_bridge(headers, &args, response);
+ ast_ari_play_on_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_playback(
+ is_valid = ast_ari_validate_playback(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/play\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/play\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_record_bridge_cb(
+static void ast_ari_record_bridge_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_record_bridge(headers, &args, response);
+ ast_ari_record_bridge(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_live_recording(
+ is_valid = ast_ari_validate_live_recording(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /bridges/{bridgeId}/record\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /bridges/{bridgeId}/record\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
static struct stasis_rest_handlers bridges_bridgeId_addChannel = {
.path_segment = "addChannel",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_add_channel_to_bridge_cb,
+ [AST_HTTP_POST] = ast_ari_add_channel_to_bridge_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers bridges_bridgeId_removeChannel = {
.path_segment = "removeChannel",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_remove_channel_from_bridge_cb,
+ [AST_HTTP_POST] = ast_ari_remove_channel_from_bridge_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers bridges_bridgeId_play = {
.path_segment = "play",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_play_on_bridge_cb,
+ [AST_HTTP_POST] = ast_ari_play_on_bridge_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers bridges_bridgeId_record = {
.path_segment = "record",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_record_bridge_cb,
+ [AST_HTTP_POST] = ast_ari_record_bridge_cb,
},
.num_children = 0,
.children = { }
.path_segment = "bridgeId",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_bridge_cb,
- [AST_HTTP_DELETE] = stasis_http_delete_bridge_cb,
+ [AST_HTTP_GET] = ast_ari_get_bridge_cb,
+ [AST_HTTP_DELETE] = ast_ari_delete_bridge_cb,
},
.num_children = 4,
.children = { &bridges_bridgeId_addChannel,&bridges_bridgeId_removeChannel,&bridges_bridgeId_play,&bridges_bridgeId_record, }
static struct stasis_rest_handlers bridges = {
.path_segment = "bridges",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_bridges_cb,
- [AST_HTTP_POST] = stasis_http_new_bridge_cb,
+ [AST_HTTP_GET] = ast_ari_get_bridges_cb,
+ [AST_HTTP_POST] = ast_ari_new_bridge_cb,
},
.num_children = 1,
.children = { &bridges_bridgeId, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&bridges);
+ res |= ast_ari_add_handler(&bridges);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&bridges);
+ ast_ari_remove_handler(&bridges);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Bridge resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_channels.h"
+#include "ari/resource_channels.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_channels_cb(
+static void ast_ari_get_channels_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
struct ast_get_channels_args args = {};
- stasis_http_get_channels(headers, &args, response);
+ ast_ari_get_channels(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_channel_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_channel_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_originate_cb(
+static void ast_ari_originate_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_originate(headers, &args, response);
+ ast_ari_originate(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_channel_cb(
+static void ast_ari_get_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_channel(headers, &args, response);
+ ast_ari_get_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_channel(
+ is_valid = ast_ari_validate_channel(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_delete_channel_cb(
+static void ast_ari_delete_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_delete_channel(headers, &args, response);
+ ast_ari_delete_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_dial_cb(
+static void ast_ari_dial_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_dial(headers, &args, response);
+ ast_ari_dial(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_dialed(
+ is_valid = ast_ari_validate_dialed(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/dial\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/dial\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_continue_in_dialplan_cb(
+static void ast_ari_continue_in_dialplan_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_continue_in_dialplan(headers, &args, response);
+ ast_ari_continue_in_dialplan(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/continue\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/continue\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_answer_channel_cb(
+static void ast_ari_answer_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_answer_channel(headers, &args, response);
+ ast_ari_answer_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/answer\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/answer\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_mute_channel_cb(
+static void ast_ari_mute_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_mute_channel(headers, &args, response);
+ ast_ari_mute_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mute\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mute\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_unmute_channel_cb(
+static void ast_ari_unmute_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_unmute_channel(headers, &args, response);
+ ast_ari_unmute_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/unmute\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/unmute\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_hold_channel_cb(
+static void ast_ari_hold_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_hold_channel(headers, &args, response);
+ ast_ari_hold_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/hold\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/hold\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_unhold_channel_cb(
+static void ast_ari_unhold_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_unhold_channel(headers, &args, response);
+ ast_ari_unhold_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/unhold\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/unhold\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_moh_start_channel_cb(
+static void ast_ari_moh_start_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_moh_start_channel(headers, &args, response);
+ ast_ari_moh_start_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mohstart\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mohstart\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_moh_stop_channel_cb(
+static void ast_ari_moh_stop_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_moh_stop_channel(headers, &args, response);
+ ast_ari_moh_stop_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/mohstop\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/mohstop\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_play_on_channel_cb(
+static void ast_ari_play_on_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_play_on_channel(headers, &args, response);
+ ast_ari_play_on_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_playback(
+ is_valid = ast_ari_validate_playback(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/play\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/play\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_record_channel_cb(
+static void ast_ari_record_channel_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_record_channel(headers, &args, response);
+ ast_ari_record_channel(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_live_recording(
+ is_valid = ast_ari_validate_live_recording(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/record\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/record\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_channel_var_cb(
+static void ast_ari_get_channel_var_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_channel_var(headers, &args, response);
+ ast_ari_get_channel_var(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_variable(
+ is_valid = ast_ari_validate_variable(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_set_channel_var_cb(
+static void ast_ari_set_channel_var_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_set_channel_var(headers, &args, response);
+ ast_ari_set_channel_var(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /channels/{channelId}/variable\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /channels/{channelId}/variable\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
static struct stasis_rest_handlers channels_channelId_dial = {
.path_segment = "dial",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_dial_cb,
+ [AST_HTTP_POST] = ast_ari_dial_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_continue = {
.path_segment = "continue",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_continue_in_dialplan_cb,
+ [AST_HTTP_POST] = ast_ari_continue_in_dialplan_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_answer = {
.path_segment = "answer",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_answer_channel_cb,
+ [AST_HTTP_POST] = ast_ari_answer_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_mute = {
.path_segment = "mute",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_mute_channel_cb,
+ [AST_HTTP_POST] = ast_ari_mute_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_unmute = {
.path_segment = "unmute",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_unmute_channel_cb,
+ [AST_HTTP_POST] = ast_ari_unmute_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_hold = {
.path_segment = "hold",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_hold_channel_cb,
+ [AST_HTTP_POST] = ast_ari_hold_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_unhold = {
.path_segment = "unhold",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_unhold_channel_cb,
+ [AST_HTTP_POST] = ast_ari_unhold_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_mohstart = {
.path_segment = "mohstart",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_moh_start_channel_cb,
+ [AST_HTTP_POST] = ast_ari_moh_start_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_mohstop = {
.path_segment = "mohstop",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_moh_stop_channel_cb,
+ [AST_HTTP_POST] = ast_ari_moh_stop_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_play = {
.path_segment = "play",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_play_on_channel_cb,
+ [AST_HTTP_POST] = ast_ari_play_on_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_record = {
.path_segment = "record",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_record_channel_cb,
+ [AST_HTTP_POST] = ast_ari_record_channel_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers channels_channelId_variable = {
.path_segment = "variable",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_channel_var_cb,
- [AST_HTTP_POST] = stasis_http_set_channel_var_cb,
+ [AST_HTTP_GET] = ast_ari_get_channel_var_cb,
+ [AST_HTTP_POST] = ast_ari_set_channel_var_cb,
},
.num_children = 0,
.children = { }
.path_segment = "channelId",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_channel_cb,
- [AST_HTTP_DELETE] = stasis_http_delete_channel_cb,
+ [AST_HTTP_GET] = ast_ari_get_channel_cb,
+ [AST_HTTP_DELETE] = ast_ari_delete_channel_cb,
},
.num_children = 12,
.children = { &channels_channelId_dial,&channels_channelId_continue,&channels_channelId_answer,&channels_channelId_mute,&channels_channelId_unmute,&channels_channelId_hold,&channels_channelId_unhold,&channels_channelId_mohstart,&channels_channelId_mohstop,&channels_channelId_play,&channels_channelId_record,&channels_channelId_variable, }
static struct stasis_rest_handlers channels = {
.path_segment = "channels",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_channels_cb,
- [AST_HTTP_POST] = stasis_http_originate_cb,
+ [AST_HTTP_GET] = ast_ari_get_channels_cb,
+ [AST_HTTP_POST] = ast_ari_originate_cb,
},
.num_children = 1,
.children = { &channels_channelId, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&channels);
+ res |= ast_ari_add_handler(&channels);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&channels);
+ ast_ari_remove_handler(&channels);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Channel resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_endpoints.h"
+#include "ari/resource_endpoints.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_endpoints_cb(
+static void ast_ari_get_endpoints_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
struct ast_get_endpoints_args args = {};
- stasis_http_get_endpoints(headers, &args, response);
+ ast_ari_get_endpoints(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_endpoint_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_endpoint_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /endpoints\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /endpoints\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_endpoints_by_tech_cb(
+static void ast_ari_get_endpoints_by_tech_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_endpoints_by_tech(headers, &args, response);
+ ast_ari_get_endpoints_by_tech(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_endpoint_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_endpoint_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_endpoint_cb(
+static void ast_ari_get_endpoint_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_endpoint(headers, &args, response);
+ ast_ari_get_endpoint(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_endpoint(
+ is_valid = ast_ari_validate_endpoint(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /endpoints/{tech}/{resource}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /endpoints/{tech}/{resource}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
.path_segment = "resource",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_endpoint_cb,
+ [AST_HTTP_GET] = ast_ari_get_endpoint_cb,
},
.num_children = 0,
.children = { }
.path_segment = "tech",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_endpoints_by_tech_cb,
+ [AST_HTTP_GET] = ast_ari_get_endpoints_by_tech_cb,
},
.num_children = 1,
.children = { &endpoints_tech_resource, }
static struct stasis_rest_handlers endpoints = {
.path_segment = "endpoints",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_endpoints_cb,
+ [AST_HTTP_GET] = ast_ari_get_endpoints_cb,
},
.num_children = 1,
.children = { &endpoints_tech, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&endpoints);
+ res |= ast_ari_add_handler(&endpoints);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&endpoints);
+ ast_ari_remove_handler(&endpoints);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Endpoint resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_events.h"
+#include "ari/resource_events.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
-static void stasis_http_event_websocket_ws_cb(struct ast_websocket *ws_session,
+static void ast_ari_event_websocket_ws_cb(struct ast_websocket *ws_session,
struct ast_variable *get_params, struct ast_variable *headers)
{
RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
- RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_websocket_session *, session, NULL, ao2_cleanup);
struct ast_event_websocket_args args = {};
struct ast_variable *i;
{}
}
#if defined(AST_DEVMODE)
- session = ari_websocket_session_create(ws_session,
- ari_validate_message_fn());
+ session = ast_ari_websocket_session_create(ws_session,
+ ast_ari_validate_message_fn());
#else
- session = ari_websocket_session_create(ws_session, NULL);
+ session = ast_ari_websocket_session_create(ws_session, NULL);
#endif
if (!session) {
ast_log(LOG_ERROR, "Failed to create ARI session\n");
return;
}
- ari_websocket_event_websocket(session, headers, &args);
+ ast_ari_websocket_event_websocket(session, headers, &args);
}
/*! \brief REST handler for /api-docs/events.{format} */
return AST_MODULE_LOAD_FAILURE;
}
res |= ast_websocket_server_add_protocol(events.ws_server,
- "ari", stasis_http_event_websocket_ws_cb);
+ "ari", ast_ari_event_websocket_ws_cb);
stasis_app_ref();
- res |= stasis_http_add_handler(&events);
+ res |= ast_ari_add_handler(&events);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&events);
+ ast_ari_remove_handler(&events);
ao2_cleanup(events.ws_server);
events.ws_server = NULL;
stasis_app_unref();
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - WebSocket resource",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
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"
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) {
}
}
-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;
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;
{
global:
- LINKER_SYMBOL_PREFIXari_*;
+ LINKER_SYMBOL_PREFIXast_ari_*;
local:
*;
};
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_playback.h"
+#include "ari/resource_playback.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_playback_cb(
+static void ast_ari_get_playback_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_playback(headers, &args, response);
+ ast_ari_get_playback(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_playback(
+ is_valid = ast_ari_validate_playback(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_stop_playback_cb(
+static void ast_ari_stop_playback_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_stop_playback(headers, &args, response);
+ ast_ari_stop_playback(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_playback(
+ is_valid = ast_ari_validate_playback(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_control_playback_cb(
+static void ast_ari_control_playback_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_control_playback(headers, &args, response);
+ ast_ari_control_playback(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}/control\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}/control\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
static struct stasis_rest_handlers playback_playbackId_control = {
.path_segment = "control",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_control_playback_cb,
+ [AST_HTTP_POST] = ast_ari_control_playback_cb,
},
.num_children = 0,
.children = { }
.path_segment = "playbackId",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_playback_cb,
- [AST_HTTP_DELETE] = stasis_http_stop_playback_cb,
+ [AST_HTTP_GET] = ast_ari_get_playback_cb,
+ [AST_HTTP_DELETE] = ast_ari_stop_playback_cb,
},
.num_children = 1,
.children = { &playback_playbackId_control, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&playback);
+ res |= ast_ari_add_handler(&playback);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&playback);
+ ast_ari_remove_handler(&playback);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Playback control resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_recordings.h"
+#include "ari/resource_recordings.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_stored_recordings_cb(
+static void ast_ari_get_stored_recordings_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
struct ast_get_stored_recordings_args args = {};
- stasis_http_get_stored_recordings(headers, &args, response);
+ ast_ari_get_stored_recordings(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_stored_recording_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_stored_recording_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/stored\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_stored_recording_cb(
+static void ast_ari_get_stored_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_stored_recording(headers, &args, response);
+ ast_ari_get_stored_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_stored_recording(
+ is_valid = ast_ari_validate_stored_recording(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_delete_stored_recording_cb(
+static void ast_ari_delete_stored_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_delete_stored_recording(headers, &args, response);
+ ast_ari_delete_stored_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_live_recordings_cb(
+static void ast_ari_get_live_recordings_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
struct ast_get_live_recordings_args args = {};
- stasis_http_get_live_recordings(headers, &args, response);
+ ast_ari_get_live_recordings(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_live_recording_fn());
+ 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");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_live_recording_cb(
+static void ast_ari_get_live_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_live_recording(headers, &args, response);
+ ast_ari_get_live_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_live_recording(
+ is_valid = ast_ari_validate_live_recording(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_cancel_recording_cb(
+static void ast_ari_cancel_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_cancel_recording(headers, &args, response);
+ ast_ari_cancel_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_stop_recording_cb(
+static void ast_ari_stop_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_stop_recording(headers, &args, response);
+ ast_ari_stop_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/stop\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/stop\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_pause_recording_cb(
+static void ast_ari_pause_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_pause_recording(headers, &args, response);
+ ast_ari_pause_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/pause\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/pause\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_unpause_recording_cb(
+static void ast_ari_unpause_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_unpause_recording(headers, &args, response);
+ ast_ari_unpause_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/unpause\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/unpause\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_mute_recording_cb(
+static void ast_ari_mute_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_mute_recording(headers, &args, response);
+ ast_ari_mute_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/mute\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/mute\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_unmute_recording_cb(
+static void ast_ari_unmute_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_unmute_recording(headers, &args, response);
+ ast_ari_unmute_recording(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_void(
+ is_valid = ast_ari_validate_void(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/unmute\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/unmute\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
.path_segment = "recordingName",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_stored_recording_cb,
- [AST_HTTP_DELETE] = stasis_http_delete_stored_recording_cb,
+ [AST_HTTP_GET] = ast_ari_get_stored_recording_cb,
+ [AST_HTTP_DELETE] = ast_ari_delete_stored_recording_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers recordings_stored = {
.path_segment = "stored",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_stored_recordings_cb,
+ [AST_HTTP_GET] = ast_ari_get_stored_recordings_cb,
},
.num_children = 1,
.children = { &recordings_stored_recordingName, }
static struct stasis_rest_handlers recordings_live_recordingName_stop = {
.path_segment = "stop",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_stop_recording_cb,
+ [AST_HTTP_POST] = ast_ari_stop_recording_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers recordings_live_recordingName_pause = {
.path_segment = "pause",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_pause_recording_cb,
+ [AST_HTTP_POST] = ast_ari_pause_recording_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers recordings_live_recordingName_unpause = {
.path_segment = "unpause",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_unpause_recording_cb,
+ [AST_HTTP_POST] = ast_ari_unpause_recording_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers recordings_live_recordingName_mute = {
.path_segment = "mute",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_mute_recording_cb,
+ [AST_HTTP_POST] = ast_ari_mute_recording_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers recordings_live_recordingName_unmute = {
.path_segment = "unmute",
.callbacks = {
- [AST_HTTP_POST] = stasis_http_unmute_recording_cb,
+ [AST_HTTP_POST] = ast_ari_unmute_recording_cb,
},
.num_children = 0,
.children = { }
.path_segment = "recordingName",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_live_recording_cb,
- [AST_HTTP_DELETE] = stasis_http_cancel_recording_cb,
+ [AST_HTTP_GET] = ast_ari_get_live_recording_cb,
+ [AST_HTTP_DELETE] = ast_ari_cancel_recording_cb,
},
.num_children = 5,
.children = { &recordings_live_recordingName_stop,&recordings_live_recordingName_pause,&recordings_live_recordingName_unpause,&recordings_live_recordingName_mute,&recordings_live_recordingName_unmute, }
static struct stasis_rest_handlers recordings_live = {
.path_segment = "live",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_live_recordings_cb,
+ [AST_HTTP_GET] = ast_ari_get_live_recordings_cb,
},
.num_children = 1,
.children = { &recordings_live_recordingName, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&recordings);
+ res |= ast_ari_add_handler(&recordings);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&recordings);
+ ast_ari_remove_handler(&recordings);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Recording resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
* !!!!! DO NOT EDIT !!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_sounds.h"
+#include "ari/resource_sounds.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
/*!
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_sounds_cb(
+static void ast_ari_get_sounds_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_sounds(headers, &args, response);
+ ast_ari_get_sounds(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_list(response->message,
- ari_validate_sound_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_sound_fn());
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /sounds\n", code);
is_valid = 0;
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /sounds\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_get_stored_sound_cb(
+static void ast_ari_get_stored_sound_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
} else
{}
}
- stasis_http_get_stored_sound(headers, &args, response);
+ ast_ari_get_stored_sound(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
break;
default:
if (200 <= code && code <= 299) {
- is_valid = ari_validate_sound(
+ is_valid = ast_ari_validate_sound(
response->message);
} else {
ast_log(LOG_ERROR, "Invalid error response %d for /sounds/{soundId}\n", code);
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for /sounds/{soundId}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
.path_segment = "soundId",
.is_wildcard = 1,
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_stored_sound_cb,
+ [AST_HTTP_GET] = ast_ari_get_stored_sound_cb,
},
.num_children = 0,
.children = { }
static struct stasis_rest_handlers sounds = {
.path_segment = "sounds",
.callbacks = {
- [AST_HTTP_GET] = stasis_http_get_sounds_cb,
+ [AST_HTTP_GET] = ast_ari_get_sounds_cb,
},
.num_children = 1,
.children = { &sounds_soundId, }
{
int res = 0;
stasis_app_ref();
- res |= stasis_http_add_handler(&sounds);
+ res |= ast_ari_add_handler(&sounds);
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&sounds);
+ ast_ari_remove_handler(&sounds);
stasis_app_unref();
return 0;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - Sound resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
+++ /dev/null
-{
- global:
- LINKER_SYMBOL_PREFIXstasis_http_*;
- LINKER_SYMBOL_PREFIXari_*;
- local:
- *;
-};
<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>
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,
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;
+++ /dev/null
-#
-# Asterisk -- A telephony toolkit for Linux.
-#
-# Generated Makefile for res_stasis_http dependencies.
-#
-# Copyright (C) 2013, Digium, Inc.
-#
-# This program is free software, distributed under the terms of
-# the GNU General Public License
-#
-
-#
-# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# !!!!! DO NOT EDIT !!!!!
-# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-# This file is generated by a template. Please see the original template at
-# rest-api-templates/stasis_http.make.mustache
-#
-
-res_stasis_http_asterisk.so: stasis_http/resource_asterisk.o
-
-stasis_http/resource_asterisk.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_asterisk)
-
-res_stasis_http_endpoints.so: stasis_http/resource_endpoints.o
-
-stasis_http/resource_endpoints.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_endpoints)
-
-res_stasis_http_channels.so: stasis_http/resource_channels.o
-
-stasis_http/resource_channels.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_channels)
-
-res_stasis_http_bridges.so: stasis_http/resource_bridges.o
-
-stasis_http/resource_bridges.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_bridges)
-
-res_stasis_http_recordings.so: stasis_http/resource_recordings.o
-
-stasis_http/resource_recordings.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_recordings)
-
-res_stasis_http_sounds.so: stasis_http/resource_sounds.o
-
-stasis_http/resource_sounds.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_sounds)
-
-res_stasis_http_playback.so: stasis_http/resource_playback.o
-
-stasis_http/resource_playback.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_playback)
-
-res_stasis_http_events.so: stasis_http/resource_events.o
-
-stasis_http/resource_events.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_events)
-
+++ /dev/null
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2012 - 2013, Digium, Inc.
- *
- * David M. Lee, II <dlee@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief /api-docs/recordings.{format} implementation- Recording resources
- *
- * \author David M. Lee, II <dlee@digium.com>
- */
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/stasis_app_recording.h"
-#include "resource_recordings.h"
-
-void stasis_http_get_stored_recordings(struct ast_variable *headers, struct ast_get_stored_recordings_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_get_stored_recordings\n");
-}
-void stasis_http_get_stored_recording(struct ast_variable *headers, struct ast_get_stored_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_get_stored_recording\n");
-}
-void stasis_http_delete_stored_recording(struct ast_variable *headers, struct ast_delete_stored_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_delete_stored_recording\n");
-}
-void stasis_http_get_live_recordings(struct ast_variable *headers, struct ast_get_live_recordings_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_get_live_recordings\n");
-}
-
-void stasis_http_get_live_recording(struct ast_variable *headers,
- struct ast_get_live_recording_args *args,
- struct stasis_http_response *response)
-{
- RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
- RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
-
- recording = stasis_app_recording_find_by_name(args->recording_name);
- if (recording == NULL) {
- stasis_http_response_error(response, 404, "Not Found",
- "Recording not found");
- return;
- }
-
- json = stasis_app_recording_to_json(recording);
- if (json == NULL) {
- stasis_http_response_error(response, 500,
- "Internal Server Error", "Error building response");
- return;
- }
-
- stasis_http_response_ok(response, ast_json_ref(json));
-}
-
-void stasis_http_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_cancel_recording\n");
-}
-void stasis_http_stop_recording(struct ast_variable *headers, struct ast_stop_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_stop_recording\n");
-}
-void stasis_http_pause_recording(struct ast_variable *headers, struct ast_pause_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_pause_recording\n");
-}
-void stasis_http_unpause_recording(struct ast_variable *headers, struct ast_unpause_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_unpause_recording\n");
-}
-void stasis_http_mute_recording(struct ast_variable *headers, struct ast_mute_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_mute_recording\n");
-}
-void stasis_http_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct stasis_http_response *response)
-{
- ast_log(LOG_ERROR, "TODO: stasis_http_unmute_recording\n");
-}
#
# Asterisk -- A telephony toolkit for Linux.
#
-# Generated Makefile for res_stasis_http dependencies.
+# Generated Makefile for res_ari dependencies.
#
# Copyright (C) 2013, Digium, Inc.
#
# !!!!! DO NOT EDIT !!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# This file is generated by a template. Please see the original template at
-# rest-api-templates/stasis_http.make.mustache
+# rest-api-templates/ari.make.mustache
#
{{#apis}}
-res_stasis_http_{{name}}.so: stasis_http/resource_{{name}}.o
+res_ari_{{name}}.so: ari/resource_{{name}}.o
-stasis_http/resource_{{name}}.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_{{name}})
+ari/resource_{{name}}.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_{{name}})
{{/apis}}
{{#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;
} else
{{#subtypes}}
if (strcmp("{{id}}", discriminator) == 0) {
- return ari_validate_{{c_id}}(json);
+ return ast_ari_validate_{{c_id}}(json);
} else
{{/subtypes}}
{
{{/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}}
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}}
* \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
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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.
* \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 *));
/*! @} */
* \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}}
{{#apis}}
{{#operations}}
{{#is_req}}
-void stasis_http_{{c_nickname}}(struct ast_variable *headers,
+void ast_ari_{{c_nickname}}(struct ast_variable *headers,
struct ast_{{c_nickname}}_args *args,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: stasis_http_{{c_nickname}}\n");
+ ast_log(LOG_ERROR, "TODO: ast_ari_{{c_nickname}}\n");
}
{{/is_req}}
{{#is_websocket}}
-void ari_websocket_{{c_nickname}}(struct ari_websocket_session *session,
+void ast_ari_websocket_{{c_nickname}}(struct ast_ari_websocket_session *session,
struct ast_variable *headers,
struct ast_{{c_nickname}}_args *args)
{
- ast_log(LOG_ERROR, "TODO: ari_websocket_{{c_nickname}}\n");
+ ast_log(LOG_ERROR, "TODO: ast_ari_websocket_{{c_nickname}}\n");
}
{{/is_websocket}}
{{/operations}}
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_{{name}}.c
+ * res/ari/resource_{{name}}.c
*
* {{{description}}}
*
/*
{{> do-not-edit}}
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_{{name_caps}}_H
#define _ASTERISK_RESOURCE_{{name_caps}}_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
{{#apis}}
{{#operations}}
-/*! \brief Argument struct for stasis_http_{{c_nickname}}() */
+/*! \brief Argument struct for ast_ari_{{c_nickname}}() */
struct ast_{{c_nickname}}_args {
{{#parameters}}
{{#description}}
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nickname}}_args *args, struct stasis_http_response *response);
+void ast_ari_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nickname}}_args *args, struct ast_ari_response *response);
{{/is_req}}
{{#is_websocket}}
/*!
* \param headers HTTP headers.
* \param args Swagger parameters.
*/
-void ari_websocket_{{c_nickname}}(struct ari_websocket_session *session, struct ast_variable *headers, struct ast_{{c_nickname}}_args *args);
+void ast_ari_websocket_{{c_nickname}}(struct ast_ari_websocket_session *session, struct ast_variable *headers, struct ast_{{c_nickname}}_args *args);
{{/is_websocket}}
{{/operations}}
{{/apis}}
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'),
]
/*
{{> do-not-edit}}
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_{{name}}.h"
+#include "ari/resource_{{name}}.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
{{#apis}}
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_{{c_nickname}}_cb(
+static void ast_ari_{{c_nickname}}_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
#endif /* AST_DEVMODE */
{{> param_parsing}}
- stasis_http_{{c_nickname}}(headers, &args, response);
+ ast_ari_{{c_nickname}}(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
if (200 <= code && code <= 299) {
{{#response_class}}
{{#is_list}}
- is_valid = ari_validate_list(response->message,
- ari_validate_{{c_singular_name}}_fn());
+ is_valid = ast_ari_validate_list(response->message,
+ ast_ari_validate_{{c_singular_name}}_fn());
{{/is_list}}
{{^is_list}}
- is_valid = ari_validate_{{c_name}}(
+ is_valid = ast_ari_validate_{{c_name}}(
response->message);
{{/is_list}}
{{/response_class}}
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for {{path}}\n");
- stasis_http_response_error(response, 500,
+ ast_ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
}
{{/is_req}}
{{#is_websocket}}
-static void stasis_http_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
+static void ast_ari_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
struct ast_variable *get_params, struct ast_variable *headers)
{
RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
- RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_ari_websocket_session *, session, NULL, ao2_cleanup);
{{#has_path_parameters}}
/* TODO: It's not immediately obvious how to pass path params through
* the websocket code to this callback. Not needed right now, so we'll
{{/has_path_parameters}}
{{> param_parsing}}
#if defined(AST_DEVMODE)
- session = ari_websocket_session_create(ws_session,
- ari_validate_{{response_class.c_name}}_fn());
+ session = ast_ari_websocket_session_create(ws_session,
+ ast_ari_validate_{{response_class.c_name}}_fn());
#else
- session = ari_websocket_session_create(ws_session, NULL);
+ session = ast_ari_websocket_session_create(ws_session, NULL);
#endif
if (!session) {
ast_log(LOG_ERROR, "Failed to create ARI session\n");
return;
}
- ari_websocket_{{c_nickname}}(session, headers, &args);
+ ast_ari_websocket_{{c_nickname}}(session, headers, &args);
}
{{/is_websocket}}
{{/operations}}
{{#operations}}
{{#is_websocket}}
res |= ast_websocket_server_add_protocol({{full_name}}.ws_server,
- "{{websocket_protocol}}", stasis_http_{{c_nickname}}_ws_cb);
+ "{{websocket_protocol}}", ast_ari_{{c_nickname}}_ws_cb);
{{/is_websocket}}
{{/operations}}
{{/apis}}
stasis_app_ref();
- res |= stasis_http_add_handler(&{{root_full_name}});
+ res |= ast_ari_add_handler(&{{root_full_name}});
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&{{root_full_name}});
+ ast_ari_remove_handler(&{{root_full_name}});
{{#apis}}
{{#has_websocket}}
ao2_cleanup({{full_name}}.ws_server);
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - {{{description}}}",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
{{/api_declaration}}
}}
{{!
* Recursive partial template to render a rest_handler. Used in
- * res_stasis_http_resource.c.mustache.
+ * res_ari_resource.c.mustache.
}}
{{#children}}
{{> rest_handler}}
.callbacks = {
{{#operations}}
{{#is_req}}
- [{{c_http_method}}] = stasis_http_{{c_nickname}}_cb,
+ [{{c_http_method}}] = ast_ari_{{c_nickname}}_cb,
{{/is_req}}
{{/operations}}
},
*/
/*!
- * \file \brief Test Stasis HTTP API.
+ * \file \brief Test ARI API.
* \author\verbatim David M. Lee, II <dlee@digium.com> \endverbatim
*
* \ingroup tests
/*** MODULEINFO
<depend>TEST_FRAMEWORK</depend>
- <depend>res_stasis_http</depend>
+ <depend>res_ari</depend>
<support_level>core</support_level>
***/
#include "asterisk/module.h"
#include "asterisk/test.h"
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
/*!@{*/
struct ast_variable *get_params,
struct ast_variable *path_vars,
struct ast_variable *headers,
- struct stasis_http_response *response)
+ struct ast_ari_response *response)
{
struct ast_json *message = ast_json_pack("{s: s, s: {}, s: {}, s: {}}",
"name", name,
static void name(struct ast_variable *get_params, \
struct ast_variable *path_vars, \
struct ast_variable *headers, \
- struct stasis_http_response *response) \
+ struct ast_ari_response *response) \
{ \
handler(#name, response_code, get_params, path_vars, headers, response); \
}
/*!
* \internal
- * \c stasis_http_response constructor.
+ * \c ast_ari_response constructor.
*/
-static struct stasis_http_response *response_alloc(void)
+static struct ast_ari_response *response_alloc(void)
{
- struct stasis_http_response *resp = ast_calloc(1, sizeof(struct stasis_http_response));
+ struct ast_ari_response *resp = ast_calloc(1, sizeof(struct ast_ari_response));
resp->headers = ast_str_create(24);
return resp;
}
/*!
* \internal
- * \c stasis_http_response destructor.
+ * \c ast_ari_response destructor.
*/
-static void response_free(struct stasis_http_response *resp)
+static void response_free(struct ast_ari_response *resp)
{
if (!resp) {
return;
static void *setup_invocation_test(void) {
int r;
invocation_count = 0;
- r = stasis_http_add_handler(&test_root);
+ r = ast_ari_add_handler(&test_root);
ast_assert(r == 0);
return &invocation_count;
}
if (!ignore) {
return;
}
- stasis_http_remove_handler(&test_root);
+ ast_ari_remove_handler(&test_root);
}
AST_TEST_DEFINE(get_docs)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_variable *, headers, NULL, ast_variables_destroy);
struct ast_json *basePathJson;
const char *basePath;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test simple API get.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
response = response_alloc();
headers = ast_variable_new("Host", "stasis.asterisk.org", __FILE__);
- stasis_http_get_docs("resources.json", headers, response);
+ ast_ari_get_docs("resources.json", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
AST_TEST_DEFINE(get_docs_nohost)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
struct ast_json *basePathJson;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test API get without a Host header";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
}
response = response_alloc();
- stasis_http_get_docs("resources.json", headers, response);
+ ast_ari_get_docs("resources.json", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
AST_TEST_DEFINE(get_docs_notfound)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test API get for invalid resource";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
}
response = response_alloc();
- stasis_http_get_docs("i-am-not-a-resource.json", headers, response);
+ ast_ari_get_docs("i-am-not-a-resource.json", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
AST_TEST_DEFINE(get_docs_hackerz)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test API get for a file outside the rest-api path";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
}
response = response_alloc();
- stasis_http_get_docs("../../../../sbin/asterisk", headers, response);
+ ast_ari_get_docs("../../../../sbin/asterisk", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
AST_TEST_DEFINE(invoke_get)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test simple GET of an HTTP resource.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
"head2", "head-two",
"path_vars");
- stasis_http_invoke(NULL, "foo", AST_HTTP_GET, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
AST_TEST_DEFINE(invoke_wildcard)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test GET of a wildcard resource.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
"path_vars",
"bam", "foshizzle");
- stasis_http_invoke(NULL, "foo/foshizzle", AST_HTTP_GET, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo/foshizzle", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
AST_TEST_DEFINE(invoke_delete)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test DELETE of an HTTP resource.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
"path_vars",
"bam", "foshizzle");
- stasis_http_invoke(NULL, "foo/foshizzle/bang", AST_HTTP_DELETE, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo/foshizzle/bang", AST_HTTP_DELETE, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 204 == response->response_code);
AST_TEST_DEFINE(invoke_post)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test POST of an HTTP resource.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
"head2", "head-two",
"path_vars");
- stasis_http_invoke(NULL, "foo/bar", AST_HTTP_POST, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo/bar", AST_HTTP_POST, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
AST_TEST_DEFINE(invoke_bad_post)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test POST on a resource that doesn't support it.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
fixture = setup_invocation_test();
response = response_alloc();
- stasis_http_invoke(NULL, "foo", AST_HTTP_POST, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo", AST_HTTP_POST, get_params, headers, response);
ast_test_validate(test, 0 == invocation_count);
ast_test_validate(test, 405 == response->response_code);
AST_TEST_DEFINE(invoke_not_found)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ast_ari_response *, response, NULL, response_free);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
switch (cmd) {
case TEST_INIT:
info->name = __func__;
- info->category = "/stasis/http/";
+ info->category = "/res/ari/";
info->summary = "Test GET on a resource that does not exist.";
- info->description = "Test Stasis HTTP binding logic.";
+ info->description = "Test ARI binding logic.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
fixture = setup_invocation_test();
response = response_alloc();
- stasis_http_invoke(NULL, "foo/fizzle/i-am-not-a-resource", AST_HTTP_GET, get_params, headers, response);
+ ast_ari_invoke(NULL, "foo/fizzle/i-am-not-a-resource", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 0 == invocation_count);
ast_test_validate(test, 404 == response->response_code);
return AST_MODULE_LOAD_SUCCESS;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Stasis HTTP testing",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ARI testing",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_ari",
);
#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)
{
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, !ast_ari_validate_byte(str));
- ast_test_validate(test, !ari_validate_byte(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_byte(ast_json_null()));
return AST_TEST_PASS;
}
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, !ast_ari_validate_boolean(str));
- ast_test_validate(test, !ari_validate_boolean(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_boolean(ast_json_null()));
return AST_TEST_PASS;
}
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, !ast_ari_validate_int(str));
- ast_test_validate(test, !ari_validate_int(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_int(ast_json_null()));
return AST_TEST_PASS;
}
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, !ast_ari_validate_long(str));
- ast_test_validate(test, !ari_validate_long(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_long(ast_json_null()));
return AST_TEST_PASS;
}
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, ast_ari_validate_string(uut));
- ast_test_validate(test, !ari_validate_string(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_string(ast_json_null()));
return AST_TEST_PASS;
}
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]);
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]);
}
}
- ast_test_validate(test, !ari_validate_string(ast_json_null()));
+ ast_test_validate(test, !ast_ari_validate_string(ast_json_null()));
return test_res;
}
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;
}