Rename everything Stasis-HTTP to ARI
This renames all files and API calls from several variants of Stasis-HTTP to ARI including: * Stasis-HTTP -> ARI * STASIS_HTTP -> ARI * stasis_http -> ari (ast_ari for global symbols, file names as well) * stasis http -> ARI Review: https://reviewboard.asterisk.org/r/2706/ (closes issue ASTERISK-22136) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
fc05248bd1
commit
d8956f690e
|
@ -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
|
||||
|
|
|
@ -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 */
|
|
@ -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,
|
||||
|
|
14
res/Makefile
14
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
|
||||
|
|
|
@ -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)
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
|
@ -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");
|
|
@ -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));
|
||||
}
|
|
@ -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);
|
|
@ -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_ */
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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));
|
||||
}
|
|
@ -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 */
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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 */
|
|
@ -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));
|
||||
}
|
|
@ -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 */
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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 */
|
|
@ -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;
|
||||
}
|
|
@ -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 */
|
|
@ -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");
|
||||
}
|
|
@ -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 */
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
global:
|
||||
LINKER_SYMBOL_PREFIXast_ari_*;
|
||||
local:
|
||||
*;
|
||||
};
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
global:
|
||||
LINKER_SYMBOL_PREFIXari_*;
|
||||
LINKER_SYMBOL_PREFIXast_ari_*;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -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",
|
||||
);
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
global:
|
||||
LINKER_SYMBOL_PREFIXstasis_http_*;
|
||||
LINKER_SYMBOL_PREFIXari_*;
|
||||
local:
|
||||
*;
|
||||
};
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -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");
|
||||
}
|
|
@ -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}}
|
|
@ -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}}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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}}
|
|
@ -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}}
|
|
@ -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'),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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}}
|
|
@ -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}}
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
);
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue