autoservice: Don't start channel autoservice if the thread is a user interface.

Executing dialplan functions from either AMI or ARI by getting a variable
could place the channel into autoservice.  However, these user interface
threads do not handle the channel's media so we wind up with two threads
attempting to handle the media.

There can be one and only one thread handling a channel's media at a time.
Otherwise, we don't know which thread is going to handle the media frames.

ASTERISK-27625

Change-Id: If2dc94ce15ddabf923ed1e2a65ea0ef56e013e49
This commit is contained in:
Richard Mudgett
2018-06-18 18:04:54 -05:00
parent da54605b8a
commit 0989b63047
4 changed files with 80 additions and 0 deletions

View File

@@ -134,6 +134,19 @@ static void *handle_tcptls_connection(void *data)
return NULL;
}
/*
* TCP/TLS connections are associated with external protocols which can
* be considered to be user interfaces (even for SIP messages), and
* will not handle channel media. This may need to be pushed down into
* the individual protocol handlers, but this seems like a good start.
*/
if (ast_thread_user_interface_set(1)) {
ast_log(LOG_ERROR, "Failed to set user interface status; killing connection\n");
ast_tcptls_close_session_file(tcptls_session);
ao2_ref(tcptls_session, -1);
return NULL;
}
if (tcptls_session->parent->tls_cfg) {
#ifdef DO_SSL
if (ast_iostream_start_tls(&tcptls_session->stream, tcptls_session->parent->tls_cfg->ssl_ctx, tcptls_session->client) < 0) {