mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Prequisites for ARI Outbound Websockets
stasis:
* Added stasis_app_is_registered().
* Added stasis_app_control_mark_failed().
* Added stasis_app_control_is_failed().
* Fixed res_stasis_device_state so unsubscribe all works properly.
* Modified stasis_app_unregister() to unsubscribe from all event sources.
* Modified stasis_app_exec to return -1 if stasis_app_control_is_failed()
returns true.
http:
* Added ast_http_create_basic_auth_header().
md5:
* Added define for MD5_DIGEST_LENGTH.
tcptls:
* Added flag to ast_tcptls_session_args to suppress connection log messages
to give callers more control over logging.
http_websocket:
* Add flag to ast_websocket_client_options to suppress connection log messages
to give callers more control over logging.
* Added username and password to ast_websocket_client_options to support
outbound basic authentication.
* Added ast_websocket_result_to_str().
(cherry picked from commit cc92adc5fb
)
This commit is contained in:
committed by
Asterisk Development Team
parent
26d6a3da6a
commit
a6dca5bf3a
@@ -1667,6 +1667,9 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
|
||||
*/
|
||||
cleanup();
|
||||
|
||||
if (stasis_app_control_is_failed(control)) {
|
||||
res = -1;
|
||||
}
|
||||
/* The control needs to be removed from the controls container in
|
||||
* case a new PBX is started and ends up coming back into Stasis.
|
||||
*/
|
||||
@@ -1741,6 +1744,19 @@ struct stasis_app *stasis_app_get_by_name(const char *name)
|
||||
return find_app_by_name(name);
|
||||
}
|
||||
|
||||
int stasis_app_is_registered(const char *name)
|
||||
{
|
||||
struct stasis_app *app = find_app_by_name(name);
|
||||
|
||||
/*
|
||||
* It's safe to unref app here because we're not actually
|
||||
* using it or returning it.
|
||||
*/
|
||||
ao2_cleanup(app);
|
||||
|
||||
return app != NULL;
|
||||
}
|
||||
|
||||
static int append_name(void *obj, void *arg, int flags)
|
||||
{
|
||||
struct stasis_app *app = obj;
|
||||
@@ -1832,6 +1848,8 @@ int stasis_app_register_all(const char *app_name, stasis_app_cb handler, void *d
|
||||
void stasis_app_unregister(const char *app_name)
|
||||
{
|
||||
struct stasis_app *app;
|
||||
struct stasis_app_event_source *source;
|
||||
int res;
|
||||
|
||||
if (!app_name) {
|
||||
return;
|
||||
@@ -1848,6 +1866,22 @@ void stasis_app_unregister(const char *app_name)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unsubscribe from all event sources. */
|
||||
AST_RWLIST_RDLOCK(&event_sources);
|
||||
AST_LIST_TRAVERSE(&event_sources, source, next) {
|
||||
if (!source->unsubscribe || !source->is_subscribed
|
||||
|| !source->is_subscribed(app, NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
res = source->unsubscribe(app, NULL);
|
||||
if (res) {
|
||||
ast_log(LOG_WARNING, "%s: Error unsubscribing from event source '%s'\n",
|
||||
app_name, source->scheme);
|
||||
}
|
||||
}
|
||||
AST_RWLIST_UNLOCK(&event_sources);
|
||||
|
||||
app_deactivate(app);
|
||||
|
||||
/* There's a decent chance that app is ready for cleanup. Go ahead
|
||||
|
Reference in New Issue
Block a user