- * 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.
+ * Inbound (server) TCP/TLS connections are associated with external
+ * protocols and are treated as untrusted user interfaces: they should
+ * not be allowed to execute 'dangerous' functions, and can be considered
+ * to be user interfaces (even for SIP messages) which will not handle
+ * channel media. This may need to be pushed down into the individual
+ * protocol handlers, but this seems like a good general policy. Each
+ * inbound connection runs on its own dedicated worker thread, so setting
+ * these thread-local flags here is safe.
+ *
+ * Outbound (client) connections are initiated by Asterisk itself, are not
+ * external user interfaces, and run synchronously on the caller's thread
+ * (for example a channel/PBX thread performing an outbound WebSocket dial,
+ * or ExternalIVR). Setting these flags for them would permanently poison
+ * that thread and make it refuse dangerous functions (STAT, SHELL, ...)
+ * for the remainder of its life, so skip them for client connections.