diff --git a/configs/ari.conf.sample b/configs/ari.conf.sample index 414f89d8f22514cf18209552598499c66d5d841d..decdddc5827b4d0c5e6d9972d14366644555c1aa 100644 --- a/configs/ari.conf.sample +++ b/configs/ari.conf.sample @@ -1,6 +1,6 @@ [general] -enabled = yes ; When set to no, stasis-http support is disabled. -;pretty = no ; When set to yes, responses from stasis-http are +enabled = yes ; When set to no, ARI support is disabled. +;pretty = no ; When set to yes, responses from ARI are ; ; formatted to be human readable. ;allowed_origins = ; Comma separated list of allowed origins, for ; ; Cross-Origin Resource Sharing. May be set to * to diff --git a/include/asterisk/stasis_http.h b/include/asterisk/ari.h similarity index 75% rename from include/asterisk/stasis_http.h rename to include/asterisk/ari.h index 8d5a74ee7a604986b239d80a1ace670512aab7d6..4f2954000ca9af2087d516261e224f7aad5d6002 100644 --- a/include/asterisk/stasis_http.h +++ b/include/asterisk/ari.h @@ -16,15 +16,15 @@ * 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> */ @@ -37,9 +37,9 @@ * \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. @@ -51,7 +51,7 @@ struct stasis_http_response; 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. @@ -79,7 +79,7 @@ struct stasis_rest_handlers { /*! * Response type for RESTful requests */ -struct stasis_http_response { +struct ast_ari_response { /*! Response message */ struct ast_json *message; /*! \r\n seperated response headers */ @@ -99,7 +99,7 @@ struct stasis_http_response { * \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. @@ -107,13 +107,13 @@ int stasis_http_add_handler(struct stasis_rest_handlers *handler); * \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. @@ -123,26 +123,26 @@ int stasis_http_remove_handler(struct stasis_rest_handlers *handler); * \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. @@ -155,7 +155,7 @@ struct 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 *)); /*! @@ -165,8 +165,8 @@ struct ari_websocket_session *ari_websocket_session_create( * \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. @@ -176,7 +176,7 @@ struct ast_json *ari_websocket_session_read( * \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); /*! @@ -187,45 +187,45 @@ int ari_websocket_session_write(struct ari_websocket_session *session, * * \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 */ diff --git a/main/stasis_config.c b/main/stasis_config.c index a4ab41a40badefe27a423df84f277382bbe03046..4906319667ff931063fdb77deef294310c83bcf6 100644 --- a/main/stasis_config.c +++ b/main/stasis_config.c @@ -70,7 +70,7 @@ struct stasis_conf { 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, diff --git a/res/Makefile b/res/Makefile index 588bc2e726f5968e91ae532c1578e76fcd3ca9e5..616ad4d7ecb98aff4fb9a29691326afeb7208204 100644 --- a/res/Makefile +++ b/res/Makefile @@ -73,18 +73,18 @@ endif 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 diff --git a/res/ari.make b/res/ari.make new file mode 100644 index 0000000000000000000000000000000000000000..fa562f1260dc0bb0cd7f8273597e01c0662e34cd --- /dev/null +++ b/res/ari.make @@ -0,0 +1,51 @@ +# +# 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) + diff --git a/res/stasis_http/ari_model_validators.c b/res/ari/ari_model_validators.c similarity index 83% rename from res/stasis_http/ari_model_validators.c rename to res/ari/ari_model_validators.c index bc5f25aea10956fa62f64ed8645e107b3e8c1481..1894ddb9af635a0a1840b3d42583d5a11ffb2f1b 100644 --- a/res/stasis_http/ari_model_validators.c +++ b/res/ari/ari_model_validators.c @@ -35,7 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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; @@ -52,12 +52,12 @@ int ari_validate_asterisk_info(struct ast_json *json) 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; @@ -67,7 +67,7 @@ int ari_validate_variable(struct ast_json *json) 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"); @@ -90,12 +90,12 @@ int ari_validate_variable(struct ast_json *json) 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; @@ -107,9 +107,9 @@ int ari_validate_endpoint(struct ast_json *json) 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; @@ -118,7 +118,7 @@ int ari_validate_endpoint(struct ast_json *json) 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"); @@ -127,7 +127,7 @@ int ari_validate_endpoint(struct ast_json *json) } 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"); @@ -137,7 +137,7 @@ int ari_validate_endpoint(struct ast_json *json) 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"); @@ -170,12 +170,12 @@ int ari_validate_endpoint(struct ast_json *json) 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; @@ -186,7 +186,7 @@ int ari_validate_caller_id(struct ast_json *json) 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"); @@ -196,7 +196,7 @@ int ari_validate_caller_id(struct ast_json *json) 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"); @@ -224,12 +224,12 @@ int ari_validate_caller_id(struct ast_json *json) 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; @@ -246,7 +246,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -256,7 +256,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -266,7 +266,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -276,7 +276,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -286,7 +286,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -296,7 +296,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -306,7 +306,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -316,7 +316,7 @@ int ari_validate_channel(struct ast_json *json) 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"); @@ -374,12 +374,12 @@ int ari_validate_channel(struct ast_json *json) 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; @@ -396,12 +396,12 @@ int ari_validate_dialed(struct ast_json *json) 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; @@ -413,7 +413,7 @@ int ari_validate_dialplan_cep(struct ast_json *json) 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"); @@ -423,7 +423,7 @@ int ari_validate_dialplan_cep(struct ast_json *json) 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"); @@ -433,7 +433,7 @@ int ari_validate_dialplan_cep(struct ast_json *json) 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"); @@ -466,12 +466,12 @@ int ari_validate_dialplan_cep(struct ast_json *json) 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; @@ -485,7 +485,7 @@ int ari_validate_bridge(struct ast_json *json) 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"); @@ -495,7 +495,7 @@ int ari_validate_bridge(struct ast_json *json) 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"); @@ -505,9 +505,9 @@ int ari_validate_bridge(struct ast_json *json) 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; @@ -516,7 +516,7 @@ int ari_validate_bridge(struct ast_json *json) 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"); @@ -526,7 +526,7 @@ int ari_validate_bridge(struct ast_json *json) 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"); @@ -569,12 +569,12 @@ int ari_validate_bridge(struct ast_json *json) 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; @@ -586,7 +586,7 @@ int ari_validate_live_recording(struct ast_json *json) 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"); @@ -596,7 +596,7 @@ int ari_validate_live_recording(struct ast_json *json) 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"); @@ -606,7 +606,7 @@ int ari_validate_live_recording(struct ast_json *json) 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"); @@ -639,12 +639,12 @@ int ari_validate_live_recording(struct ast_json *json) 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; @@ -654,7 +654,7 @@ int ari_validate_stored_recording(struct ast_json *json) 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"); @@ -664,9 +664,9 @@ int ari_validate_stored_recording(struct ast_json *json) 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; @@ -675,7 +675,7 @@ int ari_validate_stored_recording(struct ast_json *json) 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"); @@ -684,7 +684,7 @@ int ari_validate_stored_recording(struct ast_json *json) } 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"); @@ -712,12 +712,12 @@ int ari_validate_stored_recording(struct ast_json *json) 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; @@ -728,7 +728,7 @@ int ari_validate_format_lang_pair(struct ast_json *json) 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"); @@ -738,7 +738,7 @@ int ari_validate_format_lang_pair(struct ast_json *json) 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"); @@ -766,12 +766,12 @@ int ari_validate_format_lang_pair(struct ast_json *json) 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; @@ -782,9 +782,9 @@ int ari_validate_sound(struct ast_json *json) 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; @@ -793,7 +793,7 @@ int ari_validate_sound(struct ast_json *json) 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"); @@ -802,7 +802,7 @@ int ari_validate_sound(struct ast_json *json) } 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"); @@ -830,12 +830,12 @@ int ari_validate_sound(struct ast_json *json) 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; @@ -848,7 +848,7 @@ int ari_validate_playback(struct ast_json *json) 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"); @@ -857,7 +857,7 @@ int ari_validate_playback(struct ast_json *json) } 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"); @@ -867,7 +867,7 @@ int ari_validate_playback(struct ast_json *json) 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"); @@ -877,7 +877,7 @@ int ari_validate_playback(struct ast_json *json) 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"); @@ -887,7 +887,7 @@ int ari_validate_playback(struct ast_json *json) 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"); @@ -925,12 +925,12 @@ int ari_validate_playback(struct ast_json *json) 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; @@ -941,7 +941,7 @@ int ari_validate_application_replaced(struct ast_json *json) 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"); @@ -951,7 +951,7 @@ int ari_validate_application_replaced(struct ast_json *json) 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"); @@ -960,7 +960,7 @@ int ari_validate_application_replaced(struct ast_json *json) } 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"); @@ -988,12 +988,12 @@ int ari_validate_application_replaced(struct ast_json *json) 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; @@ -1005,7 +1005,7 @@ int ari_validate_bridge_created(struct ast_json *json) 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"); @@ -1015,7 +1015,7 @@ int ari_validate_bridge_created(struct ast_json *json) 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"); @@ -1024,7 +1024,7 @@ int ari_validate_bridge_created(struct ast_json *json) } 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"); @@ -1034,7 +1034,7 @@ int ari_validate_bridge_created(struct ast_json *json) 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"); @@ -1067,12 +1067,12 @@ int ari_validate_bridge_created(struct ast_json *json) 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; @@ -1084,7 +1084,7 @@ int ari_validate_bridge_destroyed(struct ast_json *json) 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"); @@ -1094,7 +1094,7 @@ int ari_validate_bridge_destroyed(struct ast_json *json) 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"); @@ -1103,7 +1103,7 @@ int ari_validate_bridge_destroyed(struct ast_json *json) } 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"); @@ -1113,7 +1113,7 @@ int ari_validate_bridge_destroyed(struct ast_json *json) 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"); @@ -1146,12 +1146,12 @@ int ari_validate_bridge_destroyed(struct ast_json *json) 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; @@ -1164,7 +1164,7 @@ int ari_validate_bridge_merged(struct ast_json *json) 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"); @@ -1174,7 +1174,7 @@ int ari_validate_bridge_merged(struct ast_json *json) 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"); @@ -1183,7 +1183,7 @@ int ari_validate_bridge_merged(struct ast_json *json) } 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"); @@ -1193,7 +1193,7 @@ int ari_validate_bridge_merged(struct ast_json *json) 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"); @@ -1203,7 +1203,7 @@ int ari_validate_bridge_merged(struct ast_json *json) 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"); @@ -1241,12 +1241,12 @@ int ari_validate_bridge_merged(struct ast_json *json) 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; @@ -1260,7 +1260,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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"); @@ -1270,7 +1270,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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"); @@ -1279,7 +1279,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) } 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"); @@ -1289,7 +1289,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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"); @@ -1299,7 +1299,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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"); @@ -1309,7 +1309,7 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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"); @@ -1352,12 +1352,12 @@ int ari_validate_channel_caller_id(struct ast_json *json) 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; @@ -1369,7 +1369,7 @@ int ari_validate_channel_created(struct ast_json *json) 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"); @@ -1379,7 +1379,7 @@ int ari_validate_channel_created(struct ast_json *json) 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"); @@ -1388,7 +1388,7 @@ int ari_validate_channel_created(struct ast_json *json) } 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"); @@ -1398,7 +1398,7 @@ int ari_validate_channel_created(struct ast_json *json) 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"); @@ -1431,12 +1431,12 @@ int ari_validate_channel_created(struct ast_json *json) 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; @@ -1450,7 +1450,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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"); @@ -1460,7 +1460,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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"); @@ -1469,7 +1469,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) } 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"); @@ -1479,7 +1479,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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"); @@ -1489,7 +1489,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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"); @@ -1499,7 +1499,7 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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"); @@ -1542,12 +1542,12 @@ int ari_validate_channel_destroyed(struct ast_json *json) 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; @@ -1561,7 +1561,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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"); @@ -1571,7 +1571,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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"); @@ -1580,7 +1580,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) } 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"); @@ -1590,7 +1590,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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"); @@ -1600,7 +1600,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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"); @@ -1610,7 +1610,7 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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"); @@ -1653,12 +1653,12 @@ int ari_validate_channel_dialplan(struct ast_json *json) 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; @@ -1672,7 +1672,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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"); @@ -1682,7 +1682,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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"); @@ -1691,7 +1691,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) } 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"); @@ -1701,7 +1701,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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"); @@ -1711,7 +1711,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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"); @@ -1721,7 +1721,7 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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"); @@ -1764,12 +1764,12 @@ int ari_validate_channel_dtmf_received(struct ast_json *json) 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; @@ -1781,7 +1781,7 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) 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"); @@ -1791,7 +1791,7 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) 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"); @@ -1800,7 +1800,7 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) } 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"); @@ -1810,7 +1810,7 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) 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"); @@ -1819,7 +1819,7 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) } 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"); @@ -1852,12 +1852,12 @@ int ari_validate_channel_entered_bridge(struct ast_json *json) 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; @@ -1869,7 +1869,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) 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"); @@ -1879,7 +1879,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) 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"); @@ -1888,7 +1888,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) } 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"); @@ -1897,7 +1897,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) } 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"); @@ -1907,7 +1907,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) 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"); @@ -1916,7 +1916,7 @@ int ari_validate_channel_hangup_request(struct ast_json *json) } 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"); @@ -1949,12 +1949,12 @@ int ari_validate_channel_hangup_request(struct ast_json *json) 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; @@ -1967,7 +1967,7 @@ int ari_validate_channel_left_bridge(struct ast_json *json) 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"); @@ -1977,7 +1977,7 @@ int ari_validate_channel_left_bridge(struct ast_json *json) 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"); @@ -1986,7 +1986,7 @@ int ari_validate_channel_left_bridge(struct ast_json *json) } 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"); @@ -1996,7 +1996,7 @@ int ari_validate_channel_left_bridge(struct ast_json *json) 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"); @@ -2006,7 +2006,7 @@ int ari_validate_channel_left_bridge(struct ast_json *json) 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"); @@ -2044,12 +2044,12 @@ int ari_validate_channel_left_bridge(struct ast_json *json) 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; @@ -2061,7 +2061,7 @@ int ari_validate_channel_state_change(struct ast_json *json) 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"); @@ -2071,7 +2071,7 @@ int ari_validate_channel_state_change(struct ast_json *json) 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"); @@ -2080,7 +2080,7 @@ int ari_validate_channel_state_change(struct ast_json *json) } 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"); @@ -2090,7 +2090,7 @@ int ari_validate_channel_state_change(struct ast_json *json) 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"); @@ -2123,12 +2123,12 @@ int ari_validate_channel_state_change(struct ast_json *json) 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; @@ -2141,7 +2141,7 @@ int ari_validate_channel_userevent(struct ast_json *json) 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"); @@ -2151,7 +2151,7 @@ int ari_validate_channel_userevent(struct ast_json *json) 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"); @@ -2160,7 +2160,7 @@ int ari_validate_channel_userevent(struct ast_json *json) } 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"); @@ -2170,7 +2170,7 @@ int ari_validate_channel_userevent(struct ast_json *json) 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"); @@ -2180,7 +2180,7 @@ int ari_validate_channel_userevent(struct ast_json *json) 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"); @@ -2218,12 +2218,12 @@ int ari_validate_channel_userevent(struct ast_json *json) 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; @@ -2236,7 +2236,7 @@ int ari_validate_channel_varset(struct ast_json *json) 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"); @@ -2246,7 +2246,7 @@ int ari_validate_channel_varset(struct ast_json *json) 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"); @@ -2255,7 +2255,7 @@ int ari_validate_channel_varset(struct ast_json *json) } 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"); @@ -2264,7 +2264,7 @@ int ari_validate_channel_varset(struct ast_json *json) } 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"); @@ -2274,7 +2274,7 @@ int ari_validate_channel_varset(struct ast_json *json) 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"); @@ -2284,7 +2284,7 @@ int ari_validate_channel_varset(struct ast_json *json) 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"); @@ -2322,12 +2322,12 @@ int ari_validate_channel_varset(struct ast_json *json) 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; @@ -2345,61 +2345,61 @@ int ari_validate_event(struct ast_json *json) /* 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", @@ -2411,7 +2411,7 @@ int ari_validate_event(struct ast_json *json) 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"); @@ -2421,7 +2421,7 @@ int ari_validate_event(struct ast_json *json) 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"); @@ -2430,7 +2430,7 @@ int ari_validate_event(struct ast_json *json) } 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"); @@ -2458,12 +2458,12 @@ int ari_validate_event(struct ast_json *json) 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; @@ -2480,67 +2480,67 @@ int ari_validate_message(struct ast_json *json) /* 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", @@ -2552,7 +2552,7 @@ int ari_validate_message(struct ast_json *json) 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"); @@ -2575,12 +2575,12 @@ int ari_validate_message(struct ast_json *json) 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; @@ -2591,7 +2591,7 @@ int ari_validate_missing_params(struct ast_json *json) 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"); @@ -2601,9 +2601,9 @@ int ari_validate_missing_params(struct ast_json *json) 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; @@ -2630,12 +2630,12 @@ int ari_validate_missing_params(struct ast_json *json) 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; @@ -2647,7 +2647,7 @@ int ari_validate_playback_finished(struct ast_json *json) 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"); @@ -2657,7 +2657,7 @@ int ari_validate_playback_finished(struct ast_json *json) 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"); @@ -2666,7 +2666,7 @@ int ari_validate_playback_finished(struct ast_json *json) } 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"); @@ -2676,7 +2676,7 @@ int ari_validate_playback_finished(struct ast_json *json) 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"); @@ -2709,12 +2709,12 @@ int ari_validate_playback_finished(struct ast_json *json) 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; @@ -2726,7 +2726,7 @@ int ari_validate_playback_started(struct ast_json *json) 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"); @@ -2736,7 +2736,7 @@ int ari_validate_playback_started(struct ast_json *json) 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"); @@ -2745,7 +2745,7 @@ int ari_validate_playback_started(struct ast_json *json) } 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"); @@ -2755,7 +2755,7 @@ int ari_validate_playback_started(struct ast_json *json) 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"); @@ -2788,12 +2788,12 @@ int ari_validate_playback_started(struct ast_json *json) 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; @@ -2805,7 +2805,7 @@ int ari_validate_stasis_end(struct ast_json *json) 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"); @@ -2815,7 +2815,7 @@ int ari_validate_stasis_end(struct ast_json *json) 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"); @@ -2824,7 +2824,7 @@ int ari_validate_stasis_end(struct ast_json *json) } 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"); @@ -2834,7 +2834,7 @@ int ari_validate_stasis_end(struct ast_json *json) 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"); @@ -2867,12 +2867,12 @@ int ari_validate_stasis_end(struct ast_json *json) 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; @@ -2885,7 +2885,7 @@ int ari_validate_stasis_start(struct ast_json *json) 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"); @@ -2895,7 +2895,7 @@ int ari_validate_stasis_start(struct ast_json *json) 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"); @@ -2904,7 +2904,7 @@ int ari_validate_stasis_start(struct ast_json *json) } 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"); @@ -2914,9 +2914,9 @@ int ari_validate_stasis_start(struct ast_json *json) 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; @@ -2925,7 +2925,7 @@ int ari_validate_stasis_start(struct ast_json *json) 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"); @@ -2963,7 +2963,7 @@ int ari_validate_stasis_start(struct ast_json *json) 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; } diff --git a/res/stasis_http/ari_model_validators.h b/res/ari/ari_model_validators.h similarity index 65% rename from res/stasis_http/ari_model_validators.h rename to res/ari/ari_model_validators.h index 3cf6300203de73034fb2a95442c2eaf9662263db..c5e74d21a7a888b542d89e06684a208ea5cefb58 100644 --- a/res/stasis_http/ari_model_validators.h +++ b/res/ari/ari_model_validators.h @@ -19,7 +19,7 @@ * \brief Generated file - Build validators for ARI model objects. * * In addition to the normal validation functions one would normally expect, - * each validator has a ari_validate_{id}_fn() companion function that returns + * each validator has a ast_ari_validate_{id}_fn() companion function that returns * the validator's function pointer. * * The reason for this seamingly useless indirection is the way function @@ -52,7 +52,7 @@ * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_void(struct ast_json *json); +int ast_ari_validate_void(struct ast_json *json); /*! * \brief Validator for native Swagger byte. @@ -61,7 +61,7 @@ int ari_validate_void(struct ast_json *json); * \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. @@ -70,7 +70,7 @@ int ari_validate_byte(struct ast_json *json); * \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. @@ -79,7 +79,7 @@ int ari_validate_boolean(struct ast_json *json); * \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. @@ -88,7 +88,7 @@ int ari_validate_int(struct ast_json *json); * \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. @@ -97,7 +97,7 @@ int ari_validate_long(struct ast_json *json); * \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. @@ -106,7 +106,7 @@ int ari_validate_float(struct ast_json *json); * \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. @@ -115,7 +115,7 @@ int ari_validate_double(struct ast_json *json); * \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. @@ -124,7 +124,7 @@ int ari_validate_string(struct ast_json *json); * \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. @@ -134,7 +134,7 @@ int ari_validate_date(struct ast_json *json); * \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 *)); /*! @} */ @@ -152,14 +152,14 @@ typedef int (*ari_validator)(struct ast_json *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. @@ -170,14 +170,14 @@ ari_validator ari_validate_asterisk_info_fn(void); * \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. @@ -190,14 +190,14 @@ ari_validator ari_validate_variable_fn(void); * \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. @@ -208,14 +208,14 @@ ari_validator ari_validate_endpoint_fn(void); * \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. @@ -226,14 +226,14 @@ ari_validator ari_validate_caller_id_fn(void); * \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. @@ -244,14 +244,14 @@ ari_validator ari_validate_channel_fn(void); * \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. @@ -262,14 +262,14 @@ ari_validator ari_validate_dialed_fn(void); * \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. @@ -282,14 +282,14 @@ ari_validator ari_validate_dialplan_cep_fn(void); * \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. @@ -300,14 +300,14 @@ ari_validator ari_validate_bridge_fn(void); * \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. @@ -318,14 +318,14 @@ ari_validator ari_validate_live_recording_fn(void); * \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. @@ -336,14 +336,14 @@ ari_validator ari_validate_stored_recording_fn(void); * \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. @@ -354,14 +354,14 @@ ari_validator ari_validate_format_lang_pair_fn(void); * \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. @@ -372,14 +372,14 @@ ari_validator ari_validate_sound_fn(void); * \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. @@ -392,14 +392,14 @@ ari_validator ari_validate_playback_fn(void); * \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. @@ -410,14 +410,14 @@ ari_validator ari_validate_application_replaced_fn(void); * \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. @@ -428,14 +428,14 @@ ari_validator ari_validate_bridge_created_fn(void); * \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. @@ -446,14 +446,14 @@ ari_validator ari_validate_bridge_destroyed_fn(void); * \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. @@ -464,14 +464,14 @@ ari_validator ari_validate_bridge_merged_fn(void); * \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. @@ -482,14 +482,14 @@ ari_validator ari_validate_channel_caller_id_fn(void); * \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. @@ -500,14 +500,14 @@ ari_validator ari_validate_channel_created_fn(void); * \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. @@ -518,14 +518,14 @@ ari_validator ari_validate_channel_destroyed_fn(void); * \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. @@ -538,14 +538,14 @@ ari_validator ari_validate_channel_dialplan_fn(void); * \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. @@ -556,14 +556,14 @@ ari_validator ari_validate_channel_dtmf_received_fn(void); * \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. @@ -574,14 +574,14 @@ ari_validator ari_validate_channel_entered_bridge_fn(void); * \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. @@ -592,14 +592,14 @@ ari_validator ari_validate_channel_hangup_request_fn(void); * \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. @@ -610,14 +610,14 @@ ari_validator ari_validate_channel_left_bridge_fn(void); * \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. @@ -628,14 +628,14 @@ ari_validator ari_validate_channel_state_change_fn(void); * \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. @@ -646,14 +646,14 @@ ari_validator ari_validate_channel_userevent_fn(void); * \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. @@ -664,14 +664,14 @@ ari_validator ari_validate_channel_varset_fn(void); * \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. @@ -682,14 +682,14 @@ ari_validator ari_validate_event_fn(void); * \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. @@ -700,14 +700,14 @@ ari_validator ari_validate_message_fn(void); * \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. @@ -718,14 +718,14 @@ ari_validator ari_validate_missing_params_fn(void); * \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. @@ -736,14 +736,14 @@ ari_validator ari_validate_playback_finished_fn(void); * \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. @@ -754,14 +754,14 @@ ari_validator ari_validate_playback_started_fn(void); * \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. @@ -772,14 +772,14 @@ ari_validator ari_validate_stasis_end_fn(void); * \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 diff --git a/res/stasis_http/ari_websockets.c b/res/ari/ari_websockets.c similarity index 87% rename from res/stasis_http/ari_websockets.c rename to res/ari/ari_websockets.c index c67ace5ff713b1392106a4d483c3c065f57086c0..13650c29304aa0c5176358a9f2adf7944362049b 100644 --- a/res/stasis_http/ari_websockets.c +++ b/res/ari/ari_websockets.c @@ -21,7 +21,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/astobj2.h" -#include "asterisk/stasis_http.h" +#include "asterisk/ari.h" /*! \file * @@ -29,14 +29,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -50,10 +50,10 @@ static int null_validator(struct ast_json *json) 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; @@ -83,8 +83,8 @@ struct ari_websocket_session *ari_websocket_session_create( 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); @@ -139,7 +139,7 @@ struct ast_json *ari_websocket_session_read( " \"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); @@ -153,7 +153,7 @@ int ari_websocket_session_write(struct ari_websocket_session *session, } #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"); diff --git a/res/stasis_http/cli.c b/res/ari/cli.c similarity index 90% rename from res/stasis_http/cli.c rename to res/ari/cli.c index ac974dc148e8e7a0a79b65b7268b3363da9794a5..819407997f9a90e5f6429345ea1f0fceedd6734c 100644 --- a/res/stasis_http/cli.c +++ b/res/ari/cli.c @@ -32,7 +32,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") 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: @@ -51,7 +51,7 @@ static char *ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) return CLI_SHOWUSAGE; } - conf = ari_config_get(); + conf = ast_ari_config_get(); if (!conf) { ast_cli(a->fd, "Error getting ARI configuration\n"); @@ -78,7 +78,7 @@ static char *ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) 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", @@ -90,7 +90,7 @@ static int show_users_cb(void *obj, void *arg, int flags) 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: @@ -109,7 +109,7 @@ static char *ari_show_users(struct ast_cli_entry *e, int cmd, 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; @@ -142,14 +142,14 @@ static int complete_ari_user_search(void *obj, void *arg, void *data, int flags) 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; @@ -173,8 +173,8 @@ static char *complete_ari_show_user(struct ast_cli_args *a) 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: @@ -193,7 +193,7 @@ static char *ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args return CLI_SHOWUSAGE; } - conf = ari_config_get(); + conf = ast_ari_config_get(); if (!conf) { ast_cli(a->fd, "Error getting ARI configuration\n"); @@ -258,10 +258,10 @@ static struct ast_cli_entry cli_ari[] = { 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)); } diff --git a/res/stasis_http/config.c b/res/ari/config.c similarity index 80% rename from res/stasis_http/config.c rename to res/ari/config.c index 7ccfe8e591eba81b26dd8a6e47a66b7a661e84e7..e25fa8ad1f362eb131365974f2811a18f9619193 100644 --- a/res/stasis_http/config.c +++ b/res/ari/config.c @@ -32,12 +32,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /*! \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, }; @@ -48,7 +48,7 @@ static struct aco_type *general_options[] = ACO_TYPES(&general_option); 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) ? @@ -60,11 +60,11 @@ static int encoding_format_handler(const struct aco_option *opt, 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; @@ -77,18 +77,18 @@ static int password_format_handler(const struct aco_option *opt, 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; @@ -114,7 +114,7 @@ static void *user_alloc(const char *cat) /*! \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; @@ -124,7 +124,7 @@ static int user_sort_cmp(const void *obj_left, const void *obj_right, int flags) 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); } @@ -149,15 +149,15 @@ static struct aco_type user_option = { .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); @@ -165,10 +165,10 @@ static void conf_destructor(void *obj) 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); @@ -207,9 +207,9 @@ static struct aco_file conf_file = { 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"); @@ -217,14 +217,14 @@ struct ari_conf *ari_config_get(void) 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; } @@ -261,7 +261,7 @@ struct ari_conf_user *ari_config_validate_user(const char *username, /*! \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", @@ -274,7 +274,7 @@ static int validate_user_cb(void *obj, void *arg, int flags) /*! \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: @@ -284,7 +284,7 @@ static int process_config(int reload) break; } - conf = ari_config_get(); + conf = ast_ari_config_get(); if (!conf) { ast_assert(0); /* We just configured; it should be there */ return -1; @@ -299,7 +299,7 @@ static int process_config(int reload) return 0; } -int ari_config_init(void) +int ast_ari_config_init(void) { if (aco_info_init(&cfg_info)) { aco_info_destroy(&cfg_info); @@ -308,37 +308,37 @@ int ari_config_init(void) 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); diff --git a/res/stasis_http/internal.h b/res/ari/internal.h similarity index 77% rename from res/stasis_http/internal.h rename to res/ari/internal.h index 7cc67cfbf76ac72ade67b250fc79db507f15031b..ffacd493945edc843dd1d9f9fbd3726619e1f57c 100644 --- a/res/stasis_http/internal.h +++ b/res/ari/internal.h @@ -16,12 +16,12 @@ * 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> */ @@ -35,23 +35,23 @@ * \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; }; @@ -59,8 +59,8 @@ struct ari_conf { /*! 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). */ @@ -74,7 +74,7 @@ struct ari_conf_general { }; /*! \brief Password format */ -enum ari_password_format { +enum ast_ari_password_format { /*! \brief Plaintext password */ ARI_PASSWORD_FORMAT_PLAIN, /*! crypt(3) password */ @@ -89,13 +89,13 @@ enum ari_password_format { #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; }; @@ -103,17 +103,17 @@ struct ari_conf_user { /*! * \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. @@ -124,7 +124,7 @@ void ari_config_destroy(void); * \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. @@ -134,10 +134,10 @@ struct ari_conf *ari_config_get(void); * \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_ */ diff --git a/res/stasis_http/resource_asterisk.c b/res/ari/resource_asterisk.c similarity index 65% rename from res/stasis_http/resource_asterisk.c rename to res/ari/resource_asterisk.c index c2a0bc0cc29e5802725c44ff42b8096526c36a11..dac45714ffd3d019c179a6b264fd8e4954f69966 100644 --- a/res/stasis_http/resource_asterisk.c +++ b/res/ari/resource_asterisk.c @@ -18,7 +18,7 @@ /*! \file * - * \brief Implementation for stasis-http stubs. + * \brief Implementation for ARI stubs. * * \author David M. Lee, II <dlee@digium.com> */ @@ -34,12 +34,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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); @@ -49,26 +49,26 @@ void stasis_http_get_global_var(struct ast_variable *headers, struct ast_get_glo 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; @@ -76,5 +76,5 @@ void stasis_http_set_global_var(struct ast_variable *headers, struct ast_set_glo pbx_builtin_setvar_helper(NULL, args->variable, args->value); - stasis_http_response_no_content(response); + ast_ari_response_no_content(response); } diff --git a/res/stasis_http/resource_asterisk.h b/res/ari/resource_asterisk.h similarity index 72% rename from res/stasis_http/resource_asterisk.h rename to res/ari/resource_asterisk.h index e32e919ab6578e9523a8607659ba73cb8394c897..69539525e58aa9276eeb6b888cad47ef635b02e1 100644 --- a/res/stasis_http/resource_asterisk.h +++ b/res/ari/resource_asterisk.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_asterisk.c + * res/ari/resource_asterisk.c * * Asterisk resources * @@ -31,15 +31,15 @@ * !!!!! 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; @@ -51,8 +51,8 @@ struct ast_get_asterisk_info_args { * \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; @@ -64,8 +64,8 @@ struct ast_get_global_var_args { * \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; @@ -79,6 +79,6 @@ struct ast_set_global_var_args { * \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 */ diff --git a/res/stasis_http/resource_bridges.c b/res/ari/resource_bridges.c similarity index 79% rename from res/stasis_http/resource_bridges.c rename to res/ari/resource_bridges.c index 42ef0c388f84ab10611d0b46f79f738976e798b7..17a8bb13250d718eed3f5840ab0df881a7ee7348 100644 --- a/res/stasis_http/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -18,7 +18,7 @@ /*! \file * - * \brief Implementation for stasis-http stubs. + * \brief Implementation for ARI stubs. * * \author David M. Lee, II <dlee@digium.com> */ @@ -54,7 +54,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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); @@ -66,12 +66,12 @@ static struct ast_bridge *find_bridge( 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; } @@ -89,7 +89,7 @@ static struct ast_bridge *find_bridge( * \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); @@ -98,7 +98,7 @@ static struct stasis_app_control *find_channel_control( 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; } @@ -107,7 +107,7 @@ static struct stasis_app_control *find_channel_control( 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); @@ -121,10 +121,10 @@ void stasis_http_add_channel_to_bridge(struct ast_variable *headers, struct ast_ } 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); @@ -142,12 +142,12 @@ void stasis_http_remove_channel_from_bridge(struct ast_variable *headers, struct * 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 { @@ -196,7 +196,7 @@ static struct ast_channel *prepare_bridge_media_channel(const char *type) 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); @@ -217,27 +217,27 @@ void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on } 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; } @@ -249,7 +249,7 @@ void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on args->offsetms); if (!playback) { - stasis_http_response_alloc_failed(response); + ast_ari_response_alloc_failed(response); return; } @@ -257,20 +257,20 @@ void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on 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; } @@ -278,7 +278,7 @@ void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on 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; } @@ -287,10 +287,10 @@ void stasis_http_play_on_bridge(struct ast_variable *headers, struct ast_play_on 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); @@ -312,26 +312,26 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b } 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; } @@ -350,20 +350,20 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b /* 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; @@ -371,7 +371,7 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b 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; @@ -382,26 +382,26 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b 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; } @@ -409,7 +409,7 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b 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; } @@ -418,24 +418,24 @@ void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_b 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) { @@ -443,10 +443,10 @@ void stasis_http_delete_bridge(struct ast_variable *headers, struct ast_delete_b } 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); @@ -456,7 +456,7 @@ void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridge 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; @@ -465,13 +465,13 @@ void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridge 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; } @@ -480,22 +480,22 @@ void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridge 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; @@ -503,12 +503,12 @@ void stasis_http_new_bridge(struct ast_variable *headers, struct ast_new_bridge_ 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)); } diff --git a/res/stasis_http/resource_bridges.h b/res/ari/resource_bridges.h similarity index 71% rename from res/stasis_http/resource_bridges.h rename to res/ari/resource_bridges.h index 3935a116c0773d7a94b5b46cd15c962fcdf934ae..892a3f2696d626afcc7aadf0a4ab9322c7b84f59 100644 --- a/res/stasis_http/resource_bridges.h +++ b/res/ari/resource_bridges.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_bridges.c + * res/ari/resource_bridges.c * * Bridge resources * @@ -31,15 +31,15 @@ * !!!!! 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 { }; /*! @@ -49,8 +49,8 @@ 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; @@ -64,8 +64,8 @@ struct ast_new_bridge_args { * \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; @@ -77,8 +77,8 @@ struct ast_get_bridge_args { * \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; @@ -92,8 +92,8 @@ struct ast_delete_bridge_args { * \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; @@ -107,8 +107,8 @@ struct ast_add_channel_to_bridge_args { * \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; @@ -122,8 +122,8 @@ struct ast_remove_channel_from_bridge_args { * \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; @@ -145,8 +145,8 @@ struct ast_play_on_bridge_args { * \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; @@ -174,6 +174,6 @@ struct ast_record_bridge_args { * \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 */ diff --git a/res/stasis_http/resource_channels.c b/res/ari/resource_channels.c similarity index 76% rename from res/stasis_http/resource_channels.c rename to res/ari/resource_channels.c index 592cd6df577ae8f03e4003bee72375c6098be728..7f3a91fbaac3c919ce805c58e0950f7261f0a7e4 100644 --- a/res/stasis_http/resource_channels.c +++ b/res/ari/resource_channels.c @@ -18,7 +18,7 @@ /*! \file * - * \brief Implementation for stasis-http stubs. + * \brief Implementation for ARI stubs. * * \author David M. Lee, II <dlee@digium.com> */ @@ -54,7 +54,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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); @@ -67,12 +67,12 @@ static struct stasis_app_control *find_control( 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; } @@ -81,7 +81,7 @@ static struct stasis_app_control *find_control( 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; @@ -91,17 +91,17 @@ void stasis_http_dial(struct ast_variable *headers, struct ast_dial_args *args, } 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); @@ -113,16 +113,16 @@ void stasis_http_continue_in_dialplan( } 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); @@ -132,16 +132,16 @@ void stasis_http_answer_channel(struct ast_variable *headers, } 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; @@ -159,7 +159,7 @@ void stasis_http_mute_channel(struct ast_variable *headers, struct ast_mute_chan } 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; @@ -167,10 +167,10 @@ void stasis_http_mute_channel(struct ast_variable *headers, struct ast_mute_chan 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; @@ -188,7 +188,7 @@ void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_ } 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; @@ -196,10 +196,10 @@ void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_ 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); @@ -211,10 +211,10 @@ void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_chan 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); @@ -226,10 +226,10 @@ void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_ 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); @@ -240,10 +240,10 @@ void stasis_http_moh_start_channel(struct ast_variable *headers, struct ast_moh_ } 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); @@ -254,12 +254,12 @@ void stasis_http_moh_stop_channel(struct ast_variable *headers, struct ast_moh_s } 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); @@ -278,21 +278,21 @@ void stasis_http_play_on_channel(struct ast_variable *headers, 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; @@ -303,7 +303,7 @@ void stasis_http_play_on_channel(struct ast_variable *headers, 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; @@ -312,7 +312,7 @@ void stasis_http_play_on_channel(struct ast_variable *headers, 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; @@ -320,18 +320,18 @@ void stasis_http_play_on_channel(struct ast_variable *headers, 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); @@ -346,14 +346,14 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -367,7 +367,7 @@ void stasis_http_record_channel(struct ast_variable *headers, 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"); } @@ -380,14 +380,14 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -400,22 +400,22 @@ void stasis_http_record_channel(struct ast_variable *headers, /* 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; @@ -423,7 +423,7 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -434,7 +434,7 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -444,7 +444,7 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -452,18 +452,18 @@ void stasis_http_record_channel(struct ast_variable *headers, 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; @@ -471,7 +471,7 @@ void stasis_http_get_channel(struct ast_variable *headers, 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; @@ -480,7 +480,7 @@ void stasis_http_get_channel(struct ast_variable *headers, 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; @@ -489,19 +489,19 @@ void stasis_http_get_channel(struct ast_variable *headers, 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; @@ -509,12 +509,12 @@ void stasis_http_delete_channel(struct ast_variable *headers, 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); @@ -524,7 +524,7 @@ void stasis_http_get_channels(struct ast_variable *headers, 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; @@ -533,13 +533,13 @@ void stasis_http_get_channels(struct ast_variable *headers, 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; } @@ -550,18 +550,18 @@ void stasis_http_get_channels(struct ast_variable *headers, 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]; @@ -573,7 +573,7 @@ void stasis_http_originate(struct ast_variable *headers, 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; } @@ -585,7 +585,7 @@ void stasis_http_originate(struct ast_variable *headers, } 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; } @@ -611,7 +611,7 @@ void stasis_http_originate(struct ast_variable *headers, 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; } @@ -622,25 +622,25 @@ void stasis_http_originate(struct ast_variable *headers, /* 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); @@ -656,14 +656,14 @@ void stasis_http_get_channel_var(struct ast_variable *headers, struct ast_get_ch 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); @@ -675,19 +675,19 @@ void stasis_http_set_channel_var(struct ast_variable *headers, struct ast_set_ch } 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); } diff --git a/res/stasis_http/resource_channels.h b/res/ari/resource_channels.h similarity index 70% rename from res/stasis_http/resource_channels.h rename to res/ari/resource_channels.h index c0baedef371cd6d0ab0b55d55d525edcabce153f..953d58f4eb67be3af3ed107d071c158ee2d88b16 100644 --- a/res/stasis_http/resource_channels.h +++ b/res/ari/resource_channels.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_channels.c + * res/ari/resource_channels.c * * Channel resources * @@ -31,15 +31,15 @@ * !!!!! 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 { }; /*! @@ -49,8 +49,8 @@ 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; @@ -76,8 +76,8 @@ struct ast_originate_args { * \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; @@ -89,8 +89,8 @@ struct ast_get_channel_args { * \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; @@ -102,8 +102,8 @@ struct ast_delete_channel_args { * \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; @@ -123,8 +123,8 @@ struct ast_dial_args { * \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; @@ -142,8 +142,8 @@ struct ast_continue_in_dialplan_args { * \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; @@ -155,8 +155,8 @@ struct ast_answer_channel_args { * \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; @@ -170,8 +170,8 @@ struct ast_mute_channel_args { * \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; @@ -185,8 +185,8 @@ struct ast_unmute_channel_args { * \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; @@ -198,8 +198,8 @@ struct ast_hold_channel_args { * \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; @@ -211,8 +211,8 @@ struct ast_unhold_channel_args { * \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; @@ -228,8 +228,8 @@ struct ast_moh_start_channel_args { * \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; @@ -241,8 +241,8 @@ struct ast_moh_stop_channel_args { * \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; @@ -264,8 +264,8 @@ struct ast_play_on_channel_args { * \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; @@ -293,8 +293,8 @@ struct ast_record_channel_args { * \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; @@ -308,8 +308,8 @@ struct ast_get_channel_var_args { * \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; @@ -325,6 +325,6 @@ struct ast_set_channel_var_args { * \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 */ diff --git a/res/stasis_http/resource_endpoints.c b/res/ari/resource_endpoints.c similarity index 78% rename from res/stasis_http/resource_endpoints.c rename to res/ari/resource_endpoints.c index 306413d752b2d9f1822f50147a8b9bafde1624a6..bb28df03c2fc98827d8704d6f63df618cd52edeb 100644 --- a/res/stasis_http/resource_endpoints.c +++ b/res/ari/resource_endpoints.c @@ -33,9 +33,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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); @@ -45,7 +45,7 @@ void stasis_http_get_endpoints(struct ast_variable *headers, 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; @@ -54,13 +54,13 @@ void stasis_http_get_endpoints(struct ast_variable *headers, 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; } @@ -71,17 +71,17 @@ void stasis_http_get_endpoints(struct ast_variable *headers, 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); @@ -93,7 +93,7 @@ void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, 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; @@ -102,13 +102,13 @@ void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, 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; } @@ -125,33 +125,33 @@ void stasis_http_get_endpoints_by_tech(struct ast_variable *headers, 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)); } diff --git a/res/stasis_http/resource_endpoints.h b/res/ari/resource_endpoints.h similarity index 71% rename from res/stasis_http/resource_endpoints.h rename to res/ari/resource_endpoints.h index 0379901d93fefaa134d8954d3f9dbbb134a60194..82c6afc0a0d11e82301c42b67a77484da00d3677 100644 --- a/res/stasis_http/resource_endpoints.h +++ b/res/ari/resource_endpoints.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_endpoints.c + * res/ari/resource_endpoints.c * * Endpoint resources * @@ -31,15 +31,15 @@ * !!!!! 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 { }; /*! @@ -49,8 +49,8 @@ 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; @@ -62,8 +62,8 @@ struct ast_get_endpoints_by_tech_args { * \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; @@ -77,6 +77,6 @@ struct ast_get_endpoint_args { * \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 */ diff --git a/res/stasis_http/resource_events.c b/res/ari/resource_events.c similarity index 87% rename from res/stasis_http/resource_events.c rename to res/ari/resource_events.c index d632339c09656ffb961eccf8317ad8613d86e92f..e5490b54618eecfb4e43ab2081453486636b62e1 100644 --- a/res/stasis_http/resource_events.c +++ b/res/ari/resource_events.c @@ -38,7 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /*! \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; }; @@ -87,7 +87,7 @@ static void session_cleanup(struct event_session *session) } 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); @@ -119,7 +119,7 @@ static void app_handler(void *data, const char *app_name, 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) { @@ -135,7 +135,7 @@ static void app_handler(void *data, const char *app_name, 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); } @@ -161,12 +161,12 @@ static int session_register_apps(struct event_session *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; } @@ -175,7 +175,7 @@ static int session_register_apps(struct event_session *session, 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) { @@ -187,7 +187,7 @@ void ari_websocket_event_websocket(struct ari_websocket_session *ws_session, 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; } @@ -198,21 +198,21 @@ void ari_websocket_event_websocket(struct ari_websocket_session *ws_session, "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); } } diff --git a/res/stasis_http/resource_events.h b/res/ari/resource_events.h similarity index 80% rename from res/stasis_http/resource_events.h rename to res/ari/resource_events.h index 298228cffe3cea1d69980936420ed8bc4fbf19d7..554ed9a87a5709c8c5a8d6846765a5cae7880737 100644 --- a/res/stasis_http/resource_events.h +++ b/res/ari/resource_events.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_events.c + * res/ari/resource_events.c * * WebSocket resource * @@ -31,15 +31,15 @@ * !!!!! 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; @@ -51,6 +51,6 @@ struct ast_event_websocket_args { * \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 */ diff --git a/res/stasis_http/resource_playback.c b/res/ari/resource_playback.c similarity index 78% rename from res/stasis_http/resource_playback.c rename to res/ari/resource_playback.c index a9edc4e15c3605e492291f52f373840e4520b39a..64afe10c14953e1135fb8e3c6e7f6de5c4874447 100644 --- a/res/stasis_http/resource_playback.c +++ b/res/ari/resource_playback.c @@ -30,39 +30,39 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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; } @@ -71,23 +71,23 @@ void stasis_http_stop_playback(struct ast_variable *headers, 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; @@ -104,7 +104,7 @@ void stasis_http_control_playback(struct ast_variable *headers, } 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; @@ -113,7 +113,7 @@ void stasis_http_control_playback(struct ast_variable *headers, 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; } @@ -122,15 +122,15 @@ void stasis_http_control_playback(struct ast_variable *headers, 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; } diff --git a/res/stasis_http/resource_playback.h b/res/ari/resource_playback.h similarity index 72% rename from res/stasis_http/resource_playback.h rename to res/ari/resource_playback.h index 36b05bc0497e7bf452bb71dc721d91478907dd82..c606a5cafab9dc0308fea252398a9b04ee442b82 100644 --- a/res/stasis_http/resource_playback.h +++ b/res/ari/resource_playback.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_playback.c + * res/ari/resource_playback.c * * Playback control resources * @@ -31,15 +31,15 @@ * !!!!! 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; @@ -51,8 +51,8 @@ struct ast_get_playback_args { * \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; @@ -64,8 +64,8 @@ struct ast_stop_playback_args { * \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; @@ -79,6 +79,6 @@ struct ast_control_playback_args { * \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 */ diff --git a/res/ari/resource_recordings.c b/res/ari/resource_recordings.c new file mode 100644 index 0000000000000000000000000000000000000000..46439ff0b8a13078d9560fce9781443496d871e5 --- /dev/null +++ b/res/ari/resource_recordings.c @@ -0,0 +1,97 @@ +/* + * 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"); +} diff --git a/res/stasis_http/resource_recordings.h b/res/ari/resource_recordings.h similarity index 64% rename from res/stasis_http/resource_recordings.h rename to res/ari/resource_recordings.h index 18a5bfe68398eec97dc08a83ebbefd4ef3d49789..e3ee88be88144a460a29055c7d1572dbe937336d 100644 --- a/res/stasis_http/resource_recordings.h +++ b/res/ari/resource_recordings.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_recordings.c + * res/ari/resource_recordings.c * * Recording resources * @@ -31,15 +31,15 @@ * !!!!! 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 { }; /*! @@ -49,8 +49,8 @@ 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; @@ -62,8 +62,8 @@ struct ast_get_stored_recording_args { * \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; @@ -75,8 +75,8 @@ struct ast_delete_stored_recording_args { * \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 { }; /*! @@ -86,8 +86,8 @@ 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; @@ -99,8 +99,8 @@ struct ast_get_live_recording_args { * \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; @@ -112,8 +112,8 @@ struct ast_cancel_recording_args { * \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; @@ -125,8 +125,8 @@ struct ast_stop_recording_args { * \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; @@ -140,8 +140,8 @@ struct ast_pause_recording_args { * \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; @@ -153,8 +153,8 @@ struct ast_unpause_recording_args { * \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; @@ -168,8 +168,8 @@ struct ast_mute_recording_args { * \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; @@ -181,6 +181,6 @@ struct ast_unmute_recording_args { * \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 */ diff --git a/res/stasis_http/resource_sounds.c b/res/ari/resource_sounds.c similarity index 87% rename from res/stasis_http/resource_sounds.c rename to res/ari/resource_sounds.c index 235ce9d9399aa91687de79d6c931070c83c59a47..f77c8a227315c6d8b3300cb9f5a7cc7b9ecf5c28 100644 --- a/res/stasis_http/resource_sounds.c +++ b/res/ari/resource_sounds.c @@ -173,48 +173,48 @@ static int append_sound_cb(void *obj, void *arg, void *data, int flags) 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); } diff --git a/res/stasis_http/resource_sounds.h b/res/ari/resource_sounds.h similarity index 74% rename from res/stasis_http/resource_sounds.h rename to res/ari/resource_sounds.h index f3010a92010c001bf16c06b6b46e3a5bcace7dad..7cb22fb716420524cae07b2550dc4f7a7509d059 100644 --- a/res/stasis_http/resource_sounds.h +++ b/res/ari/resource_sounds.h @@ -19,7 +19,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_sounds.c + * res/ari/resource_sounds.c * * Sound resources * @@ -31,15 +31,15 @@ * !!!!! 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; @@ -51,8 +51,8 @@ struct ast_get_sounds_args { * \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; @@ -64,6 +64,6 @@ struct ast_get_stored_sound_args { * \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 */ diff --git a/res/res_stasis_http.c b/res/res_ari.c similarity index 89% rename from res/res_stasis_http.c rename to res/res_ari.c index 393953f243c9c2f896f381283b3fe50d4adaee2d..4777bb7c209f1abf66e76e06661239d28ea1a28d 100644 --- a/res/res_stasis_http.c +++ b/res/res_ari.c @@ -42,30 +42,30 @@ * * 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 @@ -77,16 +77,16 @@ ***/ /*** 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> @@ -127,8 +127,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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> @@ -137,7 +137,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /*! \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; } @@ -150,12 +150,12 @@ static struct stasis_rest_handlers *root_handler; /*! 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; @@ -180,7 +180,7 @@ int stasis_http_add_handler(struct stasis_rest_handlers *handler) 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; @@ -234,7 +234,7 @@ static struct stasis_rest_handlers *root_handler_create(void) 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, ...) @@ -250,7 +250,7 @@ void stasis_http_response_error(struct stasis_http_response *response, 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); @@ -258,21 +258,21 @@ void stasis_http_response_ok(struct stasis_http_response *response, 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); @@ -282,7 +282,7 @@ void stasis_http_response_created(struct stasis_http_response *response, } 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, @@ -298,7 +298,7 @@ static void add_allow_header(struct stasis_rest_handlers *handler, 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; @@ -329,7 +329,7 @@ static int origin_allowed(const char *origin) */ 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; @@ -342,7 +342,7 @@ static void handle_options(struct stasis_rest_handlers *handler, /* 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) { @@ -399,7 +399,7 @@ static void handle_options(struct stasis_rest_handlers *handler, allow = ast_str_create(20); if (!allow) { - stasis_http_response_alloc_failed(response); + ast_ari_response_alloc_failed(response); return; } @@ -457,10 +457,10 @@ static void handle_options(struct stasis_rest_handlers *handler, } } -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); @@ -496,7 +496,7 @@ void stasis_http_invoke(struct ast_tcptls_session_instance *ser, 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; @@ -514,7 +514,7 @@ void stasis_http_invoke(struct ast_tcptls_session_instance *ser, 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; @@ -536,7 +536,7 @@ void stasis_http_invoke(struct ast_tcptls_session_instance *ser, 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; @@ -547,14 +547,14 @@ void stasis_http_invoke(struct ast_tcptls_session_instance *ser, /* 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); @@ -568,7 +568,7 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; } @@ -578,7 +578,7 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -592,12 +592,12 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -605,7 +605,7 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -618,7 +618,7 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -627,14 +627,14 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -645,7 +645,7 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, 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; @@ -668,11 +668,11 @@ void stasis_http_get_docs(const char *uri, struct ast_variable *headers, } } - 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'; @@ -693,7 +693,7 @@ static void remove_trailing_slash(const char *uri, * 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); } @@ -703,7 +703,7 @@ static void remove_trailing_slash(const char *uri, * 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; @@ -755,10 +755,10 @@ static void process_cors_request(struct ast_variable *headers, */ } -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; } @@ -769,7 +769,7 @@ enum ast_json_encoding_format stasis_http_json_format(void) * \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; @@ -786,7 +786,7 @@ static struct ari_conf_user *authenticate_api_key(const char *api_key) return NULL; } - return ari_config_validate_user(username, password); + return ast_ari_config_validate_user(username, password); } /*! @@ -797,7 +797,7 @@ static struct ari_conf_user *authenticate_api_key(const char *api_key) * \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); @@ -806,7 +806,7 @@ static struct ari_conf_user *authenticate_user(struct ast_variable *get_params, /* 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); } @@ -822,7 +822,7 @@ static struct ari_conf_user *authenticate_user(struct ast_variable *get_params, /*! * \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.) @@ -834,18 +834,18 @@ static struct ari_conf_user *authenticate_user(struct ast_variable *get_params, * \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) { @@ -857,7 +857,7 @@ static int stasis_http_callback(struct ast_tcptls_session_instance *ser, return -1; } - conf = ari_config_get(); + conf = ast_ari_config_get(); if (!conf || !conf->general) { return -1; } @@ -908,11 +908,11 @@ static int stasis_http_callback(struct ast_tcptls_session_instance *ser, 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); } @@ -959,7 +959,7 @@ static int stasis_http_callback(struct ast_tcptls_session_instance *ser, } static struct ast_http_uri http_uri = { - .callback = stasis_http_callback, + .callback = ast_ari_callback, .description = "Asterisk RESTful API", .uri = "ari", @@ -991,7 +991,7 @@ static int load_module(void) return AST_MODULE_LOAD_FAILURE; } - if (ari_config_init() != 0) { + if (ast_ari_config_init() != 0) { return AST_MODULE_LOAD_DECLINE; } @@ -1002,7 +1002,7 @@ static int load_module(void) ast_debug(3, "ARI disabled\n"); } - if (ari_cli_register() != 0) { + if (ast_ari_cli_register() != 0) { return AST_MODULE_LOAD_FAILURE; } @@ -1011,14 +1011,14 @@ static int load_module(void) 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; @@ -1034,7 +1034,7 @@ static int reload_module(void) { char was_enabled = is_enabled(); - if (ari_config_reload() != 0) { + if (ast_ari_config_reload() != 0) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_ari.exports.in b/res/res_ari.exports.in new file mode 100644 index 0000000000000000000000000000000000000000..f143ef38bbe0b5e21554c968eb375101d9b845f4 --- /dev/null +++ b/res/res_ari.exports.in @@ -0,0 +1,6 @@ +{ + global: + LINKER_SYMBOL_PREFIXast_ari_*; + local: + *; +}; diff --git a/res/res_stasis_http_asterisk.c b/res/res_ari_asterisk.c similarity index 83% rename from res/res_stasis_http_asterisk.c rename to res/res_ari_asterisk.c index d6c579bf29007e18314ade5b7b61e212e4c87de5..2c125188be416c0dbda5ce92b4d3fb4e3b6bc439 100644 --- a/res/res_stasis_http_asterisk.c +++ b/res/res_ari_asterisk.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -73,7 +73,7 @@ static void stasis_http_get_asterisk_info_cb( } 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; @@ -87,7 +87,7 @@ static void stasis_http_get_asterisk_info_cb( 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); @@ -97,7 +97,7 @@ static void stasis_http_get_asterisk_info_cb( 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 */ @@ -109,9 +109,9 @@ static void stasis_http_get_asterisk_info_cb( * \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; @@ -127,7 +127,7 @@ static void stasis_http_get_global_var_cb( } 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; @@ -141,7 +141,7 @@ static void stasis_http_get_global_var_cb( 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); @@ -151,7 +151,7 @@ static void stasis_http_get_global_var_cb( 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 */ @@ -163,9 +163,9 @@ static void stasis_http_get_global_var_cb( * \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; @@ -184,7 +184,7 @@ static void stasis_http_set_global_var_cb( } 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; @@ -198,7 +198,7 @@ static void stasis_http_set_global_var_cb( 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); @@ -208,7 +208,7 @@ static void stasis_http_set_global_var_cb( 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 */ @@ -218,7 +218,7 @@ static void stasis_http_set_global_var_cb( 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 = { } @@ -227,8 +227,8 @@ static struct stasis_rest_handlers asterisk_info = { 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 = { } @@ -246,13 +246,13 @@ static int load_module(void) { 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; } @@ -260,5 +260,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_bridges.c b/res/res_ari_bridges.c similarity index 84% rename from res/res_stasis_http_bridges.c rename to res/res_ari_bridges.c index eca992cbdaba4831d79e6075c03e0f13e258f80f..f2ee8c03add101d95423789606b4435bbf40b055 100644 --- a/res/res_stasis_http_bridges.c +++ b/res/res_ari_bridges.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -65,7 +65,7 @@ static void stasis_http_get_bridges_cb( #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; @@ -79,8 +79,8 @@ static void stasis_http_get_bridges_cb( 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; @@ -89,7 +89,7 @@ static void stasis_http_get_bridges_cb( 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 */ @@ -101,9 +101,9 @@ static void stasis_http_get_bridges_cb( * \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; @@ -119,7 +119,7 @@ static void stasis_http_new_bridge_cb( } else {} } - stasis_http_new_bridge(headers, &args, response); + ast_ari_new_bridge(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -133,7 +133,7 @@ static void stasis_http_new_bridge_cb( 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); @@ -143,7 +143,7 @@ static void stasis_http_new_bridge_cb( 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 */ @@ -155,9 +155,9 @@ static void stasis_http_new_bridge_cb( * \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; @@ -173,7 +173,7 @@ static void stasis_http_get_bridge_cb( } else {} } - stasis_http_get_bridge(headers, &args, response); + ast_ari_get_bridge(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -188,7 +188,7 @@ static void stasis_http_get_bridge_cb( 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); @@ -198,7 +198,7 @@ static void stasis_http_get_bridge_cb( 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 */ @@ -210,9 +210,9 @@ static void stasis_http_get_bridge_cb( * \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; @@ -228,7 +228,7 @@ static void stasis_http_delete_bridge_cb( } else {} } - stasis_http_delete_bridge(headers, &args, response); + ast_ari_delete_bridge(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -243,7 +243,7 @@ static void stasis_http_delete_bridge_cb( 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); @@ -253,7 +253,7 @@ static void stasis_http_delete_bridge_cb( 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 */ @@ -265,9 +265,9 @@ static void stasis_http_delete_bridge_cb( * \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; @@ -289,7 +289,7 @@ static void stasis_http_add_channel_to_bridge_cb( } 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; @@ -306,7 +306,7 @@ static void stasis_http_add_channel_to_bridge_cb( 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); @@ -316,7 +316,7 @@ static void stasis_http_add_channel_to_bridge_cb( 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 */ @@ -328,9 +328,9 @@ static void stasis_http_add_channel_to_bridge_cb( * \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; @@ -352,7 +352,7 @@ static void stasis_http_remove_channel_from_bridge_cb( } 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; @@ -366,7 +366,7 @@ static void stasis_http_remove_channel_from_bridge_cb( 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); @@ -376,7 +376,7 @@ static void stasis_http_remove_channel_from_bridge_cb( 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 */ @@ -388,9 +388,9 @@ static void stasis_http_remove_channel_from_bridge_cb( * \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; @@ -421,7 +421,7 @@ static void stasis_http_play_on_bridge_cb( } 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; @@ -437,7 +437,7 @@ static void stasis_http_play_on_bridge_cb( 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); @@ -447,7 +447,7 @@ static void stasis_http_play_on_bridge_cb( 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 */ @@ -459,9 +459,9 @@ static void stasis_http_play_on_bridge_cb( * \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; @@ -501,7 +501,7 @@ static void stasis_http_record_bridge_cb( } else {} } - stasis_http_record_bridge(headers, &args, response); + ast_ari_record_bridge(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -515,7 +515,7 @@ static void stasis_http_record_bridge_cb( 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); @@ -525,7 +525,7 @@ static void stasis_http_record_bridge_cb( 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 */ @@ -535,7 +535,7 @@ static void stasis_http_record_bridge_cb( 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 = { } @@ -544,7 +544,7 @@ static struct stasis_rest_handlers bridges_bridgeId_addChannel = { 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 = { } @@ -553,7 +553,7 @@ static struct stasis_rest_handlers bridges_bridgeId_removeChannel = { 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 = { } @@ -562,7 +562,7 @@ static struct stasis_rest_handlers bridges_bridgeId_play = { 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 = { } @@ -572,8 +572,8 @@ static struct stasis_rest_handlers bridges_bridgeId = { .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, } @@ -582,8 +582,8 @@ static struct stasis_rest_handlers bridges_bridgeId = { 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, } @@ -593,13 +593,13 @@ static int load_module(void) { 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; } @@ -607,5 +607,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_channels.c b/res/res_ari_channels.c similarity index 85% rename from res/res_stasis_http_channels.c rename to res/res_ari_channels.c index b7498856b6584eba205e8d29324a31abd8cf924c..4c322ea2a0e26febfa649853865cbfaf0e0bc3bd 100644 --- a/res/res_stasis_http_channels.c +++ b/res/res_ari_channels.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -65,7 +65,7 @@ static void stasis_http_get_channels_cb( #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; @@ -79,8 +79,8 @@ static void stasis_http_get_channels_cb( 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; @@ -89,7 +89,7 @@ static void stasis_http_get_channels_cb( 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 */ @@ -101,9 +101,9 @@ static void stasis_http_get_channels_cb( * \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; @@ -140,7 +140,7 @@ static void stasis_http_originate_cb( } else {} } - stasis_http_originate(headers, &args, response); + ast_ari_originate(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -155,7 +155,7 @@ static void stasis_http_originate_cb( 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); @@ -165,7 +165,7 @@ static void stasis_http_originate_cb( 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 */ @@ -177,9 +177,9 @@ static void stasis_http_originate_cb( * \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; @@ -195,7 +195,7 @@ static void stasis_http_get_channel_cb( } else {} } - stasis_http_get_channel(headers, &args, response); + ast_ari_get_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -210,7 +210,7 @@ static void stasis_http_get_channel_cb( 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); @@ -220,7 +220,7 @@ static void stasis_http_get_channel_cb( 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 */ @@ -232,9 +232,9 @@ static void stasis_http_get_channel_cb( * \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; @@ -250,7 +250,7 @@ static void stasis_http_delete_channel_cb( } else {} } - stasis_http_delete_channel(headers, &args, response); + ast_ari_delete_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -265,7 +265,7 @@ static void stasis_http_delete_channel_cb( 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); @@ -275,7 +275,7 @@ static void stasis_http_delete_channel_cb( 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 */ @@ -287,9 +287,9 @@ static void stasis_http_delete_channel_cb( * \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; @@ -320,7 +320,7 @@ static void stasis_http_dial_cb( } else {} } - stasis_http_dial(headers, &args, response); + ast_ari_dial(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -336,7 +336,7 @@ static void stasis_http_dial_cb( 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); @@ -346,7 +346,7 @@ static void stasis_http_dial_cb( 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 */ @@ -358,9 +358,9 @@ static void stasis_http_dial_cb( * \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; @@ -388,7 +388,7 @@ static void stasis_http_continue_in_dialplan_cb( } 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; @@ -404,7 +404,7 @@ static void stasis_http_continue_in_dialplan_cb( 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); @@ -414,7 +414,7 @@ static void stasis_http_continue_in_dialplan_cb( 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 */ @@ -426,9 +426,9 @@ static void stasis_http_continue_in_dialplan_cb( * \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; @@ -444,7 +444,7 @@ static void stasis_http_answer_channel_cb( } else {} } - stasis_http_answer_channel(headers, &args, response); + ast_ari_answer_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -460,7 +460,7 @@ static void stasis_http_answer_channel_cb( 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); @@ -470,7 +470,7 @@ static void stasis_http_answer_channel_cb( 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 */ @@ -482,9 +482,9 @@ static void stasis_http_answer_channel_cb( * \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; @@ -506,7 +506,7 @@ static void stasis_http_mute_channel_cb( } else {} } - stasis_http_mute_channel(headers, &args, response); + ast_ari_mute_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -522,7 +522,7 @@ static void stasis_http_mute_channel_cb( 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); @@ -532,7 +532,7 @@ static void stasis_http_mute_channel_cb( 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 */ @@ -544,9 +544,9 @@ static void stasis_http_mute_channel_cb( * \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; @@ -568,7 +568,7 @@ static void stasis_http_unmute_channel_cb( } else {} } - stasis_http_unmute_channel(headers, &args, response); + ast_ari_unmute_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -584,7 +584,7 @@ static void stasis_http_unmute_channel_cb( 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); @@ -594,7 +594,7 @@ static void stasis_http_unmute_channel_cb( 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 */ @@ -606,9 +606,9 @@ static void stasis_http_unmute_channel_cb( * \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; @@ -624,7 +624,7 @@ static void stasis_http_hold_channel_cb( } else {} } - stasis_http_hold_channel(headers, &args, response); + ast_ari_hold_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -640,7 +640,7 @@ static void stasis_http_hold_channel_cb( 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); @@ -650,7 +650,7 @@ static void stasis_http_hold_channel_cb( 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 */ @@ -662,9 +662,9 @@ static void stasis_http_hold_channel_cb( * \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; @@ -680,7 +680,7 @@ static void stasis_http_unhold_channel_cb( } else {} } - stasis_http_unhold_channel(headers, &args, response); + ast_ari_unhold_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -696,7 +696,7 @@ static void stasis_http_unhold_channel_cb( 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); @@ -706,7 +706,7 @@ static void stasis_http_unhold_channel_cb( 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 */ @@ -718,9 +718,9 @@ static void stasis_http_unhold_channel_cb( * \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; @@ -742,7 +742,7 @@ static void stasis_http_moh_start_channel_cb( } 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; @@ -758,7 +758,7 @@ static void stasis_http_moh_start_channel_cb( 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); @@ -768,7 +768,7 @@ static void stasis_http_moh_start_channel_cb( 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 */ @@ -780,9 +780,9 @@ static void stasis_http_moh_start_channel_cb( * \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; @@ -798,7 +798,7 @@ static void stasis_http_moh_stop_channel_cb( } 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; @@ -814,7 +814,7 @@ static void stasis_http_moh_stop_channel_cb( 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); @@ -824,7 +824,7 @@ static void stasis_http_moh_stop_channel_cb( 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 */ @@ -836,9 +836,9 @@ static void stasis_http_moh_stop_channel_cb( * \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; @@ -869,7 +869,7 @@ static void stasis_http_play_on_channel_cb( } 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; @@ -885,7 +885,7 @@ static void stasis_http_play_on_channel_cb( 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); @@ -895,7 +895,7 @@ static void stasis_http_play_on_channel_cb( 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 */ @@ -907,9 +907,9 @@ static void stasis_http_play_on_channel_cb( * \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; @@ -949,7 +949,7 @@ static void stasis_http_record_channel_cb( } else {} } - stasis_http_record_channel(headers, &args, response); + ast_ari_record_channel(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -966,7 +966,7 @@ static void stasis_http_record_channel_cb( 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); @@ -976,7 +976,7 @@ static void stasis_http_record_channel_cb( 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 */ @@ -988,9 +988,9 @@ static void stasis_http_record_channel_cb( * \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; @@ -1012,7 +1012,7 @@ static void stasis_http_get_channel_var_cb( } 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; @@ -1028,7 +1028,7 @@ static void stasis_http_get_channel_var_cb( 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); @@ -1038,7 +1038,7 @@ static void stasis_http_get_channel_var_cb( 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 */ @@ -1050,9 +1050,9 @@ static void stasis_http_get_channel_var_cb( * \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; @@ -1077,7 +1077,7 @@ static void stasis_http_set_channel_var_cb( } 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; @@ -1093,7 +1093,7 @@ static void stasis_http_set_channel_var_cb( 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); @@ -1103,7 +1103,7 @@ static void stasis_http_set_channel_var_cb( 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 */ @@ -1113,7 +1113,7 @@ static void stasis_http_set_channel_var_cb( 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 = { } @@ -1122,7 +1122,7 @@ static struct stasis_rest_handlers channels_channelId_dial = { 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 = { } @@ -1131,7 +1131,7 @@ static struct stasis_rest_handlers channels_channelId_continue = { 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 = { } @@ -1140,7 +1140,7 @@ static struct stasis_rest_handlers channels_channelId_answer = { 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 = { } @@ -1149,7 +1149,7 @@ static struct stasis_rest_handlers channels_channelId_mute = { 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 = { } @@ -1158,7 +1158,7 @@ static struct stasis_rest_handlers channels_channelId_unmute = { 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 = { } @@ -1167,7 +1167,7 @@ static struct stasis_rest_handlers channels_channelId_hold = { 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 = { } @@ -1176,7 +1176,7 @@ static struct stasis_rest_handlers channels_channelId_unhold = { 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 = { } @@ -1185,7 +1185,7 @@ static struct stasis_rest_handlers channels_channelId_mohstart = { 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 = { } @@ -1194,7 +1194,7 @@ static struct stasis_rest_handlers channels_channelId_mohstop = { 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 = { } @@ -1203,7 +1203,7 @@ static struct stasis_rest_handlers channels_channelId_play = { 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 = { } @@ -1212,8 +1212,8 @@ static struct stasis_rest_handlers channels_channelId_record = { 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 = { } @@ -1223,8 +1223,8 @@ static struct stasis_rest_handlers channels_channelId = { .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, } @@ -1233,8 +1233,8 @@ static struct stasis_rest_handlers channels_channelId = { 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, } @@ -1244,13 +1244,13 @@ static int load_module(void) { 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; } @@ -1258,5 +1258,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_endpoints.c b/res/res_ari_endpoints.c similarity index 81% rename from res/res_stasis_http_endpoints.c rename to res/res_ari_endpoints.c index 3a3116569f82a6032f6070a06ee5c8ddafdad1de..8aa758929ebf7d3c36f0b9f2e32fbbf7a866cd4b 100644 --- a/res/res_stasis_http_endpoints.c +++ b/res/res_ari_endpoints.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -65,7 +65,7 @@ static void stasis_http_get_endpoints_cb( #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; @@ -79,8 +79,8 @@ static void stasis_http_get_endpoints_cb( 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; @@ -89,7 +89,7 @@ static void stasis_http_get_endpoints_cb( 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 */ @@ -101,9 +101,9 @@ static void stasis_http_get_endpoints_cb( * \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; @@ -119,7 +119,7 @@ static void stasis_http_get_endpoints_by_tech_cb( } 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; @@ -133,8 +133,8 @@ static void stasis_http_get_endpoints_by_tech_cb( 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; @@ -143,7 +143,7 @@ static void stasis_http_get_endpoints_by_tech_cb( 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 */ @@ -155,9 +155,9 @@ static void stasis_http_get_endpoints_by_tech_cb( * \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; @@ -176,7 +176,7 @@ static void stasis_http_get_endpoint_cb( } else {} } - stasis_http_get_endpoint(headers, &args, response); + ast_ari_get_endpoint(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -190,7 +190,7 @@ static void stasis_http_get_endpoint_cb( 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); @@ -200,7 +200,7 @@ static void stasis_http_get_endpoint_cb( 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 */ @@ -211,7 +211,7 @@ static struct stasis_rest_handlers endpoints_tech_resource = { .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 = { } @@ -221,7 +221,7 @@ static struct stasis_rest_handlers endpoints_tech = { .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, } @@ -230,7 +230,7 @@ static struct stasis_rest_handlers endpoints_tech = { 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, } @@ -240,13 +240,13 @@ static int load_module(void) { 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; } @@ -254,5 +254,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_events.c b/res/res_ari_events.c similarity index 77% rename from res/res_stasis_http_events.c rename to res/res_ari_events.c index 00e69db7ec9d4451bc8d8213fdfb880888b51f7f..c310fa5f98311adafbda2a29b074e84fb4f1b82e 100644 --- a/res/res_stasis_http_events.c +++ b/res/res_ari_events.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,16 +43,16 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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; @@ -63,16 +63,16 @@ static void stasis_http_event_websocket_ws_cb(struct ast_websocket *ws_session, {} } #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} */ @@ -92,15 +92,15 @@ static int load_module(void) 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(); @@ -110,5 +110,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_ari_model.c b/res/res_ari_model.c index 661fc431336554d9b477f362bdc2e7f8ec3c8d97..5770dfc511e7b7d8fc02759159d8a78421a140d1 100644 --- a/res/res_ari_model.c +++ b/res/res_ari_model.c @@ -31,7 +31,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") -#include "stasis_http/ari_model_validators.h" +#include "ari/ari_model_validators.h" #include "asterisk/logger.h" #include "asterisk/module.h" #include "asterisk/utils.h" @@ -90,18 +90,18 @@ static int check_range(intmax_t minval, intmax_t maxval, struct ast_json *json) return 1; } -int ari_validate_void(struct ast_json *json) +int ast_ari_validate_void(struct ast_json *json) { return check_type(json, AST_JSON_NULL); } -int ari_validate_byte(struct ast_json *json) +int ast_ari_validate_byte(struct ast_json *json) { /* Java bytes are signed, which accounts for great fun for all */ return check_range(-128, 255, json); } -int ari_validate_boolean(struct ast_json *json) +int ast_ari_validate_boolean(struct ast_json *json) { enum ast_json_type actual = ast_json_typeof(json); switch (actual) { @@ -115,34 +115,34 @@ int ari_validate_boolean(struct ast_json *json) } } -int ari_validate_int(struct ast_json *json) +int ast_ari_validate_int(struct ast_json *json) { /* Swagger int's are 32-bit */ return check_range(-2147483648LL, 2147483647LL, json); } -int ari_validate_long(struct ast_json *json) +int ast_ari_validate_long(struct ast_json *json) { /* All integral values are valid longs. No need for range check. */ return check_type(json, AST_JSON_INTEGER); } -int ari_validate_float(struct ast_json *json) +int ast_ari_validate_float(struct ast_json *json) { return check_type(json, AST_JSON_REAL); } -int ari_validate_double(struct ast_json *json) +int ast_ari_validate_double(struct ast_json *json) { return check_type(json, AST_JSON_REAL); } -int ari_validate_string(struct ast_json *json) +int ast_ari_validate_string(struct ast_json *json) { return check_type(json, AST_JSON_STRING); } -int ari_validate_date(struct ast_json *json) +int ast_ari_validate_date(struct ast_json *json) { /* Dates are ISO-8601 strings */ const char *str; @@ -158,7 +158,7 @@ int ari_validate_date(struct ast_json *json) 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; diff --git a/res/res_ari_model.exports.in b/res/res_ari_model.exports.in index 160e23f43ea79b5e45a311c5cabda1b4325ac93e..f143ef38bbe0b5e21554c968eb375101d9b845f4 100644 --- a/res/res_ari_model.exports.in +++ b/res/res_ari_model.exports.in @@ -1,6 +1,6 @@ { global: - LINKER_SYMBOL_PREFIXari_*; + LINKER_SYMBOL_PREFIXast_ari_*; local: *; }; diff --git a/res/res_stasis_http_playback.c b/res/res_ari_playback.c similarity index 84% rename from res/res_stasis_http_playback.c rename to res/res_ari_playback.c index 3a77e6d163b58efebb0d51a815b97900dcd05e39..0dc76aff9b9ae110c142a8a6a007a82a3dba9f29 100644 --- a/res/res_stasis_http_playback.c +++ b/res/res_ari_playback.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -73,7 +73,7 @@ static void stasis_http_get_playback_cb( } else {} } - stasis_http_get_playback(headers, &args, response); + ast_ari_get_playback(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -87,7 +87,7 @@ static void stasis_http_get_playback_cb( 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); @@ -97,7 +97,7 @@ static void stasis_http_get_playback_cb( 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 */ @@ -109,9 +109,9 @@ static void stasis_http_get_playback_cb( * \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; @@ -127,7 +127,7 @@ static void stasis_http_stop_playback_cb( } else {} } - stasis_http_stop_playback(headers, &args, response); + ast_ari_stop_playback(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -141,7 +141,7 @@ static void stasis_http_stop_playback_cb( 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); @@ -151,7 +151,7 @@ static void stasis_http_stop_playback_cb( 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 */ @@ -163,9 +163,9 @@ static void stasis_http_stop_playback_cb( * \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; @@ -187,7 +187,7 @@ static void stasis_http_control_playback_cb( } else {} } - stasis_http_control_playback(headers, &args, response); + ast_ari_control_playback(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -204,7 +204,7 @@ static void stasis_http_control_playback_cb( 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); @@ -214,7 +214,7 @@ static void stasis_http_control_playback_cb( 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 */ @@ -224,7 +224,7 @@ static void stasis_http_control_playback_cb( 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 = { } @@ -234,8 +234,8 @@ static struct stasis_rest_handlers playback_playbackId = { .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, } @@ -253,13 +253,13 @@ static int load_module(void) { 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; } @@ -267,5 +267,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_recordings.c b/res/res_ari_recordings.c similarity index 82% rename from res/res_stasis_http_recordings.c rename to res/res_ari_recordings.c index b1176eb4c8d96795608aa1aef32a2622c1bad9c4..a63f37b18018891de5bd15b2ce503cf00d1acb61 100644 --- a/res/res_stasis_http_recordings.c +++ b/res/res_ari_recordings.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -65,7 +65,7 @@ static void stasis_http_get_stored_recordings_cb( #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; @@ -79,8 +79,8 @@ static void stasis_http_get_stored_recordings_cb( 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; @@ -89,7 +89,7 @@ static void stasis_http_get_stored_recordings_cb( 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 */ @@ -101,9 +101,9 @@ static void stasis_http_get_stored_recordings_cb( * \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; @@ -119,7 +119,7 @@ static void stasis_http_get_stored_recording_cb( } 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; @@ -133,7 +133,7 @@ static void stasis_http_get_stored_recording_cb( 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); @@ -143,7 +143,7 @@ static void stasis_http_get_stored_recording_cb( 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 */ @@ -155,9 +155,9 @@ static void stasis_http_get_stored_recording_cb( * \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; @@ -173,7 +173,7 @@ static void stasis_http_delete_stored_recording_cb( } 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; @@ -187,7 +187,7 @@ static void stasis_http_delete_stored_recording_cb( 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); @@ -197,7 +197,7 @@ static void stasis_http_delete_stored_recording_cb( 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 */ @@ -209,9 +209,9 @@ static void stasis_http_delete_stored_recording_cb( * \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; @@ -219,7 +219,7 @@ static void stasis_http_get_live_recordings_cb( #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; @@ -233,8 +233,8 @@ static void stasis_http_get_live_recordings_cb( 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; @@ -243,7 +243,7 @@ static void stasis_http_get_live_recordings_cb( 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 */ @@ -255,9 +255,9 @@ static void stasis_http_get_live_recordings_cb( * \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; @@ -273,7 +273,7 @@ static void stasis_http_get_live_recording_cb( } 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; @@ -287,7 +287,7 @@ static void stasis_http_get_live_recording_cb( 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); @@ -297,7 +297,7 @@ static void stasis_http_get_live_recording_cb( 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 */ @@ -309,9 +309,9 @@ static void stasis_http_get_live_recording_cb( * \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; @@ -327,7 +327,7 @@ static void stasis_http_cancel_recording_cb( } else {} } - stasis_http_cancel_recording(headers, &args, response); + ast_ari_cancel_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -341,7 +341,7 @@ static void stasis_http_cancel_recording_cb( 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); @@ -351,7 +351,7 @@ static void stasis_http_cancel_recording_cb( 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 */ @@ -363,9 +363,9 @@ static void stasis_http_cancel_recording_cb( * \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; @@ -381,7 +381,7 @@ static void stasis_http_stop_recording_cb( } else {} } - stasis_http_stop_recording(headers, &args, response); + ast_ari_stop_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -395,7 +395,7 @@ static void stasis_http_stop_recording_cb( 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); @@ -405,7 +405,7 @@ static void stasis_http_stop_recording_cb( 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 */ @@ -417,9 +417,9 @@ static void stasis_http_stop_recording_cb( * \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; @@ -435,7 +435,7 @@ static void stasis_http_pause_recording_cb( } else {} } - stasis_http_pause_recording(headers, &args, response); + ast_ari_pause_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -449,7 +449,7 @@ static void stasis_http_pause_recording_cb( 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); @@ -459,7 +459,7 @@ static void stasis_http_pause_recording_cb( 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 */ @@ -471,9 +471,9 @@ static void stasis_http_pause_recording_cb( * \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; @@ -489,7 +489,7 @@ static void stasis_http_unpause_recording_cb( } else {} } - stasis_http_unpause_recording(headers, &args, response); + ast_ari_unpause_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -503,7 +503,7 @@ static void stasis_http_unpause_recording_cb( 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); @@ -513,7 +513,7 @@ static void stasis_http_unpause_recording_cb( 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 */ @@ -525,9 +525,9 @@ static void stasis_http_unpause_recording_cb( * \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; @@ -543,7 +543,7 @@ static void stasis_http_mute_recording_cb( } else {} } - stasis_http_mute_recording(headers, &args, response); + ast_ari_mute_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -557,7 +557,7 @@ static void stasis_http_mute_recording_cb( 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); @@ -567,7 +567,7 @@ static void stasis_http_mute_recording_cb( 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 */ @@ -579,9 +579,9 @@ static void stasis_http_mute_recording_cb( * \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; @@ -597,7 +597,7 @@ static void stasis_http_unmute_recording_cb( } else {} } - stasis_http_unmute_recording(headers, &args, response); + ast_ari_unmute_recording(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -611,7 +611,7 @@ static void stasis_http_unmute_recording_cb( 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); @@ -621,7 +621,7 @@ static void stasis_http_unmute_recording_cb( 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 */ @@ -632,8 +632,8 @@ static struct stasis_rest_handlers recordings_stored_recordingName = { .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 = { } @@ -642,7 +642,7 @@ static struct stasis_rest_handlers recordings_stored_recordingName = { 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, } @@ -651,7 +651,7 @@ static struct stasis_rest_handlers recordings_stored = { 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 = { } @@ -660,7 +660,7 @@ static struct stasis_rest_handlers recordings_live_recordingName_stop = { 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 = { } @@ -669,7 +669,7 @@ static struct stasis_rest_handlers recordings_live_recordingName_pause = { 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 = { } @@ -678,7 +678,7 @@ static struct stasis_rest_handlers recordings_live_recordingName_unpause = { 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 = { } @@ -687,7 +687,7 @@ static struct stasis_rest_handlers recordings_live_recordingName_mute = { 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 = { } @@ -697,8 +697,8 @@ static struct stasis_rest_handlers recordings_live_recordingName = { .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, } @@ -707,7 +707,7 @@ static struct stasis_rest_handlers recordings_live_recordingName = { 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, } @@ -725,13 +725,13 @@ static int load_module(void) { 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; } @@ -739,5 +739,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http_sounds.c b/res/res_ari_sounds.c similarity index 82% rename from res/res_stasis_http_sounds.c rename to res/res_ari_sounds.c index 1126cef4b43a2a4218d9775cbd8ed79a0dd6f1e1..a7411b5bfaf007f5f21e4e63f7773987fba8ef3e 100644 --- a/res/res_stasis_http_sounds.c +++ b/res/res_ari_sounds.c @@ -21,7 +21,7 @@ * !!!!! 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 @@ -32,7 +32,7 @@ */ /*** 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> ***/ @@ -43,9 +43,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 /*! @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -76,7 +76,7 @@ static void stasis_http_get_sounds_cb( } else {} } - stasis_http_get_sounds(headers, &args, response); + ast_ari_get_sounds(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; @@ -90,8 +90,8 @@ static void stasis_http_get_sounds_cb( 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; @@ -100,7 +100,7 @@ static void stasis_http_get_sounds_cb( 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 */ @@ -112,9 +112,9 @@ static void stasis_http_get_sounds_cb( * \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; @@ -130,7 +130,7 @@ static void stasis_http_get_stored_sound_cb( } 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; @@ -144,7 +144,7 @@ static void stasis_http_get_stored_sound_cb( 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); @@ -154,7 +154,7 @@ static void stasis_http_get_stored_sound_cb( 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 */ @@ -165,7 +165,7 @@ static struct stasis_rest_handlers sounds_soundId = { .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 = { } @@ -174,7 +174,7 @@ static struct stasis_rest_handlers sounds_soundId = { 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, } @@ -184,13 +184,13 @@ static int load_module(void) { 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; } @@ -198,5 +198,5 @@ static int unload_module(void) 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", ); diff --git a/res/res_stasis_http.exports.in b/res/res_stasis_http.exports.in deleted file mode 100644 index 08f5065e26de748c7247fee2b4ae1c91ae136299..0000000000000000000000000000000000000000 --- a/res/res_stasis_http.exports.in +++ /dev/null @@ -1,7 +0,0 @@ -{ - global: - LINKER_SYMBOL_PREFIXstasis_http_*; - LINKER_SYMBOL_PREFIXari_*; - local: - *; -}; diff --git a/res/res_statsd.c b/res/res_statsd.c index 4cdcb44ca41263462c7eb9c07dce5a82e28578b6..65ca786360c964e9eb65e0c5349eb38d07498453 100644 --- a/res/res_statsd.c +++ b/res/res_statsd.c @@ -34,7 +34,7 @@ <configObject name="global"> <synopsis>Global configuration settings</synopsis> <configOption name="enabled"> - <synopsis>Enable/disable the stasis-http module</synopsis> + <synopsis>Enable/disable the statsd module</synopsis> </configOption> <configOption name="server"> <synopsis>Address of the statsd server</synopsis> @@ -161,7 +161,7 @@ void AST_OPTIONAL_API_NAME(ast_statsd_log_sample)(const char *metric_name, sample_rate); } -/*! \brief Mapping of the stasis http conf struct's globals to the +/*! \brief Mapping of the statsd conf struct's globals to the * general context in the config file. */ static struct aco_type global_option = { .type = ACO_GLOBAL, @@ -173,7 +173,7 @@ static struct aco_type global_option = { 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; diff --git a/res/stasis_http.make b/res/stasis_http.make deleted file mode 100644 index 3d80e5e88e5ba74d3b0b636f94602b2e82f14d35..0000000000000000000000000000000000000000 --- a/res/stasis_http.make +++ /dev/null @@ -1,51 +0,0 @@ -# -# 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) - diff --git a/res/stasis_http/resource_recordings.c b/res/stasis_http/resource_recordings.c deleted file mode 100644 index d93d59017c1ea9140f6663211d6f8d48914dbe7a..0000000000000000000000000000000000000000 --- a/res/stasis_http/resource_recordings.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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"); -} diff --git a/rest-api-templates/stasis_http.make.mustache b/rest-api-templates/ari.make.mustache similarity index 68% rename from rest-api-templates/stasis_http.make.mustache rename to rest-api-templates/ari.make.mustache index 103eb2bfffc305a7e3dde72c13b95976390af61d..37f09c17966695059251416d6cd33eed893e24bb 100644 --- a/rest-api-templates/stasis_http.make.mustache +++ b/rest-api-templates/ari.make.mustache @@ -2,7 +2,7 @@ # # Asterisk -- A telephony toolkit for Linux. # -# Generated Makefile for res_stasis_http dependencies. +# Generated Makefile for res_ari dependencies. # # Copyright (C) 2013, Digium, Inc. # @@ -15,12 +15,12 @@ # !!!!! 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}} diff --git a/rest-api-templates/ari_model_validators.c.mustache b/rest-api-templates/ari_model_validators.c.mustache index 04a6d1111c32988dec0753967b6cb909a02017aa..7bb52789841939bb184f3b5fc998c5a90b587d97 100644 --- a/rest-api-templates/ari_model_validators.c.mustache +++ b/rest-api-templates/ari_model_validators.c.mustache @@ -36,7 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") {{#api_declaration}} {{#models}} -int ari_validate_{{c_id}}(struct ast_json *json) +int ast_ari_validate_{{c_id}}(struct ast_json *json) { int res = 1; struct ast_json_iter *iter; @@ -59,7 +59,7 @@ int ari_validate_{{c_id}}(struct ast_json *json) } else {{#subtypes}} if (strcmp("{{id}}", discriminator) == 0) { - return ari_validate_{{c_id}}(json); + return ast_ari_validate_{{c_id}}(json); } else {{/subtypes}} { @@ -78,12 +78,12 @@ int ari_validate_{{c_id}}(struct ast_json *json) {{/required}} {{#type}} {{#is_list}} - prop_is_valid = ari_validate_list( + prop_is_valid = ast_ari_validate_list( ast_json_object_iter_value(iter), - ari_validate_{{c_singular_name}}); + ast_ari_validate_{{c_singular_name}}); {{/is_list}} {{^is_list}} - prop_is_valid = ari_validate_{{c_name}}( + prop_is_valid = ast_ari_validate_{{c_name}}( ast_json_object_iter_value(iter)); {{/is_list}} {{/type}} @@ -113,9 +113,9 @@ int ari_validate_{{c_id}}(struct ast_json *json) 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}} diff --git a/rest-api-templates/ari_model_validators.h.mustache b/rest-api-templates/ari_model_validators.h.mustache index b5b90acddc2a2fd19c531128f9d1b11d20fccf64..6d8673e6bd7ccc6c9b7f57abb0c3421b0ca0f6ad 100644 --- a/rest-api-templates/ari_model_validators.h.mustache +++ b/rest-api-templates/ari_model_validators.h.mustache @@ -19,7 +19,7 @@ * \brief Generated file - Build validators for ARI model objects. * * In addition to the normal validation functions one would normally expect, - * each validator has a ari_validate_{id}_fn() companion function that returns + * each validator has a ast_ari_validate_{id}_fn() companion function that returns * the validator's function pointer. * * The reason for this seamingly useless indirection is the way function @@ -50,7 +50,7 @@ * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_void(struct ast_json *json); +int ast_ari_validate_void(struct ast_json *json); /*! * \brief Validator for native Swagger byte. @@ -59,7 +59,7 @@ int ari_validate_void(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_byte(struct ast_json *json); +int ast_ari_validate_byte(struct ast_json *json); /*! * \brief Validator for native Swagger boolean. @@ -68,7 +68,7 @@ int ari_validate_byte(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_boolean(struct ast_json *json); +int ast_ari_validate_boolean(struct ast_json *json); /*! * \brief Validator for native Swagger int. @@ -77,7 +77,7 @@ int ari_validate_boolean(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_int(struct ast_json *json); +int ast_ari_validate_int(struct ast_json *json); /*! * \brief Validator for native Swagger long. @@ -86,7 +86,7 @@ int ari_validate_int(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_long(struct ast_json *json); +int ast_ari_validate_long(struct ast_json *json); /*! * \brief Validator for native Swagger float. @@ -95,7 +95,7 @@ int ari_validate_long(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_float(struct ast_json *json); +int ast_ari_validate_float(struct ast_json *json); /*! * \brief Validator for native Swagger double. @@ -104,7 +104,7 @@ int ari_validate_float(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_double(struct ast_json *json); +int ast_ari_validate_double(struct ast_json *json); /*! * \brief Validator for native Swagger string. @@ -113,7 +113,7 @@ int ari_validate_double(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_string(struct ast_json *json); +int ast_ari_validate_string(struct ast_json *json); /*! * \brief Validator for native Swagger date. @@ -122,7 +122,7 @@ int ari_validate_string(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_date(struct ast_json *json); +int ast_ari_validate_date(struct ast_json *json); /*! * \brief Validator for a Swagger List[]/JSON array. @@ -132,7 +132,7 @@ int ari_validate_date(struct ast_json *json); * \returns True (non-zero) if valid. * \returns False (zero) if invalid. */ -int ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *)); +int ast_ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *)); /*! @} */ @@ -153,14 +153,14 @@ typedef int (*ari_validator)(struct ast_json *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}} diff --git a/rest-api-templates/stasis_http_resource.c.mustache b/rest-api-templates/ari_resource.c.mustache similarity index 77% rename from rest-api-templates/stasis_http_resource.c.mustache rename to rest-api-templates/ari_resource.c.mustache index 2610f6a5eff302686977a1dacbe006ac862a667d..cdbd283e488423c5266b203ca9868695d54292e3 100644 --- a/rest-api-templates/stasis_http_resource.c.mustache +++ b/rest-api-templates/ari_resource.c.mustache @@ -33,19 +33,19 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") {{#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}} diff --git a/rest-api-templates/stasis_http_resource.h.mustache b/rest-api-templates/ari_resource.h.mustache similarity index 76% rename from rest-api-templates/stasis_http_resource.h.mustache rename to rest-api-templates/ari_resource.h.mustache index a018a1dd3996cbdafb47ae6d070b4ab6d648f9f5..6396e2b73e7f148d4dd8201001f792b54848d812 100644 --- a/rest-api-templates/stasis_http_resource.h.mustache +++ b/rest-api-templates/ari_resource.h.mustache @@ -20,7 +20,7 @@ /*! \file * * \brief Generated file - declares stubs to be implemented in - * res/stasis_http/resource_{{name}}.c + * res/ari/resource_{{name}}.c * * {{{description}}} * @@ -30,17 +30,17 @@ /* {{> 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}} @@ -61,7 +61,7 @@ struct ast_{{c_nickname}}_args { * \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}} /*! @@ -75,7 +75,7 @@ void stasis_http_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nic * \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}} diff --git a/rest-api-templates/make_ari_stubs.py b/rest-api-templates/make_ari_stubs.py index 6f59e3813aa3950412c2514a714a4327968ef4f9..8058862fd2e549174ef96dbcbd128c9325fc5d3f 100755 --- a/rest-api-templates/make_ari_stubs.py +++ b/rest-api-templates/make_ari_stubs.py @@ -44,22 +44,22 @@ WIKI_PREFIX = 'Asterisk 12' 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'), ] diff --git a/rest-api-templates/res_stasis_http_resource.c.mustache b/rest-api-templates/res_ari_resource.c.mustache similarity index 77% rename from rest-api-templates/res_stasis_http_resource.c.mustache rename to rest-api-templates/res_ari_resource.c.mustache index 4eda1c5fab4153cb9712a0d498c69208dc9b4dbd..4f1986c7d49b660e787d75ab4d93fae694ef3a25 100644 --- a/rest-api-templates/res_stasis_http_resource.c.mustache +++ b/rest-api-templates/res_ari_resource.c.mustache @@ -26,7 +26,7 @@ /* {{> 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 @@ -37,7 +37,7 @@ */ /*** 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> ***/ @@ -48,9 +48,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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}} @@ -63,9 +63,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * \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; @@ -73,7 +73,7 @@ static void stasis_http_{{c_nickname}}_cb( #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; @@ -92,11 +92,11 @@ static void stasis_http_{{c_nickname}}_cb( 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}} @@ -108,18 +108,18 @@ static void stasis_http_{{c_nickname}}_cb( 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 @@ -128,16 +128,16 @@ static void stasis_http_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session, {{/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}} @@ -161,18 +161,18 @@ static int load_module(void) {{#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); @@ -186,6 +186,6 @@ static int unload_module(void) 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}} diff --git a/rest-api-templates/rest_handler.mustache b/rest-api-templates/rest_handler.mustache index 68b98811daf7ee4127f13af8660db53d976041f0..ceff6a72d0774b43b5aa6b3cbf5b68f0ef78064c 100644 --- a/rest-api-templates/rest_handler.mustache +++ b/rest-api-templates/rest_handler.mustache @@ -17,7 +17,7 @@ }} {{! * Recursive partial template to render a rest_handler. Used in - * res_stasis_http_resource.c.mustache. + * res_ari_resource.c.mustache. }} {{#children}} {{> rest_handler}} @@ -31,7 +31,7 @@ static struct stasis_rest_handlers {{full_name}} = { .callbacks = { {{#operations}} {{#is_req}} - [{{c_http_method}}] = stasis_http_{{c_nickname}}_cb, + [{{c_http_method}}] = ast_ari_{{c_nickname}}_cb, {{/is_req}} {{/operations}} }, diff --git a/tests/test_stasis_http.c b/tests/test_ari.c similarity index 80% rename from tests/test_stasis_http.c rename to tests/test_ari.c index 68bc4e7b772142fde7822019d925943c57143919..f984c3d2d0cd3594647bcef54aeda89c53706445 100644 --- a/tests/test_stasis_http.c +++ b/tests/test_ari.c @@ -17,7 +17,7 @@ */ /*! - * \file \brief Test Stasis HTTP API. + * \file \brief Test ARI API. * \author\verbatim David M. Lee, II <dlee@digium.com> \endverbatim * * \ingroup tests @@ -25,7 +25,7 @@ /*** MODULEINFO <depend>TEST_FRAMEWORK</depend> - <depend>res_stasis_http</depend> + <depend>res_ari</depend> <support_level>core</support_level> ***/ @@ -35,7 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/test.h" -#include "asterisk/stasis_http.h" +#include "asterisk/ari.h" /*!@{*/ @@ -62,7 +62,7 @@ static void handler(const char *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) { struct ast_json *message = ast_json_pack("{s: s, s: {}, s: {}, s: {}}", "name", name, @@ -98,7 +98,7 @@ static void handler(const char *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); \ } @@ -149,20 +149,20 @@ static struct stasis_rest_handlers test_root = { /*! * \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; @@ -179,7 +179,7 @@ static void response_free(struct stasis_http_response *resp) 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; } @@ -192,13 +192,13 @@ static void tear_down_invocation_test(void *ignore) { 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; @@ -206,9 +206,9 @@ AST_TEST_DEFINE(get_docs) 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; @@ -216,7 +216,7 @@ AST_TEST_DEFINE(get_docs) 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 */ @@ -230,23 +230,23 @@ AST_TEST_DEFINE(get_docs) 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 */ @@ -258,22 +258,22 @@ AST_TEST_DEFINE(get_docs_nohost) 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; @@ -281,22 +281,22 @@ AST_TEST_DEFINE(get_docs_notfound) 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; @@ -305,7 +305,7 @@ AST_TEST_DEFINE(get_docs_hackerz) 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; @@ -313,9 +313,9 @@ AST_TEST_DEFINE(invoke_get) 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; @@ -343,7 +343,7 @@ AST_TEST_DEFINE(invoke_get) "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); @@ -355,7 +355,7 @@ AST_TEST_DEFINE(invoke_get) 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; @@ -363,9 +363,9 @@ AST_TEST_DEFINE(invoke_wildcard) 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; @@ -380,7 +380,7 @@ AST_TEST_DEFINE(invoke_wildcard) "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); @@ -392,7 +392,7 @@ AST_TEST_DEFINE(invoke_wildcard) 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; @@ -400,9 +400,9 @@ AST_TEST_DEFINE(invoke_delete) 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; @@ -417,7 +417,7 @@ AST_TEST_DEFINE(invoke_delete) "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); @@ -429,7 +429,7 @@ AST_TEST_DEFINE(invoke_delete) 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; @@ -437,9 +437,9 @@ AST_TEST_DEFINE(invoke_post) 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; @@ -467,7 +467,7 @@ AST_TEST_DEFINE(invoke_post) "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); @@ -479,16 +479,16 @@ AST_TEST_DEFINE(invoke_post) 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; @@ -496,7 +496,7 @@ AST_TEST_DEFINE(invoke_bad_post) 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); @@ -507,16 +507,16 @@ AST_TEST_DEFINE(invoke_bad_post) 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; @@ -524,7 +524,7 @@ AST_TEST_DEFINE(invoke_not_found) 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); @@ -562,8 +562,8 @@ static int load_module(void) 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", ); diff --git a/tests/test_ari_model.c b/tests/test_ari_model.c index e881881c912b61791111a7c4a733feb94305c11b..1e293d791dc37c5a77466c3246812a60fc9e6cc1 100644 --- a/tests/test_ari_model.c +++ b/tests/test_ari_model.c @@ -36,7 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/module.h" #include "asterisk/test.h" -#include "../res/stasis_http/ari_model_validators.h" +#include "../res/ari/ari_model_validators.h" AST_TEST_DEFINE(validate_byte) { @@ -58,34 +58,34 @@ 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; } @@ -107,24 +107,24 @@ AST_TEST_DEFINE(validate_boolean) 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; } @@ -149,34 +149,34 @@ AST_TEST_DEFINE(validate_int) 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; } @@ -201,18 +201,18 @@ AST_TEST_DEFINE(validate_long) 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; } @@ -237,13 +237,13 @@ AST_TEST_DEFINE(validate_string) 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; } @@ -341,7 +341,7 @@ AST_TEST_DEFINE(validate_date) for (i = 0; i < ARRAY_LEN(valid_dates); ++i) { res = ast_json_string_set(uut, valid_dates[i]); ast_test_validate(test, 0 == res); - if (!ari_validate_date(uut)) { + if (!ast_ari_validate_date(uut)) { ast_test_status_update(test, "Expected '%s' to be a valid date\n", valid_dates[i]); @@ -352,7 +352,7 @@ AST_TEST_DEFINE(validate_date) for (i = 0; i < ARRAY_LEN(invalid_dates); ++i) { res = ast_json_string_set(uut, invalid_dates[i]); ast_test_validate(test, 0 == res); - if (ari_validate_date(uut)) { + if (ast_ari_validate_date(uut)) { ast_test_status_update(test, "Expected '%s' to be an invalid date\n", invalid_dates[i]); @@ -360,7 +360,7 @@ AST_TEST_DEFINE(validate_date) } } - ast_test_validate(test, !ari_validate_string(ast_json_null())); + ast_test_validate(test, !ast_ari_validate_string(ast_json_null())); return test_res; } @@ -385,21 +385,21 @@ AST_TEST_DEFINE(validate_list) 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; }