]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_websocket_client: Create common utilities for websocket clients.
authorGeorge Joseph <gjoseph@sangoma.com>
Fri, 2 May 2025 14:52:54 +0000 (08:52 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Mon, 2 Jun 2025 15:15:09 +0000 (15:15 +0000)
commit36fc358bc9f0c67f42578f43b8f39f9255d2b54a
treecaa067b41e8377a8984c8d39c49f1ce3acc6c057
parentfe1ab659ad7bd1b67bdf09be59a9c775736e0f65
res_websocket_client: Create common utilities for websocket clients.

Since multiple Asterisk capabilities now need to create websocket clients
it makes sense to create a common set of utilities rather than making
each of those capabilities implement their own.

* A new configuration file "websocket_client.conf" is used to store common
client parameters in named configuration sections.
* APIs are provided to list and retrieve ast_websocket_client objects created
from the named configurations.
* An API is provided that accepts an ast_websocket_client object, connects
to the remote server with retries and returns an ast_websocket object. TLS is
supported as is basic authentication.
* An observer can be registered to receive notification of loaded or reloaded
client objects.
* An API is provided to compare an existing client object to one just
reloaded and return the fields that were changed. The caller can then decide
what action to take based on which fields changed.

Also as part of thie commit, several sorcery convenience macros were created
to make registering common object fields easier.

UserNote: A new module "res_websocket_client" and config file
"websocket_client.conf" have been added to support several upcoming new
capabilities that need common websocket client configuration.
configs/samples/websocket_client.conf.sample [new file with mode: 0644]
include/asterisk/http_websocket.h
include/asterisk/sorcery.h
include/asterisk/websocket_client.h [new file with mode: 0644]
res/res_http_websocket.c
res/res_websocket_client.c [new file with mode: 0644]
res/res_websocket_client.exports.in [new file with mode: 0644]