mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +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
@@ -1199,6 +1199,70 @@ int ast_ari_validate_playback_started(struct ast_json *json);
|
||||
*/
|
||||
ari_validator ast_ari_validate_playback_started_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for RESTHeader.
|
||||
*
|
||||
* REST over Websocket header
|
||||
*
|
||||
* \param json JSON object to validate.
|
||||
* \retval True (non-zero) if valid.
|
||||
* \retval False (zero) if invalid.
|
||||
*/
|
||||
int ast_ari_validate_restheader(struct ast_json *json);
|
||||
|
||||
/*!
|
||||
* \brief Function pointer to ast_ari_validate_restheader().
|
||||
*/
|
||||
ari_validator ast_ari_validate_restheader_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for RESTQueryStringParameter.
|
||||
*
|
||||
* REST over Websocket Query String Parameter
|
||||
*
|
||||
* \param json JSON object to validate.
|
||||
* \retval True (non-zero) if valid.
|
||||
* \retval False (zero) if invalid.
|
||||
*/
|
||||
int ast_ari_validate_restquery_string_parameter(struct ast_json *json);
|
||||
|
||||
/*!
|
||||
* \brief Function pointer to ast_ari_validate_restquery_string_parameter().
|
||||
*/
|
||||
ari_validator ast_ari_validate_restquery_string_parameter_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for RESTRequest.
|
||||
*
|
||||
* REST over Websocket Request.
|
||||
*
|
||||
* \param json JSON object to validate.
|
||||
* \retval True (non-zero) if valid.
|
||||
* \retval False (zero) if invalid.
|
||||
*/
|
||||
int ast_ari_validate_restrequest(struct ast_json *json);
|
||||
|
||||
/*!
|
||||
* \brief Function pointer to ast_ari_validate_restrequest().
|
||||
*/
|
||||
ari_validator ast_ari_validate_restrequest_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for RESTResponse.
|
||||
*
|
||||
* REST over Websocket Response.
|
||||
*
|
||||
* \param json JSON object to validate.
|
||||
* \retval True (non-zero) if valid.
|
||||
* \retval False (zero) if invalid.
|
||||
*/
|
||||
int ast_ari_validate_restresponse(struct ast_json *json);
|
||||
|
||||
/*!
|
||||
* \brief Function pointer to ast_ari_validate_restresponse().
|
||||
*/
|
||||
ari_validator ast_ari_validate_restresponse_fn(void);
|
||||
|
||||
/*!
|
||||
* \brief Validator for RecordingFailed.
|
||||
*
|
||||
@@ -1799,6 +1863,33 @@ ari_validator ast_ari_validate_application_fn(void);
|
||||
* - application: string (required)
|
||||
* - timestamp: Date (required)
|
||||
* - playback: Playback (required)
|
||||
* RESTHeader
|
||||
* - name: string (required)
|
||||
* - value: string (required)
|
||||
* RESTQueryStringParameter
|
||||
* - name: string (required)
|
||||
* - value: string (required)
|
||||
* RESTRequest
|
||||
* - content_type: string
|
||||
* - message_body: string
|
||||
* - method: string (required)
|
||||
* - query_strings: List[RESTQueryStringParameter]
|
||||
* - request_id: string (required)
|
||||
* - transaction_id: string (required)
|
||||
* - type: string (required)
|
||||
* - uri: string (required)
|
||||
* RESTResponse
|
||||
* - asterisk_id: string
|
||||
* - type: string (required)
|
||||
* - application: string (required)
|
||||
* - timestamp: Date (required)
|
||||
* - content_type: string
|
||||
* - message_body: string
|
||||
* - reason_phrase: string (required)
|
||||
* - request_id: string (required)
|
||||
* - status_code: int (required)
|
||||
* - transaction_id: string (required)
|
||||
* - uri: string (required)
|
||||
* RecordingFailed
|
||||
* - asterisk_id: string
|
||||
* - type: string (required)
|
||||
|
Reference in New Issue
Block a user