Asterisk - The Open Source Telephony Project GIT-master-c753fe4
|
Internal API's for websockets. More...
#include "asterisk/http.h"
#include "asterisk/json.h"
#include "asterisk/vector.h"
#include "asterisk/websocket_client.h"
Go to the source code of this file.
Data Structures | |
struct | ari_ws_session |
Macros | |
#define | ARI_MAX_APP_NAME_LEN (AST_MAX_CONTEXT - STASIS_CONTEXT_PREFIX_LEN) |
#define | STASIS_CONTEXT_PREFIX "stasis-" |
#define | STASIS_CONTEXT_PREFIX_LEN (sizeof(STASIS_CONTEXT_PREFIX) - 1) |
Internal API's for websockets.
Definition in file ari_websockets.h.
#define ARI_MAX_APP_NAME_LEN (AST_MAX_CONTEXT - STASIS_CONTEXT_PREFIX_LEN) |
Definition at line 48 of file ari_websockets.h.
#define STASIS_CONTEXT_PREFIX "stasis-" |
Definition at line 46 of file ari_websockets.h.
#define STASIS_CONTEXT_PREFIX_LEN (sizeof(STASIS_CONTEXT_PREFIX) - 1) |
Definition at line 47 of file ari_websockets.h.
void ari_handle_websocket | ( | struct ast_tcptls_session_instance * | ser, |
const char * | uri, | ||
enum ast_http_method | method, | ||
struct ast_variable * | get_params, | ||
struct ast_variable * | headers | ||
) |
Wrapper for invoking the websocket code for an incoming connection.
ws_server | WebSocket server to invoke. |
ser | HTTP session. |
uri | Requested URI. |
method | Requested HTTP method. |
get_params | Parsed query parameters. |
headers | Parsed HTTP headers. |
Definition at line 267 of file ari_websockets.c.
References ast_websocket_uri_cb(), ast_ws_server, ast_http_uri::data, method, and ast_http_uri::uri.
Referenced by ast_ari_invoke().
int ari_outbound_websocket_start | ( | struct ari_conf_outbound_websocket * | owc | ) |
Definition at line 1479 of file ari_websockets.c.
References NULL, and outbound_session_create().
Referenced by ari_start_owc().
struct ari_ws_session * ari_websocket_get_session | ( | const char * | session_id | ) |
Definition at line 887 of file ari_websockets.c.
References ao2_find, OBJ_SEARCH_KEY, ari_ws_session::session_id, and session_registry.
Referenced by ari_shut_session(), and outbound_session_create().
struct ari_ws_session * ari_websocket_get_session_by_app | ( | const char * | app_name | ) |
struct ao2_container * ari_websocket_get_sessions | ( | void | ) |
Definition at line 1360 of file ari_websockets.c.
References ao2_bump, and session_registry.
Referenced by ari_show_sessions(), and ari_shut_session().
int ari_websocket_load_module | ( | int | is_enabled | ) |
Definition at line 1528 of file ari_websockets.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, ao2_container_alloc_rbtree, ari_sorcery_observer_add(), ari_websocket_unload_module(), ast_debug, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_websocket_server_add_protocol2(), ast_websocket_server_create(), ast_websocket_sub_protocol_alloc(), ast_ws_server, is_enabled(), LOG_WARNING, observer_callbacks, ast_websocket_protocol::session_attempted, ast_websocket_protocol::session_established, session_registry, websocket_attempted_cb(), and websocket_established_cb().
Referenced by load_module().
int ari_websocket_process_request | ( | struct ari_ws_session * | ast_ws_session, |
const char * | remote_addr, | ||
struct ast_variable * | upgrade_headers, | ||
const char * | app_name, | ||
struct ast_json * | msg | ||
) |
Definition at line 261 of file ari_websocket_requests.c.
References app_name(), ARI_INVOKE_SOURCE_WEBSOCKET, ast_ari_invoke(), ast_free, ast_json_dump_string_format(), ast_json_free(), AST_JSON_PRETTY, ast_str_create, ast_verbose(), ast_ari_response::fd, ast_ari_response::headers, LOG_ERROR, ast_ari_response::no_response, NULL, parse_rest_request_msg(), RAII_VAR, request(), request_destroy(), ast_ari_response::response_code, SCOPE_CALL, SCOPE_CALL_WITH_RESULT, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, send_rest_response(), stasis_app_get_debug_by_name(), str, and TRACE_ATLEAST.
Referenced by outbound_session_handler_thread(), and websocket_established_cb().
void ari_websocket_send_event | ( | struct ari_ws_session * | ari_ws_session, |
const char * | app_name, | ||
struct ast_json * | message, | ||
int | debug_app | ||
) |
Callback handler for Stasis application messages.
Definition at line 290 of file ari_websockets.c.
References ao2_lock, ao2_unlock, app_name(), ast_assert, ast_debug, ast_free_ptr(), ast_json_object_get(), ast_json_object_set(), ast_json_string_create(), ast_json_string_get(), ast_sockaddr_stringify(), ast_strings_equal(), ast_strlen_zero(), AST_VECTOR_REMOVE_CMP_ORDERED, ast_websocket_remote_address(), AST_WS_TYPE_CLIENT_PER_CALL, AST_WS_TYPE_INBOUND, LOG_WARNING, NULL, S_OR, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_LOG_RTN, session, session_send_or_queue(), and stasis_app_event_allowed().
Referenced by send_rest_response(), session_read(), and stasis_app_message_handler().
void ari_websocket_shutdown | ( | struct ari_ws_session * | session | ) |
Definition at line 1487 of file ari_websockets.c.
References NULL, session, and session_shutdown_cb().
Referenced by ari_shut_session().
void ari_websocket_shutdown_all | ( | void | ) |
Definition at line 1494 of file ari_websockets.c.
References ao2_callback, NULL, OBJ_MULTIPLE, OBJ_NODATA, session_registry, and session_shutdown_cb().
Referenced by ari_shut_sessions().
const char * ari_websocket_type_to_str | ( | enum ast_websocket_type | type | ) |
Definition at line 359 of file res/ari/config.c.
References AST_WS_TYPE_ANY, AST_WS_TYPE_CLIENT_PER_CALL, AST_WS_TYPE_CLIENT_PER_CALL_CONFIG, AST_WS_TYPE_CLIENT_PERSISTENT, AST_WS_TYPE_INBOUND, and type.
Referenced by ari_show_owc(), session_shutdown_cb(), show_owc_cb(), and show_sessions_cb().
int ari_websocket_unload_module | ( | void | ) |
Definition at line 1516 of file ari_websockets.c.
References ao2_cleanup, ari_sorcery_observer_remove(), ast_ws_server, NULL, observer_callbacks, and session_registry_dtor().
Referenced by ari_websocket_load_module(), and unload_module().