Skip to content

res_websocket_client: Websocket Client Configuration

This configuration documentation is for functionality provided by res_websocket_client.

Configuration File: websocket_client.conf

[websocket_client]: Websocket Client Configuration

Since

20.15.0, 21.10.0, 22.5.0

These config objects are currently shared by the following Asterisk capabilities:

  • chan_websocket - The WebSocket channel driver.

  • res_ari - ARI Outbound WebSockets.
    They may have more specific information or restrictions on the parameters below.

Example: websocket_client.conf
;
; A connection for use by chan_websocket
[media_connection1]
type = websocket_client
uri = ws://localhost:8787
protocols = media
username = media_username
password = media_password
connection_type = per_call_config
connection_timeout = 500
reconnect_interval = 500
reconnect_attempts = 5
tls_enabled = no
;
; A TLS connection for use by ARI Outbound Websocket
[ari_connection1]
type = websocket_client
uri = wss://localhost:8765
protocols = ari
username = some_username
password = some_password
connection_type = persistent
connection_timeout = 500
reconnect_interval = 500
reconnect_attempts = 5
tls_enabled = yes
ca_list_file = /etc/pki/tls/cert.pem
verify_server_cert = no
verify_server_hostname = no

Configuration Option Reference

Option Name Type Default Value Regular Expression Description Since
ca_list_file String false File containing the server's CA certificate. (optional) 20.15.0, 21.10.0, 22.5.0
ca_list_path String false Path to a directory containing one or more hashed CA certificates. (optional) 20.15.0, 21.10.0, 22.5.0
cert_file String false File containing a client certificate. (optional) 20.15.0, 21.10.0, 22.5.0
connection_timeout Integer 500 false Connection timeout (ms). 20.15.0, 21.10.0, 22.5.0
connection_type Custom false Single persistent connection or per-call configuration. 20.15.0, 21.10.0, 22.5.0
enable_pingpongs Boolean no false Enable WebSocket PING/PONGs.. (optional) 20.21.0, 22.11.0, 23.5.0
enable_tcp_keepalives Boolean no false Enable TCP Keepalives. (optional) 20.21.0, 22.11.0, 23.5.0
password String false Server authentication password if required. 20.15.0, 21.10.0, 22.5.0
pingpong_interval Unsigned Integer 20 false Send WebSocket PINGs at this interval in seconds. (optional) 20.21.0, 22.11.0, 23.5.0
pingpong_probes Unsigned Integer 3 false Close the connection after this many missed PONG replies. (optional) 20.21.0, 22.11.0, 23.5.0
priv_key_file String false File containing the client's private key. (optional) 20.15.0, 21.10.0, 22.5.0
protocols String false Comma separated list of protocols acceptable to the server. 20.15.0, 21.10.0, 22.5.0
proxy_host String false Proxy host including port for outbound proxy if required. (optional) 20.21.0, 22.11.0, 23.5.0
proxy_password String false Proxy authentication password if required. (optional) 20.21.0, 22.11.0, 23.5.0
proxy_username String false Proxy authentication username if required. (optional) 20.21.0, 22.11.0, 23.5.0
reconnect_attempts Integer 4 false On failure, how many times should reconnection be attempted? 20.15.0, 21.10.0, 22.5.0
reconnect_interval Integer 500 false How often should reconnection be attempted (ms)? 20.15.0, 21.10.0, 22.5.0
tcp_keepalive_interval Unsigned Integer 20 false Send keepalives at this interval in seconds. (optional) 20.21.0, 22.11.0, 23.5.0
tcp_keepalive_probes Unsigned Integer 3 false Close the connection after this many missed replies. (optional) 20.21.0, 22.11.0, 23.5.0
tcp_keepalive_time Unsigned Integer 20 false Start sending keepalives when no data has been sent for this many seconds. (optional) 20.21.0, 22.11.0, 23.5.0
tls_enabled Boolean no false Enable TLS 20.15.0, 21.10.0, 22.5.0
type None false Must be "websocket_client". 20.15.0, 21.10.0, 22.5.0
uri String false Full URI to remote server. 20.15.0, 21.10.0, 22.5.0
username String false Server authentication username if required. 20.15.0, 21.10.0, 22.5.0
verify_server_cert Boolean yes false If set to true, verify the server's certificate. (optional) 20.15.0, 21.10.0, 22.5.0
verify_server_hostname Boolean yes false If set to true, verify that the server's hostname matches the common name in it's certificate. (optional) 20.15.0, 21.10.0, 22.5.0

Configuration Option Descriptions

connection_type

Since: 20.15.0, 21.10.0, 22.5.0

  • persistent - Single persistent connection for all calls.

  • per_call_config - New connection for each call to the Stasis() dialplan app.

pingpong_interval

Since: 20.21.0, 22.11.0, 23.5.0

If a reply isn't received by the time the next PING is due to be sent, it's considered missed so this option also controls how long it takes to detect a failure.

pingpong_probes

Since: 20.21.0, 22.11.0, 23.5.0

If a reply isn't received by the time the next PING is due to be sent, it's considered missepingd. The time to detect a failure is therefore between (probes * interval) and ((probes + 1) * interval) seconds. If the connection closes and reconnect_interval reconnect_attempts are set, a new connection will be attempted using those parameters.

proxy_host

Since: 20.21.0, 22.11.0, 23.5.0

If an outbound proxy is required to reach the websocket server, specify a host in the form ':<port7gt;'. Currently only http (non-TLS) proxies are supported although the tunnelled connection to the websocket server can have TLS enabled.

reconnect_attempts

Since: 20.15.0, 21.10.0, 22.5.0

For per_call connections, this is the number of (re)connection attempts to make before returning an and terminating the call. Persistent connections always retry forever but this setting will control how often failure messages are logged.

tcp_keepalive_interval

Since: 20.21.0, 22.11.0, 23.5.0

If a reply isn't received by the time the next keepalive is due to be sent, it's considered missed so this option also controls how long it takes to detect a failure.

tcp_keepalive_probes

Since: 20.21.0, 22.11.0, 23.5.0

If a reply isn't received by the time the next keepalive is due to be sent, it's considered missed. The time to detect a failure is therefore between (probes * interval) and ((probes + 1) * interval) seconds. If the connection closes and reconnect_interval reconnect_attempts are set, a new connection will be attempted using those parameters.

Generated Version

This documentation was generated from Asterisk branch 23 using version GIT