diff options
author | David M. Lee <dlee@digium.com> | 2013-04-22 14:58:53 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-04-22 14:58:53 +0000 |
commit | 1c21b8575bfd70b98b1102fd3dd09fc0bc335e14 (patch) | |
tree | 9a6ef6074e545ad2768bc1994e1a233fc1443729 /res/stasis_http | |
parent | 1871017cc6bd2e2ce7c638eeb6813e982377a521 (diff) |
This patch adds a RESTful HTTP interface to Asterisk.
The API itself is documented using Swagger, a lightweight mechanism for
documenting RESTful API's using JSON. This allows us to use swagger-ui
to provide executable documentation for the API, generate client
bindings in different languages, and generate a lot of the boilerplate
code for implementing the RESTful bindings. The API docs live in the
rest-api/ directory.
The RESTful bindings are generated from the Swagger API docs using a set
of Mustache templates. The code generator is written in Python, and
uses Pystache. Pystache has no dependencies, and be installed easily
using pip. Code generation code lives in rest-api-templates/.
The generated code reduces a lot of boilerplate when it comes to
handling HTTP requests. It also helps us have greater consistency in the
REST API.
(closes issue ASTERISK-20891)
Review: https://reviewboard.asterisk.org/r/2376/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis_http')
-rw-r--r-- | res/stasis_http/resource_asterisk.c | 39 | ||||
-rw-r--r-- | res/stasis_http/resource_asterisk.h | 56 | ||||
-rw-r--r-- | res/stasis_http/resource_bridges.c | 63 | ||||
-rw-r--r-- | res/stasis_http/resource_bridges.h | 154 | ||||
-rw-r--r-- | res/stasis_http/resource_channels.c | 251 | ||||
-rw-r--r-- | res/stasis_http/resource_channels.h | 244 | ||||
-rw-r--r-- | res/stasis_http/resource_endpoints.c | 43 | ||||
-rw-r--r-- | res/stasis_http/resource_endpoints.h | 69 | ||||
-rw-r--r-- | res/stasis_http/resource_events.c | 40 | ||||
-rw-r--r-- | res/stasis_http/resource_events.h | 58 | ||||
-rw-r--r-- | res/stasis_http/resource_playback.c | 43 | ||||
-rw-r--r-- | res/stasis_http/resource_playback.h | 84 | ||||
-rw-r--r-- | res/stasis_http/resource_recordings.c | 79 | ||||
-rw-r--r-- | res/stasis_http/resource_recordings.h | 193 | ||||
-rw-r--r-- | res/stasis_http/resource_sounds.c | 39 | ||||
-rw-r--r-- | res/stasis_http/resource_sounds.h | 69 |
16 files changed, 1524 insertions, 0 deletions
diff --git a/res/stasis_http/resource_asterisk.c b/res/stasis_http/resource_asterisk.c new file mode 100644 index 000000000..b5e8b0f54 --- /dev/null +++ b/res/stasis_http/resource_asterisk.c @@ -0,0 +1,39 @@ +/* -*- C -*- + * 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 Implementation for stasis-http stubs. + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/*** MODULEINFO + <support_level>core</support_level> + ***/ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_asterisk.h" + +void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_asterisk_info\n"); +} diff --git a/res/stasis_http/resource_asterisk.h b/res/stasis_http/resource_asterisk.h new file mode 100644 index 000000000..0d373ccb2 --- /dev/null +++ b/res/stasis_http/resource_asterisk.h @@ -0,0 +1,56 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_asterisk.c + * + * Asterisk resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_ASTERISK_H +#define _ASTERISK_RESOURCE_ASTERISK_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_asterisk_info() */ +struct ast_get_asterisk_info_args { + /*! \brief Filter information returned */ + const char *only; +}; +/*! + * \brief Gets Asterisk system information. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_ASTERISK_H */ diff --git a/res/stasis_http/resource_bridges.c b/res/stasis_http/resource_bridges.c new file mode 100644 index 000000000..ca48ee725 --- /dev/null +++ b/res/stasis_http/resource_bridges.c @@ -0,0 +1,63 @@ +/* -*- C -*- + * 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 Implementation for stasis-http stubs. + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/*** MODULEINFO + <support_level>core</support_level> + ***/ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_bridges.h" + +void stasis_http_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_channel_to_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_add_channel_to_bridge\n"); +} +void stasis_http_remove_channel_from_bridge(struct ast_variable *headers, struct ast_remove_channel_from_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_remove_channel_from_bridge\n"); +} +void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_record_bridge\n"); +} +void stasis_http_get_bridge(struct ast_variable *headers, struct ast_get_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_bridge\n"); +} +void stasis_http_delete_bridge(struct ast_variable *headers, struct ast_delete_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_delete_bridge\n"); +} +void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_bridges\n"); +} +void stasis_http_new_bridge(struct ast_variable *headers, struct ast_new_bridge_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_new_bridge\n"); +} diff --git a/res/stasis_http/resource_bridges.h b/res/stasis_http/resource_bridges.h new file mode 100644 index 000000000..db6db205b --- /dev/null +++ b/res/stasis_http/resource_bridges.h @@ -0,0 +1,154 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_bridges.c + * + * Bridge resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_BRIDGES_H +#define _ASTERISK_RESOURCE_BRIDGES_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_bridges() */ +struct ast_get_bridges_args { +}; +/*! + * \brief List active bridges. + * + * \param headers HTTP headers + * \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() */ +struct ast_new_bridge_args { + /*! \brief Type of bridge to create. */ + const char *type; +}; +/*! + * \brief Create a new bridge. + * + * This bridge persists until it has been shut down, or Asterisk has been shut down. + * + * \param headers HTTP headers + * \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() */ +struct ast_get_bridge_args { + /*! \brief Bridge's id */ + const char *bridge_id; +}; +/*! + * \brief Get bridge details. + * + * \param headers HTTP headers + * \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() */ +struct ast_delete_bridge_args { + /*! \brief Bridge's id */ + const char *bridge_id; +}; +/*! + * \brief Shut down a bridge bridge. + * + * If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand. + * + * \param headers HTTP headers + * \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() */ +struct ast_add_channel_to_bridge_args { + /*! \brief Bridge's id */ + const char *bridge_id; + /*! \brief Channel's id */ + const char *channel; +}; +/*! + * \brief Add a channel to a bridge. + * + * \param headers HTTP headers + * \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() */ +struct ast_remove_channel_from_bridge_args { + /*! \brief Bridge's id */ + const char *bridge_id; + /*! \brief Channel's id */ + const char *channel; +}; +/*! + * \brief Remove a channel from a bridge. + * + * \param headers HTTP headers + * \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_record_bridge() */ +struct ast_record_bridge_args { + /*! \brief Bridge's id */ + const char *bridge_id; + /*! \brief Recording's filename */ + const char *name; + /*! \brief Maximum duration of the recording, in seconds. 0 for no limit. */ + int max_duration_seconds; + /*! \brief Maximum duration of silence, in seconds. 0 for no limit. */ + int max_silence_seconds; + /*! \brief If true, and recording already exists, append to recording. */ + int append; + /*! \brief Play beep when recording begins */ + int beep; + /*! \brief DTMF input to terminate recording. */ + const char *terminate_on; +}; +/*! + * \brief Start a recording. + * + * This records the mixed audio from all channels participating in this bridge. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_BRIDGES_H */ diff --git a/res/stasis_http/resource_channels.c b/res/stasis_http/resource_channels.c new file mode 100644 index 000000000..3cc97c511 --- /dev/null +++ b/res/stasis_http/resource_channels.c @@ -0,0 +1,251 @@ +/* -*- C -*- + * 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 Implementation for stasis-http stubs. + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/*** MODULEINFO + <support_level>core</support_level> + ***/ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "asterisk/stasis_app.h" +#include "asterisk/stasis_channels.h" +#include "resource_channels.h" + +/*! + * \brief Finds the control object for a channel, filling the response with an + * error, if appropriate. + * \param[out] response Response to fill with an error if control is not found. + * \param channel_id ID of the channel to lookup. + * \return Channel control object. + * \return \c NULL if control object does not exist. + */ +static struct stasis_app_control *find_control( + struct stasis_http_response *response, + const char *channel_id) +{ + RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup); + + ast_assert(response != NULL); + + control = stasis_app_control_find_by_channel_id(channel_id); + if (control == NULL) { + /* Distinguish between 404 and 409 errors */ + 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", + "Channel not found"); + return NULL; + } + + stasis_http_response_error(response, 409, "Conflict", + "Channel not in Stasis application"); + return NULL; + } + + ao2_ref(control, +1); + return control; +} + +void stasis_http_dial(struct ast_variable *headers, struct ast_dial_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_dial\n"); +} + +void stasis_http_continue_in_dialplan( + struct ast_variable *headers, + struct ast_continue_in_dialplan_args *args, + struct stasis_http_response *response) +{ + RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup); + + ast_assert(response != NULL); + + control = find_control(response, args->channel_id); + if (control == NULL) { + return; + } + + stasis_app_control_continue(control); + stasis_http_response_no_content(response); +} + +void stasis_http_answer_channel(struct ast_variable *headers, + struct ast_answer_channel_args *args, + struct stasis_http_response *response) +{ + RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup); + + control = find_control(response, args->channel_id); + if (control == NULL) { + return; + } + + if (stasis_app_control_answer(control) != 0) { + stasis_http_response_error( + response, 500, "Internal Server Error", + "Failed to answer channel"); + return; + } + + stasis_http_response_no_content(response); +} + +void stasis_http_mute_channel(struct ast_variable *headers, struct ast_mute_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_mute_channel\n"); +} +void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_unmute_channel\n"); +} +void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_hold_channel\n"); +} +void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_unhold_channel\n"); +} +void stasis_http_play_on_channel(struct ast_variable *headers, struct ast_play_on_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_play_on_channel\n"); +} +void stasis_http_record_channel(struct ast_variable *headers, struct ast_record_channel_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_record_channel\n"); +} +void stasis_http_get_channel(struct ast_variable *headers, + struct ast_get_channel_args *args, + struct stasis_http_response *response) +{ + RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup); + RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup); + struct ast_channel_snapshot *snapshot; + + caching_topic = ast_channel_topic_all_cached(); + if (!caching_topic) { + stasis_http_response_error( + response, 500, "Internal Server Error", + "Message bus not initialized"); + return; + } + ao2_ref(caching_topic, +1); + + msg = stasis_cache_get(caching_topic, ast_channel_snapshot_type(), + args->channel_id); + if (!msg) { + stasis_http_response_error( + response, 404, "Not Found", + "Channel not found"); + return; + } + + snapshot = stasis_message_data(msg); + ast_assert(snapshot != NULL); + + stasis_http_response_ok(response, + ast_channel_snapshot_to_json(snapshot)); +} + +void stasis_http_delete_channel(struct ast_variable *headers, + struct ast_delete_channel_args *args, + struct stasis_http_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( + response, 404, "Not Found", + "Channel not found"); + return; + } + + ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); + + stasis_http_response_no_content(response); +} + +void stasis_http_get_channels(struct ast_variable *headers, + struct ast_get_channels_args *args, + struct stasis_http_response *response) +{ + RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup); + RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup); + RAII_VAR(struct ast_json *, json, NULL, ast_json_unref); + struct ao2_iterator i; + void *obj; + + caching_topic = ast_channel_topic_all_cached(); + if (!caching_topic) { + stasis_http_response_error( + response, 500, "Internal Server Error", + "Message bus not initialized"); + return; + } + ao2_ref(caching_topic, +1); + + snapshots = stasis_cache_dump(caching_topic, ast_channel_snapshot_type()); + if (!snapshots) { + stasis_http_response_alloc_failed(response); + return; + } + + json = ast_json_array_create(); + if (!json) { + stasis_http_response_alloc_failed(response); + return; + } + + i = ao2_iterator_init(snapshots, 0); + while ((obj = ao2_iterator_next(&i))) { + RAII_VAR(struct stasis_message *, msg, obj, ao2_cleanup); + struct ast_channel_snapshot *snapshot = stasis_message_data(msg); + int r = ast_json_array_append( + json, ast_channel_snapshot_to_json(snapshot)); + if (r != 0) { + stasis_http_response_alloc_failed(response); + return; + } + } + ao2_iterator_destroy(&i); + + stasis_http_response_ok(response, ast_json_ref(json)); +} + +void stasis_http_originate(struct ast_variable *headers, + struct ast_originate_args *args, + struct stasis_http_response *response) +{ + if (args->endpoint) { + ast_log(LOG_DEBUG, "Dialing specific endpoint %s\n", args->endpoint); + } + + ast_log(LOG_DEBUG, "Dialing %s@%s\n", args->extension, args->context); + /* ast_pbx_outgoing_app - originates a channel, putting it into an application */ +} diff --git a/res/stasis_http/resource_channels.h b/res/stasis_http/resource_channels.h new file mode 100644 index 000000000..2c78589b7 --- /dev/null +++ b/res/stasis_http/resource_channels.h @@ -0,0 +1,244 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_channels.c + * + * Channel resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_CHANNELS_H +#define _ASTERISK_RESOURCE_CHANNELS_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_channels() */ +struct ast_get_channels_args { +}; +/*! + * \brief List active channels. + * + * \param headers HTTP headers + * \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() */ +struct ast_originate_args { + /*! \brief Endpoint to call. If not specified, originate is routed via dialplan */ + const char *endpoint; + /*! \brief Extension to dial */ + const char *extension; + /*! \brief When routing via dialplan, the context use. If omitted, uses 'default' */ + const char *context; +}; +/*! + * \brief Create a new channel (originate). + * + * \param headers HTTP headers + * \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() */ +struct ast_get_channel_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Channel details. + * + * \param headers HTTP headers + * \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() */ +struct ast_delete_channel_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Delete (i.e. hangup) a channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_dial_args { + /*! \brief Channel's id */ + const char *channel_id; + /*! \brief Endpoint to call. If not specified, dial is routed via dialplan */ + const char *endpoint; + /*! \brief Extension to dial */ + const char *extension; + /*! \brief When routing via dialplan, the context use. If omitted, uses 'default' */ + const char *context; +}; +/*! + * \brief Create a new channel (originate) and bridge to this channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_continue_in_dialplan_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Exit application; continue execution in the dialplan. + * + * \param headers HTTP headers + * \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() */ +struct ast_answer_channel_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Answer a channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_mute_channel_args { + /*! \brief Channel's id */ + const char *channel_id; + /*! \brief Direction in which to mute audio */ + const char *direction; +}; +/*! + * \brief Mute a channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_unmute_channel_args { + /*! \brief Channel's id */ + const char *channel_id; + /*! \brief Direction in which to unmute audio */ + const char *direction; +}; +/*! + * \brief Unmute a channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_hold_channel_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Hold a channel. + * + * \param headers HTTP headers + * \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() */ +struct ast_unhold_channel_args { + /*! \brief Channel's id */ + const char *channel_id; +}; +/*! + * \brief Remove a channel from hold. + * + * \param headers HTTP headers + * \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_play_on_channel() */ +struct ast_play_on_channel_args { + /*! \brief Channel's id */ + const char *channel_id; + /*! \brief Media's URI to play. */ + const char *media; +}; +/*! + * \brief Start playback of media. + * + * The media URI may be any of a number of URI's. You may use http: and https: URI's, as well as sound: and recording: URI's. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.) + * + * \param headers HTTP headers + * \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() */ +struct ast_record_channel_args { + /*! \brief Channel's id */ + const char *channel_id; + /*! \brief Recording's filename */ + const char *name; + /*! \brief Format to encode audio in */ + const char *format; + /*! \brief Maximum duration of the recording, in seconds. 0 for no limit */ + int max_duration_seconds; + /*! \brief Maximum duration of silence, in seconds. 0 for no limit */ + int max_silence_seconds; + /*! \brief If true, and recording already exists, append to recording */ + int append; + /*! \brief Play beep when recording begins */ + int beep; + /*! \brief DTMF input to terminate recording */ + const char *terminate_on; +}; +/*! + * \brief Start a recording. + * + * Record audio from a channel. Note that this will not capture audio sent to the channel. The bridge itself has a record feature if that's what you want. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_CHANNELS_H */ diff --git a/res/stasis_http/resource_endpoints.c b/res/stasis_http/resource_endpoints.c new file mode 100644 index 000000000..b2611bad8 --- /dev/null +++ b/res/stasis_http/resource_endpoints.c @@ -0,0 +1,43 @@ +/* -*- C -*- + * 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 Implementation for stasis-http stubs. + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/*** MODULEINFO + <support_level>core</support_level> + ***/ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_endpoints.h" + +void stasis_http_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoint\n"); +} +void stasis_http_get_endpoints(struct ast_variable *headers, struct ast_get_endpoints_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_endpoints\n"); +} diff --git a/res/stasis_http/resource_endpoints.h b/res/stasis_http/resource_endpoints.h new file mode 100644 index 000000000..57f4b91ba --- /dev/null +++ b/res/stasis_http/resource_endpoints.h @@ -0,0 +1,69 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_endpoints.c + * + * Endpoint resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_ENDPOINTS_H +#define _ASTERISK_RESOURCE_ENDPOINTS_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_endpoints() */ +struct ast_get_endpoints_args { + /*! \brief Filter endpoints by type (sip,iax2,dhadi,...) */ + const char *with_type; +}; +/*! + * \brief List available endoints. + * + * \param headers HTTP headers + * \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_endpoint() */ +struct ast_get_endpoint_args { + /*! \brief ID of the endpoint */ + const char *endpoint_id; +}; +/*! + * \brief Details for an endpoint. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_ENDPOINTS_H */ diff --git a/res/stasis_http/resource_events.c b/res/stasis_http/resource_events.c new file mode 100644 index 000000000..34563fe6e --- /dev/null +++ b/res/stasis_http/resource_events.c @@ -0,0 +1,40 @@ +/* -*- C -*- + * 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 Implementation for stasis-http stubs. + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/*** MODULEINFO + <support_level>core</support_level> + ***/ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_events.h" + +void stasis_http_event_websocket(struct ast_variable *headers, struct ast_event_websocket_args *args, struct stasis_http_response *response) +{ + /* TODO: This should promote this socket to a websocket connection */ + ast_log(LOG_ERROR, "TODO: stasis_http_event_websocket\n"); +} diff --git a/res/stasis_http/resource_events.h b/res/stasis_http/resource_events.h new file mode 100644 index 000000000..0f58476df --- /dev/null +++ b/res/stasis_http/resource_events.h @@ -0,0 +1,58 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_events.c + * + * WebSocket resource + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_EVENTS_H +#define _ASTERISK_RESOURCE_EVENTS_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_event_websocket() */ +struct ast_event_websocket_args { + /*! \brief Comma seperated list of applications to subscribe to. */ + const char *app; + /*! \brief RFC6455 header for upgrading a connection to a websocket. */ + const char *upgrade; +}; +/*! + * \brief WebSocket connection for events. + * + * \param headers HTTP headers + * \param args Swagger parameters + * \param[out] response HTTP response + */ +void stasis_http_event_websocket(struct ast_variable *headers, struct ast_event_websocket_args *args, struct stasis_http_response *response); + +#endif /* _ASTERISK_RESOURCE_EVENTS_H */ diff --git a/res/stasis_http/resource_playback.c b/res/stasis_http/resource_playback.c new file mode 100644 index 000000000..99f2e09eb --- /dev/null +++ b/res/stasis_http/resource_playback.c @@ -0,0 +1,43 @@ +/* + * 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/playback.{format} implementation- Playback control resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_playback.h" + +void stasis_http_get_playback(struct ast_variable *headers, struct ast_get_playback_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_playback\n"); +} +void stasis_http_stop_playback(struct ast_variable *headers, struct ast_stop_playback_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_stop_playback\n"); +} +void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_control_playback\n"); +} diff --git a/res/stasis_http/resource_playback.h b/res/stasis_http/resource_playback.h new file mode 100644 index 000000000..36b05bc04 --- /dev/null +++ b/res/stasis_http/resource_playback.h @@ -0,0 +1,84 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_playback.c + * + * Playback control resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_PLAYBACK_H +#define _ASTERISK_RESOURCE_PLAYBACK_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_playback() */ +struct ast_get_playback_args { + /*! \brief Playback's id */ + const char *playback_id; +}; +/*! + * \brief Get a playback's details. + * + * \param headers HTTP headers + * \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() */ +struct ast_stop_playback_args { + /*! \brief Playback's id */ + const char *playback_id; +}; +/*! + * \brief Stop a playback. + * + * \param headers HTTP headers + * \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() */ +struct ast_control_playback_args { + /*! \brief Playback's id */ + const char *playback_id; + /*! \brief Operation to perform on the playback. */ + const char *operation; +}; +/*! + * \brief Get a playback's details. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */ diff --git a/res/stasis_http/resource_recordings.c b/res/stasis_http/resource_recordings.c new file mode 100644 index 000000000..2400a6876 --- /dev/null +++ b/res/stasis_http/resource_recordings.c @@ -0,0 +1,79 @@ +/* + * 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 "resource_recordings.h" + +void stasis_http_get_recordings(struct ast_variable *headers, struct ast_get_recordings_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_recordings\n"); +} +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) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_live_recording\n"); +} +void stasis_http_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_cancel_recording\n"); +} +void stasis_http_stop_recording(struct ast_variable *headers, struct ast_stop_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_stop_recording\n"); +} +void stasis_http_pause_recording(struct ast_variable *headers, struct ast_pause_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_pause_recording\n"); +} +void stasis_http_unpause_recording(struct ast_variable *headers, struct ast_unpause_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_unpause_recording\n"); +} +void stasis_http_mute_recording(struct ast_variable *headers, struct ast_mute_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_mute_recording\n"); +} +void stasis_http_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_unmute_recording\n"); +} diff --git a/res/stasis_http/resource_recordings.h b/res/stasis_http/resource_recordings.h new file mode 100644 index 000000000..ee48e43b7 --- /dev/null +++ b/res/stasis_http/resource_recordings.h @@ -0,0 +1,193 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_recordings.c + * + * Recording resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_RECORDINGS_H +#define _ASTERISK_RESOURCE_RECORDINGS_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_recordings() */ +struct ast_get_recordings_args { +}; +/*! + * \brief List all recordings. + * + * \param headers HTTP headers + * \param args Swagger parameters + * \param[out] response HTTP response + */ +void stasis_http_get_recordings(struct ast_variable *headers, struct ast_get_recordings_args *args, struct stasis_http_response *response); +/*! \brief Argument struct for stasis_http_get_stored_recordings() */ +struct ast_get_stored_recordings_args { +}; +/*! + * \brief List recordings that are complete. + * + * \param headers HTTP headers + * \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() */ +struct ast_get_stored_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Get a stored recording's details. + * + * \param headers HTTP headers + * \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() */ +struct ast_delete_stored_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Delete a stored recording. + * + * \param headers HTTP headers + * \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() */ +struct ast_get_live_recordings_args { +}; +/*! + * \brief List libe recordings. + * + * \param headers HTTP headers + * \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() */ +struct ast_get_live_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief List live recordings. + * + * \param headers HTTP headers + * \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() */ +struct ast_cancel_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Stop a live recording and discard it. + * + * \param headers HTTP headers + * \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() */ +struct ast_stop_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Stop a live recording and store it. + * + * \param headers HTTP headers + * \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() */ +struct ast_pause_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Pause a live recording. + * + * \param headers HTTP headers + * \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() */ +struct ast_unpause_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Unpause a live recording. + * + * \param headers HTTP headers + * \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() */ +struct ast_mute_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Mute a live recording. + * + * \param headers HTTP headers + * \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() */ +struct ast_unmute_recording_args { + /*! \brief Recording's id */ + const char *recording_id; +}; +/*! + * \brief Unmute a live recording. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_RECORDINGS_H */ diff --git a/res/stasis_http/resource_sounds.c b/res/stasis_http/resource_sounds.c new file mode 100644 index 000000000..a1808a159 --- /dev/null +++ b/res/stasis_http/resource_sounds.c @@ -0,0 +1,39 @@ +/* + * 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/sounds.{format} implementation- Sound resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "resource_sounds.h" + +void stasis_http_get_sounds(struct ast_variable *headers, struct ast_get_sounds_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_sounds\n"); +} +void stasis_http_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct stasis_http_response *response) +{ + ast_log(LOG_ERROR, "TODO: stasis_http_get_stored_sound\n"); +} diff --git a/res/stasis_http/resource_sounds.h b/res/stasis_http/resource_sounds.h new file mode 100644 index 000000000..f3010a920 --- /dev/null +++ b/res/stasis_http/resource_sounds.h @@ -0,0 +1,69 @@ +/* + * 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 Generated file - declares stubs to be implemented in + * res/stasis_http/resource_sounds.c + * + * Sound resources + * + * \author David M. Lee, II <dlee@digium.com> + */ + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! 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 + */ + +#ifndef _ASTERISK_RESOURCE_SOUNDS_H +#define _ASTERISK_RESOURCE_SOUNDS_H + +#include "asterisk/stasis_http.h" + +/*! \brief Argument struct for stasis_http_get_sounds() */ +struct ast_get_sounds_args { + const char *lang; + const char *format; +}; +/*! + * \brief List all sounds. + * + * \param headers HTTP headers + * \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() */ +struct ast_get_stored_sound_args { + /*! \brief Sound's id */ + const char *sound_id; +}; +/*! + * \brief Get a sound's details. + * + * \param headers HTTP headers + * \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); + +#endif /* _ASTERISK_RESOURCE_SOUNDS_H */ |