Table of Contents
List of Examples
protocol
parametertimeout_init
parametertimeout_read
parameterverbosity
parameterlwsc_notify
usagelwsc_notify_proto
usagelwsc_request
usagelwsc_request_proto
usage$lwsc(name)
usageTable of Contents
This module provides a websocket client implementation to interact with external systems, similar to http client. It is not for routing SIP traffic.
It relies on libwebsockets library (https://libwebsockets.org/).
The websocket sub-protocol.
Default value is "kmsg".
The interval in microseconds to wait for websocket connection to be initialized.
Default value is 2000000 (2 seconds).
The interval in microseconds to wait for the response of the lwsc_request() group of functions.
Default value is 2000000 (2 seconds).
Control the verbosity of debug messages on libwebsockets events, higher value means more debug messages. It has to be a positive number, currently 2 or higher results in maximum verbosity.
Default value is 0.
Send data via websockets to the address specified by wsurl. No response is expected. Transmission is not guaranteed (e.g., cannot connect to target).
The parameters are:
wsurl - websocket url
data - what to send
The parameters can contain pseudo-variables.
This function can be used from ANY_ROUTE.
Example 1.5. lwsc_notify
usage
... jwt_notify("ws://10.1.1.10:8080/log", "caller=$fU;callee=$tU;callid=$ci"); ...
Send data via websockets to the address specified by wsurl, providing websocket protocol. No response is expected. Transmission is not guaranteed (e.g., cannot connect to target).
The parameters are:
wsurl - websocket url
wsproto - websocket protocol
data - what to send
The parameters can contain pseudo-variables.
This function can be used from ANY_ROUTE.
Example 1.6. lwsc_notify_proto
usage
... jwt_notify_proto("ws://10.1.1.10:8080/log", "kmsg" "caller=$fU;callee=$tU;callid=$ci"); ...
Send data via websockets to the address specified by wsurl, a response is expected and made available in $lwsc(rdata).
The parameters are:
wsurl - websocket url
data - what to send
The parameters can contain pseudo-variables.
This function can be used from ANY_ROUTE.
Example 1.7. lwsc_request
usage
... jwt_request("ws://10.1.1.10:8080/log", "caller=$fU;callee=$tU;srcip=$si"); ...
Send data via websockets to the address specified by wsurl, providing websocket protocol. A response is expected and made available in $lwsc(rdata).
The parameters are:
wsurl - websocket url
wsproto - websocket protocol
data - what to send
The parameters can contain pseudo-variables.
This function can be used from ANY_ROUTE.
Example 1.8. lwsc_request_proto
usage
... jwt_request_proto("ws://10.1.1.10:8080/log", "kmsg", "caller=$fU;callee=$tU;srcip=$si"); ...
Get the values and attributes after using LWSC functions.
The key can be:
rdata - the response retrieved after lwsc_request().
status - the status of verification after a failed jwt_verify().
Example 1.9. $lwsc(name)
usage
... jwt_request("ws://10.1.1.10:8080/log", "caller=$fU;callee=$tU;srcip=$si"); xinfo("jwt is: $lwsc(rdata)"); ...