48 #if defined(AST_DEVMODE) 69 for (i = get_params; i; i = i->
next) {
70 if (strcmp(i->
name,
"app") == 0) {
99 "Too many values for app");
110 args.
app[j] = (vals[j]);
113 if (strcmp(i->
name,
"subscribeAll") == 0) {
121 fin: __attribute__((unused))
123 ast_http_error(ser, 500,
"Server Error",
"Memory allocation error");
125 }
else if (response->response_code != 0) {
128 if (response->message) {
135 ast_http_error(ser, response->response_code, response->response_text, msg);
161 #if defined(AST_DEVMODE) 172 for (i = get_params; i; i = i->
next) {
173 if (strcmp(i->
name,
"app") == 0) {
202 "Too many values for app");
213 args.
app[j] = (vals[j]);
216 if (strcmp(i->
name,
"subscribeAll") == 0) {
224 fin: __attribute__((unused))
225 if (response && response->response_code != 0) {
228 if (response->message) {
297 #if defined(AST_DEVMODE) 302 for (i = get_params; i; i = i->
next) {
303 if (strcmp(i->
name,
"application") == 0) {
306 if (strcmp(i->
name,
"source") == 0) {
335 "Too many values for source");
346 args.
source[j] = (vals[j]);
351 for (i = path_vars; i; i = i->
next) {
352 if (strcmp(i->
name,
"eventName") == 0) {
359 #if defined(AST_DEVMODE) 374 if (200 <= code && code <= 299) {
378 ast_log(
LOG_ERROR,
"Invalid error response %d for /events/user/{eventName}\n", code);
384 ast_log(
LOG_ERROR,
"Response validation failed for /events/user/{eventName}\n");
386 "Internal Server Error",
"Response validation failed");
390 fin: __attribute__((unused))
472 .requires =
"res_ari,res_ari_model,res_stasis,res_http_websocket",
struct ast_variable * next
Asterisk main include file. File version handling, generic pbx functions.
void ast_http_error(struct ast_tcptls_session_instance *ser, int status, const char *title, const char *text)
Send HTTP error message and close socket.
A websocket protocol implementation.
Generated file - declares stubs to be implemented in res/ari/resource_events.c.
static int load_module(void)
ast_websocket_pre_callback session_attempted
Callback called when a new session is attempted. Optional.
int ast_ari_websocket_events_event_websocket_attempted(struct ast_tcptls_session_instance *ser, struct ast_variable *headers, struct ast_ari_events_event_websocket_args *args, const char *session_id)
WebSocket connection for events.
void ast_json_free(void *p)
Asterisk's custom JSON allocator. Exposed for use by unit tests.
Structure for variables, used for configurations and for channel variables.
#define ast_json_dump_string(root)
Encode a JSON value to a compact string.
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}.
static void ast_ari_events_event_websocket_ws_established_cb(struct ast_websocket *ws_session, struct ast_variable *get_params, struct ast_variable *headers)
Generated file - Build validators for ARI model objects.
#define ast_strdup(str)
A wrapper for strdup()
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}.
struct ast_ari_websocket_session * ast_ari_websocket_session_create(struct ast_websocket *ws_session, int(*validator)(struct ast_json *))
Create an ARI WebSocket session.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
struct ast_websocket_server *AST_OPTIONAL_API_NAME() ast_websocket_server_create(void)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static int unload_module(void)
static struct ast_mansession session
#define ao2_ref(o, delta)
static struct stasis_rest_handlers events
REST handler for /api-docs/events.json.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
#define ast_malloc(len)
A wrapper for malloc()
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
describes a server instance
static struct stasis_rest_handlers events_user_eventName
REST handler for /api-docs/events.json.
struct ast_websocket_server * ws_server
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
int AST_OPTIONAL_API_NAME() ast_websocket_server_add_protocol2(struct ast_websocket_server *server, struct ast_websocket_protocol *protocol)
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)
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
int AST_OPTIONAL_API_NAME() ast_websocket_write(struct ast_websocket *session, enum ast_websocket_opcode opcode, char *payload, uint64_t payload_size)
Write function for websocket traffic.
Structure definition for session.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
Module has failed to load, may be in an inconsistent state.
static struct stasis_rest_handlers events_user
REST handler for /api-docs/events.json.
#define SCOPED_MODULE_USE(module)
int ast_ari_websocket_events_event_websocket_init(void)
WebSocket connection for events.
struct ast_json * message
struct ast_json * variables
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
void ast_ari_events_user_event(struct ast_variable *headers, struct ast_ari_events_user_event_args *args, struct ast_ari_response *response)
Generate a user event.
const char * path_segment
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
void ast_ari_websocket_events_event_websocket_dtor(void)
WebSocket connection for events.
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Abstract JSON element (object, array, string, int, ...).
ari_validator ast_ari_validate_message_fn(void)
Function pointer to ast_ari_validate_message().
Stasis Application API. See Stasis Application API for detailed documentation.
ast_websocket_callback session_established
void AST_OPTIONAL_API_NAME() ast_websocket_unref(struct ast_websocket *session)
void ast_ari_websocket_events_event_websocket_established(struct ast_ari_websocket_session *ws_session, struct ast_variable *headers, struct ast_ari_events_event_websocket_args *args)
WebSocket connection for events.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
struct ast_websocket_protocol *AST_OPTIONAL_API_NAME() ast_websocket_sub_protocol_alloc(const char *name)
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
Handler for a single RESTful path segment.
#define ast_app_separate_args(a, b, c, d)