mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
ARI: REST over Websocket
This commit adds the ability to make ARI REST requests over the same
websocket used to receive events.
For full details on how to use the new capability, visit...
https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ARI-REST-over-WebSocket/
Changes:
* Added utilities to http.c:
* ast_get_http_method_from_string().
* ast_http_parse_post_form().
* Added utilities to json.c:
* ast_json_nvp_array_to_ast_variables().
* ast_variables_to_json_nvp_array().
* Added definitions for new events to carry REST responses.
* Created res/ari/ari_websocket_requests.c to house the new request handlers.
* Moved non-event specific code out of res/ari/resource_events.c into
res/ari/ari_websockets.c
* Refactored res/res_ari.c to move non-http code out of ast_ari_callback()
(which is http specific) and into ast_ari_invoke() so it can be shared
between both the http and websocket transports.
UpgradeNote: This commit adds the ability to make ARI REST requests over the same
websocket used to receive events.
See https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/ARI-REST-over-WebSocket/
(cherry picked from commit 6bc055416b
)
This commit is contained in:
committed by
Asterisk Development Team
parent
6a7038e2c5
commit
64aeb20724
@@ -143,25 +143,4 @@ struct ast_ari_conf_user *ast_ari_config_validate_user(const char *username,
|
||||
|
||||
/*! @} */
|
||||
|
||||
/* Forward-declare websocket structs. This avoids including http_websocket.h,
|
||||
* which causes optional_api stuff to happen, which makes optional_api more
|
||||
* difficult to debug. */
|
||||
|
||||
struct ast_websocket_server;
|
||||
|
||||
/*!
|
||||
* \brief Wrapper for invoking the websocket code for an incoming connection.
|
||||
*
|
||||
* \param ws_server WebSocket server to invoke.
|
||||
* \param ser HTTP session.
|
||||
* \param uri Requested URI.
|
||||
* \param method Requested HTTP method.
|
||||
* \param get_params Parsed query parameters.
|
||||
* \param headers Parsed HTTP headers.
|
||||
*/
|
||||
void ari_handle_websocket(struct ast_websocket_server *ws_server,
|
||||
struct ast_tcptls_session_instance *ser, const char *uri,
|
||||
enum ast_http_method method, struct ast_variable *get_params,
|
||||
struct ast_variable *headers);
|
||||
|
||||
#endif /* ARI_INTERNAL_H_ */
|
||||
|
Reference in New Issue
Block a user