Asterisk - The Open Source Telephony Project
18.5.0
|
WebSocket resource. More...
#include "asterisk.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
#include "ari/resource_events.h"
#include "ari/ari_model_validators.h"
#include "asterisk/http_websocket.h"
Go to the source code of this file.
Macros | |
#define | MAX_VALS 128 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | ast_ari_events_event_websocket_ws_attempted_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *headers, const char *session_id) |
static void | ast_ari_events_event_websocket_ws_established_cb (struct ast_websocket *ws_session, struct ast_variable *get_params, struct ast_variable *headers) |
static void | ast_ari_events_user_event_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
Parameter parsing callback for /events/user/{eventName}. More... | |
int | ast_ari_events_user_event_parse_body (struct ast_json *body, struct ast_ari_events_user_event_args *args) |
Body parsing function for /events/user/{eventName}. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - WebSocket resource" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_http_websocket", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct stasis_rest_handlers | events |
REST handler for /api-docs/events.json. More... | |
static struct stasis_rest_handlers | events_user |
REST handler for /api-docs/events.json. More... | |
static struct stasis_rest_handlers | events_user_eventName |
REST handler for /api-docs/events.json. More... | |
WebSocket resource.
Definition in file res_ari_events.c.
#define MAX_VALS 128 |
Definition at line 53 of file res_ari_events.c.
Referenced by ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), and ast_ari_events_user_event_cb().
|
static |
Definition at line 473 of file res_ari_events.c.
|
static |
Definition at line 473 of file res_ari_events.c.
|
static |
Definition at line 55 of file res_ari_events.c.
References ast_ari_events_event_websocket_args::app, ast_ari_events_event_websocket_args::app_count, ast_ari_events_event_websocket_args::app_parse, ARRAY_LEN, ast_app_separate_args, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_websocket_events_event_websocket_attempted(), ast_calloc, ast_free, ast_http_error(), ast_json_dump_string, ast_json_free(), ast_log, ast_malloc, ast_strdup, ast_true(), LOG_ERROR, MAX_VALS, ast_variable::name, ast_variable::next, NULL, RAII_VAR, ast_ari_events_event_websocket_args::subscribe_all, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 144 of file res_ari_events.c.
References ao2_cleanup, ast_ari_events_event_websocket_args::app, ast_ari_events_event_websocket_args::app_count, ast_ari_events_event_websocket_args::app_parse, ARRAY_LEN, ast_app_separate_args, ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_message_fn(), ast_ari_websocket_events_event_websocket_established(), ast_ari_websocket_session_create(), ast_calloc, ast_free, ast_json_dump_string, ast_json_free(), ast_log, ast_malloc, ast_strdup, ast_true(), AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_unref(), ast_websocket_write(), LOG_ERROR, MAX_VALS, ast_variable::name, ast_variable::next, NULL, RAII_VAR, SCOPED_MODULE_USE, ast_module_info::self, session, ast_ari_events_event_websocket_args::subscribe_all, and ast_variable::value.
Referenced by load_module().
|
static |
Parameter parsing callback for /events/user/{eventName}.
get_params | GET parameters in the HTTP request. | |
path_vars | Path variables extracted from the request. | |
headers | HTTP headers. | |
[out] | response | Response to the HTTP request. |
Definition at line 290 of file res_ari_events.c.
References ast_ari_events_user_event_args::application, ARRAY_LEN, ast_app_separate_args, ast_ari_events_user_event(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_void(), ast_free, ast_log, ast_malloc, ast_strdup, ast_ari_events_user_event_args::event_name, LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, ast_ari_events_user_event_args::source, ast_ari_events_user_event_args::source_count, ast_ari_events_user_event_args::source_parse, ast_variable::value, and ast_ari_events_user_event_args::variables.
int ast_ari_events_user_event_parse_body | ( | struct ast_json * | body, |
struct ast_ari_events_user_event_args * | args | ||
) |
Body parsing function for /events/user/{eventName}.
body | The JSON body from which to parse parameters. | |
[out] | args | The args structure to parse into. |
zero | on success |
non-zero | on failure |
Definition at line 241 of file res_ari_events.c.
References ast_ari_events_user_event_args::application, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), ast_malloc, ast_ari_events_user_event_args::source, and ast_ari_events_user_event_args::source_count.
Referenced by ast_ari_events_user_event().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 473 of file res_ari_events.c.
|
static |
Definition at line 432 of file res_ari_events.c.
References ao2_ref, ast_ari_add_handler(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_ari_websocket_events_event_websocket_dtor(), ast_ari_websocket_events_event_websocket_init(), AST_MODFLAG_DEFAULT, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ast_websocket_server_add_protocol2(), ast_websocket_server_create(), ast_websocket_sub_protocol_alloc(), ASTERISK_GPL_KEY, NULL, ast_websocket_protocol::session_attempted, ast_websocket_protocol::session_established, unload_module(), and stasis_rest_handlers::ws_server.
|
static |
Definition at line 423 of file res_ari_events.c.
References ao2_cleanup, ast_ari_remove_handler(), ast_ari_websocket_events_event_websocket_dtor(), NULL, and stasis_rest_handlers::ws_server.
Referenced by load_module().
|
static |
Definition at line 473 of file res_ari_events.c.
|
static |
Definition at line 473 of file res_ari_events.c.
|
static |
REST handler for /api-docs/events.json.
Definition at line 415 of file res_ari_events.c.
|
static |
REST handler for /api-docs/events.json.
Definition at line 407 of file res_ari_events.c.
|
static |
REST handler for /api-docs/events.json.
Definition at line 397 of file res_ari_events.c.