]> git.ipfire.org Git - thirdparty/asterisk.git/commit
ARI: REST over Websocket
authorGeorge Joseph <gjoseph@sangoma.com>
Wed, 12 Mar 2025 21:58:51 +0000 (15:58 -0600)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 1 May 2025 12:44:58 +0000 (12:44 +0000)
commit2a55f064f3dce41a684bbfaff7fdcd57bf776472
tree8c9d771995c53882e4214c8b34bfc3d7a407e6f7
parent68d9a69be38586a78f5a1cec8c8f24114edaa167
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 1442c171417bd5cb1373a8ae067777277df519e1)
20 files changed:
include/asterisk/ari.h
include/asterisk/http.h
include/asterisk/json.h
main/http.c
main/json.c
res/Makefile
res/ari/ari_model_validators.c
res/ari/ari_model_validators.h
res/ari/ari_websocket_requests.c [new file with mode: 0644]
res/ari/ari_websockets.c
res/ari/ari_websockets.h [new file with mode: 0644]
res/ari/internal.h
res/ari/resource_events.c
res/ari/resource_events.h
res/res_ari.c
res/res_ari_events.c
rest-api-templates/ari_resource.h.mustache
rest-api-templates/res_ari_resource.c.mustache
rest-api/api-docs/events.json
tests/test_ari.c