Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Asterisk RESTful API hooks. More...
Go to the source code of this file.
Data Structures | |
struct | ast_ari_response |
struct | stasis_rest_handlers |
Handler for a single RESTful path segment. More... | |
Typedefs | |
typedef void(* | stasis_rest_callback) (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) |
Callback type for RESTful method handlers. More... | |
Functions | |
int | ast_ari_add_handler (struct stasis_rest_handlers *handler) |
void | ast_ari_get_docs (const char *uri, const char *prefix, struct ast_variable *headers, struct ast_ari_response *response) |
void | ast_ari_invoke (struct ast_tcptls_session_instance *ser, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
enum ast_json_encoding_format | ast_ari_json_format (void) |
Configured encoding format for JSON output. More... | |
struct ast_json * | ast_ari_oom_json (void) |
The stock message to return when out of memory. More... | |
int | ast_ari_remove_handler (struct stasis_rest_handlers *handler) |
void | ast_ari_response_accepted (struct ast_ari_response *response) |
Fill in a Accepted (202) ast_ari_response. More... | |
void | ast_ari_response_alloc_failed (struct ast_ari_response *response) |
Fill in response with a 500 message for allocation failures. More... | |
void | ast_ari_response_created (struct ast_ari_response *response, const char *url, struct ast_json *message) |
Fill in a Created (201) ast_ari_response. More... | |
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. More... | |
void | ast_ari_response_no_content (struct ast_ari_response *response) |
Fill in a No Content (204) ast_ari_response. More... | |
void | ast_ari_response_ok (struct ast_ari_response *response, struct ast_json *message) |
Fill in an OK (200) ast_ari_response. More... | |
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. More... | |
struct ast_sockaddr * | ast_ari_websocket_session_get_remote_addr (struct ast_ari_websocket_session *session) |
Get the remote address from an ARI WebSocket. More... | |
const char * | ast_ari_websocket_session_id (const struct ast_ari_websocket_session *session) |
Get the Session ID for an ARI WebSocket. More... | |
struct ast_json * | ast_ari_websocket_session_read (struct ast_ari_websocket_session *session) |
Read a message from an ARI WebSocket. More... | |
int | ast_ari_websocket_session_write (struct ast_ari_websocket_session *session, struct ast_json *message) |
Send a message to an ARI WebSocket. More... | |
Asterisk RESTful API hooks.
This header file is used mostly as glue code between generated declarations and res_ari.c.
Definition in file ari.h.
typedef void(* stasis_rest_callback) (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) |
Callback type for RESTful method handlers.
ser | TCP/TLS session object | |
get_params | GET parameters from the HTTP request. | |
path_vars | Path variables from any wildcard path segments. | |
headers | HTTP headers from the HTTP requiest. | |
body | ||
[out] | response | The RESTful response. |
int ast_ari_add_handler | ( | struct stasis_rest_handlers * | handler | ) |
Add a resource for REST handling.
handler | Handler to add. |
0 | on success. |
non-zero | on failure. |
Definition at line 179 of file res_ari.c.
References ao2_alloc, ao2_cleanup, ao2_ref, handler(), lock, NULL, stasis_rest_handlers::num_children, RAII_VAR, root_handler, root_handler_lock, and SCOPED_MUTEX.
Referenced by load_module(), and setup_invocation_test().
void ast_ari_get_docs | ( | const char * | uri, |
const char * | prefix, | ||
struct ast_variable * | headers, | ||
struct ast_ari_response * | response | ||
) |
Definition at line 598 of file res_ari.c.
References ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_response_ok(), ast_begins_with(), ast_config_AST_DATA_DIR, ast_debug, ast_free, ast_json_load_new_file(), ast_json_object_del(), ast_json_object_get(), ast_json_object_set(), ast_json_stringf(), ast_log, ast_std_free(), ast_str_append(), ast_str_buffer(), ast_str_create, errno, error(), LOG_ERROR, ast_variable::name, ast_variable::next, NULL, prefix, RAII_VAR, and ast_variable::value.
Referenced by ast_ari_callback(), and AST_TEST_DEFINE().
void ast_ari_invoke | ( | struct ast_tcptls_session_instance * | ser, |
const char * | uri, | ||
enum ast_http_method | method, | ||
struct ast_variable * | get_params, | ||
struct ast_variable * | headers, | ||
struct ast_json * | body, | ||
struct ast_ari_response * | response | ||
) |
Definition at line 491 of file res_ari.c.
References add_allow_header(), ao2_cleanup, ari_handle_websocket(), ast_ari_response_error(), ast_assert, ast_debug, ast_get_http_method(), AST_HTTP_GET, AST_HTTP_MAX_METHOD, AST_HTTP_OPTIONS, ast_log, ast_strdupa, ast_uri_decode(), ast_uri_http_legacy, ast_variable_new, ast_variables_destroy(), get_root_handler(), handle_options(), handler(), stasis_rest_handlers::is_wildcard, LOG_ERROR, ast_ari_response::message, method, ast_variable::next, ast_ari_response::no_response, NULL, stasis_rest_handlers::path_segment, RAII_VAR, ast_ari_response::response_code, and strsep().
Referenced by ast_ari_callback(), and AST_TEST_DEFINE().
enum ast_json_encoding_format ast_ari_json_format | ( | void | ) |
Configured encoding format for JSON output.
Definition at line 806 of file res_ari.c.
References ao2_cleanup, ast_ari_config_get(), NULL, and RAII_VAR.
Referenced by ast_ari_callback(), ast_ari_websocket_session_write(), and stasis_app_message_handler().
struct ast_json * ast_ari_oom_json | ( | void | ) |
The stock message to return when out of memory.
The refcount is NOT bumped on this object, so ast_json_ref() if you want to keep the reference.
Definition at line 174 of file res_ari.c.
References oom_json.
int ast_ari_remove_handler | ( | struct stasis_rest_handlers * | handler | ) |
Remove a resource for REST handling.
handler | Handler to add. |
0 | on success. |
non-zero | on failure. |
Definition at line 202 of file res_ari.c.
References ao2_alloc, ao2_cleanup, ast_assert, ast_mutex_lock, ast_mutex_unlock, stasis_rest_handlers::children, handler(), NULL, stasis_rest_handlers::num_children, root_handler, and root_handler_lock.
Referenced by tear_down_invocation_test(), and unload_module().
void ast_ari_response_accepted | ( | struct ast_ari_response * | response | ) |
Fill in a Accepted
(202) ast_ari_response.
Definition at line 291 of file res_ari.c.
References ast_json_null(), ast_ari_response::message, ast_ari_response::response_code, and ast_ari_response::response_text.
Referenced by ast_ari_asterisk_reload_module().
void ast_ari_response_alloc_failed | ( | struct ast_ari_response * | response | ) |
Fill in response with a 500 message for allocation failures.
response | Response to fill in. |
Definition at line 298 of file res_ari.c.
References ast_json_ref(), ast_ari_response::message, oom_json, ast_ari_response::response_code, and ast_ari_response::response_text.
Referenced by ari_bridges_play_helper(), ari_bridges_play_new(), ari_channels_handle_originate_with_id(), ast_ari_applications_subscribe_cb(), ast_ari_applications_unsubscribe_cb(), ast_ari_asterisk_add_log_cb(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_global_var_cb(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_info_cb(), ast_ari_asterisk_get_module(), ast_ari_asterisk_list_modules(), ast_ari_asterisk_set_global_var_cb(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel(), ast_ari_bridges_add_channel_cb(), ast_ari_bridges_create_cb(), ast_ari_bridges_create_with_id_cb(), ast_ari_bridges_list(), ast_ari_bridges_play_cb(), ast_ari_bridges_play_with_id_cb(), ast_ari_bridges_record(), ast_ari_bridges_record_cb(), ast_ari_bridges_remove_channel_cb(), ast_ari_bridges_start_moh(), ast_ari_bridges_start_moh_cb(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_continue_in_dialplan_cb(), ast_ari_channels_create(), ast_ari_channels_dial(), ast_ari_channels_dial_cb(), ast_ari_channels_get_channel_var(), ast_ari_channels_get_channel_var_cb(), ast_ari_channels_hangup_cb(), ast_ari_channels_list(), ast_ari_channels_move_cb(), ast_ari_channels_mute_cb(), ast_ari_channels_play_cb(), ast_ari_channels_play_with_id_cb(), ast_ari_channels_record_cb(), ast_ari_channels_redirect_cb(), ast_ari_channels_send_dtmf_cb(), ast_ari_channels_set_channel_var_cb(), ast_ari_channels_snoop_channel_cb(), ast_ari_channels_snoop_channel_with_id_cb(), ast_ari_channels_start_moh_cb(), ast_ari_channels_unmute_cb(), ast_ari_device_states_update_cb(), ast_ari_endpoints_get(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_ari_events_user_event_cb(), ast_ari_get_docs(), ast_ari_mailboxes_update_cb(), ast_ari_playbacks_control_cb(), ast_ari_recordings_copy_stored_cb(), ast_ari_recordings_list_stored(), ast_ari_sounds_list_cb(), control_list_create(), handle_options(), json_to_ast_variables(), return_sorcery_object(), send_message(), and send_refer().
void ast_ari_response_created | ( | struct ast_ari_response * | response, |
const char * | url, | ||
struct ast_json * | message | ||
) |
Fill in a Created
(201) ast_ari_response.
response | Response to fill in. |
url | URL to the created resource. |
message | JSON response. This reference is stolen, so just ast_json_ref if you need to keep a reference to it. |
Definition at line 305 of file res_ari.c.
References ao2_cleanup, ast_str_append(), get_root_handler(), ast_ari_response::headers, ast_ari_response::message, RAII_VAR, ast_ari_response::response_code, ast_ari_response::response_text, and url.
Referenced by ari_bridges_play_found(), ari_bridges_play_new(), ari_channels_handle_play(), ast_ari_bridges_record(), and ast_ari_channels_record().
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.
response | Response to fill in. |
response_code | HTTP response code. |
response_text | Text corresponding to the HTTP response code. |
message_fmt | Error message format string. |
Definition at line 259 of file res_ari.c.
References ast_json_pack(), ast_json_ref(), ast_json_unref(), ast_json_vstringf(), ast_ari_response::message, NULL, RAII_VAR, ast_ari_response::response_code, and ast_ari_response::response_text.
Referenced by ari_bridges_play_helper(), ari_bridges_play_new(), ari_channels_handle_originate_with_id(), ari_channels_handle_play(), ari_channels_handle_snoop_channel(), ast_ari_applications_filter(), ast_ari_applications_filter_cb(), ast_ari_applications_get(), ast_ari_applications_get_cb(), ast_ari_applications_list(), ast_ari_applications_list_cb(), ast_ari_applications_subscribe(), ast_ari_applications_subscribe_cb(), ast_ari_applications_unsubscribe(), ast_ari_applications_unsubscribe_cb(), ast_ari_asterisk_add_log(), ast_ari_asterisk_add_log_cb(), ast_ari_asterisk_delete_log(), ast_ari_asterisk_delete_log_cb(), ast_ari_asterisk_delete_object(), ast_ari_asterisk_delete_object_cb(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_global_var_cb(), ast_ari_asterisk_get_info_cb(), ast_ari_asterisk_get_module(), ast_ari_asterisk_get_module_cb(), ast_ari_asterisk_get_object(), ast_ari_asterisk_get_object_cb(), ast_ari_asterisk_list_log_channels(), ast_ari_asterisk_list_log_channels_cb(), ast_ari_asterisk_list_modules_cb(), ast_ari_asterisk_load_module(), ast_ari_asterisk_load_module_cb(), ast_ari_asterisk_ping_cb(), ast_ari_asterisk_reload_module(), ast_ari_asterisk_reload_module_cb(), ast_ari_asterisk_rotate_log(), ast_ari_asterisk_rotate_log_cb(), ast_ari_asterisk_set_global_var(), ast_ari_asterisk_set_global_var_cb(), ast_ari_asterisk_unload_module(), ast_ari_asterisk_unload_module_cb(), ast_ari_asterisk_update_object(), ast_ari_asterisk_update_object_cb(), ast_ari_bridges_add_channel_cb(), ast_ari_bridges_clear_video_source_cb(), ast_ari_bridges_create(), ast_ari_bridges_create_cb(), ast_ari_bridges_create_with_id(), ast_ari_bridges_create_with_id_cb(), ast_ari_bridges_destroy_cb(), ast_ari_bridges_get(), ast_ari_bridges_get_cb(), ast_ari_bridges_list_cb(), ast_ari_bridges_play_cb(), ast_ari_bridges_play_with_id_cb(), ast_ari_bridges_record(), ast_ari_bridges_record_cb(), ast_ari_bridges_remove_channel(), ast_ari_bridges_remove_channel_cb(), ast_ari_bridges_set_video_source(), ast_ari_bridges_set_video_source_cb(), ast_ari_bridges_start_moh_cb(), ast_ari_bridges_stop_moh(), ast_ari_bridges_stop_moh_cb(), ast_ari_callback(), ast_ari_channels_answer(), ast_ari_channels_answer_cb(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_continue_in_dialplan_cb(), ast_ari_channels_create(), ast_ari_channels_create_cb(), ast_ari_channels_dial(), ast_ari_channels_dial_cb(), ast_ari_channels_external_media(), ast_ari_channels_external_media_cb(), ast_ari_channels_get(), ast_ari_channels_get_cb(), ast_ari_channels_get_channel_var(), ast_ari_channels_get_channel_var_cb(), ast_ari_channels_hangup(), ast_ari_channels_hangup_cb(), ast_ari_channels_hold_cb(), ast_ari_channels_list_cb(), ast_ari_channels_move(), ast_ari_channels_move_cb(), ast_ari_channels_mute(), ast_ari_channels_mute_cb(), ast_ari_channels_originate_cb(), ast_ari_channels_originate_with_id_cb(), ast_ari_channels_play_cb(), ast_ari_channels_play_with_id_cb(), ast_ari_channels_record(), ast_ari_channels_record_cb(), ast_ari_channels_redirect(), ast_ari_channels_redirect_cb(), ast_ari_channels_ring_cb(), ast_ari_channels_ring_stop_cb(), ast_ari_channels_rtpstatistics(), ast_ari_channels_rtpstatistics_cb(), ast_ari_channels_send_dtmf(), ast_ari_channels_send_dtmf_cb(), ast_ari_channels_set_channel_var(), ast_ari_channels_set_channel_var_cb(), ast_ari_channels_snoop_channel_cb(), ast_ari_channels_snoop_channel_with_id_cb(), ast_ari_channels_start_moh_cb(), ast_ari_channels_start_silence_cb(), ast_ari_channels_stop_moh_cb(), ast_ari_channels_stop_silence_cb(), ast_ari_channels_unhold_cb(), ast_ari_channels_unmute(), ast_ari_channels_unmute_cb(), ast_ari_device_states_delete(), ast_ari_device_states_delete_cb(), ast_ari_device_states_get(), ast_ari_device_states_get_cb(), ast_ari_device_states_list(), ast_ari_device_states_list_cb(), ast_ari_device_states_update(), ast_ari_device_states_update_cb(), ast_ari_endpoints_get(), ast_ari_endpoints_get_cb(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_endpoints_list_by_tech_cb(), ast_ari_endpoints_list_cb(), ast_ari_endpoints_refer_cb(), ast_ari_endpoints_refer_to_endpoint(), ast_ari_endpoints_refer_to_endpoint_cb(), ast_ari_endpoints_send_message_cb(), ast_ari_endpoints_send_message_to_endpoint(), ast_ari_endpoints_send_message_to_endpoint_cb(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_ari_events_user_event(), ast_ari_events_user_event_cb(), ast_ari_get_docs(), ast_ari_invoke(), ast_ari_mailboxes_delete(), ast_ari_mailboxes_delete_cb(), ast_ari_mailboxes_get(), ast_ari_mailboxes_get_cb(), ast_ari_mailboxes_list(), ast_ari_mailboxes_list_cb(), ast_ari_mailboxes_update(), ast_ari_mailboxes_update_cb(), ast_ari_playbacks_control(), ast_ari_playbacks_control_cb(), ast_ari_playbacks_get(), ast_ari_playbacks_get_cb(), ast_ari_playbacks_stop(), ast_ari_playbacks_stop_cb(), ast_ari_recordings_cancel_cb(), ast_ari_recordings_copy_stored(), ast_ari_recordings_copy_stored_cb(), ast_ari_recordings_delete_stored(), ast_ari_recordings_delete_stored_cb(), ast_ari_recordings_get_live(), ast_ari_recordings_get_live_cb(), ast_ari_recordings_get_stored(), ast_ari_recordings_get_stored_cb(), ast_ari_recordings_get_stored_file(), ast_ari_recordings_get_stored_file_cb(), ast_ari_recordings_list_stored_cb(), ast_ari_recordings_mute_cb(), ast_ari_recordings_pause_cb(), ast_ari_recordings_stop_cb(), ast_ari_recordings_unmute_cb(), ast_ari_recordings_unpause_cb(), ast_ari_sounds_get(), ast_ari_sounds_get_cb(), ast_ari_sounds_list(), ast_ari_sounds_list_cb(), channel_state_invalid(), check_add_remove_channel(), control_list_create(), control_recording(), external_media_audiosocket_tcp(), find_bridge(), find_channel_control(), find_control(), json_to_ast_variables(), remove_trailing_slash(), send_message(), and send_refer().
void ast_ari_response_no_content | ( | struct ast_ari_response * | response | ) |
Fill in a No Content
(204) ast_ari_response.
Definition at line 284 of file res_ari.c.
References ast_json_null(), ast_ari_response::message, ast_ari_response::response_code, and ast_ari_response::response_text.
Referenced by ast_ari_asterisk_add_log(), ast_ari_asterisk_delete_log(), ast_ari_asterisk_delete_object(), ast_ari_asterisk_load_module(), ast_ari_asterisk_reload_module(), ast_ari_asterisk_rotate_log(), ast_ari_asterisk_set_global_var(), ast_ari_asterisk_unload_module(), ast_ari_bridges_add_channel(), ast_ari_bridges_clear_video_source(), ast_ari_bridges_destroy(), ast_ari_bridges_remove_channel(), ast_ari_bridges_set_video_source(), ast_ari_bridges_start_moh(), ast_ari_bridges_stop_moh(), ast_ari_channels_answer(), ast_ari_channels_continue_in_dialplan(), ast_ari_channels_dial(), ast_ari_channels_hangup(), ast_ari_channels_hold(), ast_ari_channels_move(), ast_ari_channels_mute(), ast_ari_channels_redirect(), ast_ari_channels_ring(), ast_ari_channels_ring_stop(), ast_ari_channels_send_dtmf(), ast_ari_channels_set_channel_var(), ast_ari_channels_start_moh(), ast_ari_channels_start_silence(), ast_ari_channels_stop_moh(), ast_ari_channels_stop_silence(), ast_ari_channels_unhold(), ast_ari_channels_unmute(), ast_ari_device_states_delete(), ast_ari_device_states_update(), ast_ari_events_user_event(), ast_ari_mailboxes_delete(), ast_ari_mailboxes_update(), ast_ari_playbacks_control(), ast_ari_playbacks_stop(), ast_ari_recordings_delete_stored(), control_recording(), and handle_options().
void ast_ari_response_ok | ( | struct ast_ari_response * | response, |
struct ast_json * | message | ||
) |
Fill in an OK
(200) ast_ari_response.
response | Response to fill in. |
message | JSON response. This reference is stolen, so just ast_json_ref if you need to keep a reference to it. |
Definition at line 276 of file res_ari.c.
References ast_ari_response::message, ast_ari_response::response_code, and ast_ari_response::response_text.
Referenced by ari_channels_handle_originate_with_id(), ari_channels_handle_snoop_channel(), ast_ari_applications_filter(), ast_ari_applications_get(), ast_ari_applications_list(), ast_ari_applications_subscribe(), ast_ari_applications_unsubscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_module(), ast_ari_asterisk_list_log_channels(), ast_ari_asterisk_list_modules(), ast_ari_asterisk_ping(), ast_ari_bridges_create(), ast_ari_bridges_create_with_id(), ast_ari_bridges_get(), ast_ari_bridges_list(), ast_ari_channels_create(), ast_ari_channels_get(), ast_ari_channels_get_channel_var(), ast_ari_channels_list(), ast_ari_channels_rtpstatistics(), ast_ari_device_states_get(), ast_ari_device_states_list(), ast_ari_endpoints_get(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_get_docs(), ast_ari_mailboxes_get(), ast_ari_mailboxes_list(), ast_ari_playbacks_get(), ast_ari_recordings_copy_stored(), ast_ari_recordings_get_live(), ast_ari_recordings_get_stored(), ast_ari_recordings_get_stored_file(), ast_ari_recordings_list_stored(), ast_ari_sounds_get(), ast_ari_sounds_list(), and return_sorcery_object().
struct ast_ari_websocket_session * ast_ari_websocket_session_create | ( | struct ast_websocket * | ws_session, |
int(*)(struct ast_json *) | validator | ||
) |
Create an ARI WebSocket session.
If NULL
is given for the validator function, no validation will be performed.
ws_session | Underlying WebSocket session. |
validator | Function to validate outgoing messages. |
NULL | on error. |
Definition at line 54 of file ari_websockets.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_ari_config_get(), ast_log, ast_websocket_set_nonblock(), ast_websocket_set_timeout(), config, errno, LOG_ERROR, LOG_WARNING, NULL, null_validator(), RAII_VAR, session, ast_ari_websocket_session::validator, websocket_session_dtor(), and ast_ari_websocket_session::ws_session.
Referenced by ast_ari_events_event_websocket_ws_established_cb().
struct ast_sockaddr * ast_ari_websocket_session_get_remote_addr | ( | struct ast_ari_websocket_session * | session | ) |
Get the remote address from an ARI WebSocket.
session | Session to write to. |
Definition at line 185 of file ari_websockets.c.
References ast_websocket_remote_address(), and session.
Referenced by ast_ari_websocket_session_write(), and stasis_app_message_handler().
const char * ast_ari_websocket_session_id | ( | const struct ast_ari_websocket_session * | session | ) |
Get the Session ID for an ARI WebSocket.
session | Session to query. |
NULL | on error. |
Definition at line 203 of file ari_websockets.c.
References ast_websocket_session_id(), and session.
Referenced by ast_ari_websocket_events_event_websocket_established().
struct ast_json * ast_ari_websocket_session_read | ( | struct ast_ari_websocket_session * | session | ) |
Read a message from an ARI WebSocket.
session | Session to read from. |
NULL | if WebSocket could not be read. |
Definition at line 97 of file ari_websockets.c.
References ast_debug, ast_json_load_buf(), ast_json_ref(), ast_json_unref(), ast_log, ast_wait_for_input(), ast_websocket_fd(), AST_WEBSOCKET_OPCODE_CLOSE, AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_read(), errno, LOG_WARNING, NULL, RAII_VAR, and session.
Referenced by ast_ari_websocket_events_event_websocket_established().
int ast_ari_websocket_session_write | ( | struct ast_ari_websocket_session * | session, |
struct ast_json * | message | ||
) |
Send a message to an ARI WebSocket.
session | Session to write to. |
message | Message to send. |
0 | on success. |
Non-zero | on error. |
Definition at line 158 of file ari_websockets.c.
References ast_ari_json_format(), ast_ari_websocket_session_get_remote_addr(), ast_json_dump_string_format(), ast_json_free(), ast_log, ast_sockaddr_stringify(), ast_websocket_write_string(), LOG_ERROR, LOG_NOTICE, NULL, RAII_VAR, session, str, and VALIDATION_FAILED.
Referenced by event_session_update_websocket(), and stasis_app_message_handler().