Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
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 "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 = AST_BUILDOPT_SUM, .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.
|
static |
Definition at line 475 of file res_ari_events.c.
|
static |
Definition at line 475 of file res_ari_events.c.
|
static |
Definition at line 55 of file res_ari_events.c.
References args, 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, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 144 of file res_ari_events.c.
References ao2_cleanup, args, 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, and ast_variable::value.
Referenced by load_module().
|
static |
Parameter parsing callback for /events/user/{eventName}.
ser | TCP/TLS session object | |
get_params | GET parameters in the HTTP request. | |
path_vars | Path variables extracted from the request. | |
headers | HTTP headers. | |
body | ||
[out] | response | Response to the HTTP request. |
Definition at line 292 of file res_ari_events.c.
References args, 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, LOG_ERROR, MAX_VALS, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.
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 args, ast_free, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_string_get(), ast_json_typeof(), and ast_malloc.
Referenced by ast_ari_events_user_event().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 475 of file res_ari_events.c.
|
static |
Definition at line 434 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_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_websocket_server_add_protocol2(), ast_websocket_server_create(), ast_websocket_sub_protocol_alloc(), events, NULL, ast_websocket_protocol::session_attempted, ast_websocket_protocol::session_established, unload_module(), and stasis_rest_handlers::ws_server.
|
static |
Definition at line 425 of file res_ari_events.c.
References ao2_cleanup, ast_ari_remove_handler(), ast_ari_websocket_events_event_websocket_dtor(), events, NULL, and stasis_rest_handlers::ws_server.
Referenced by load_module().
|
static |
Definition at line 475 of file res_ari_events.c.
|
static |
Definition at line 475 of file res_ari_events.c.
|
static |
REST handler for /api-docs/events.json.
Definition at line 417 of file res_ari_events.c.
Referenced by load_module(), and unload_module().
|
static |
REST handler for /api-docs/events.json.
Definition at line 409 of file res_ari_events.c.
|
static |
REST handler for /api-docs/events.json.
Definition at line 399 of file res_ari_events.c.