TCP client plugin for tSIP
TCP client plugin maintains TCP connection with specified server and allows to send and receive text messages from Lua scripts. It is expected to work with plaintext and newline-terminated messages.
Installation
- copy TcpClient.dll from Release_Build directory to tSIP /phone subdirectory
- start tSIP, go to Settings/Phones (plugins) and double click TcpClient.dll on the list
- close tSIP - TcpClient.cfg would be created in /phone subdirectory next to TcpClient.dll
- edit TcpClient.cfg with text editor or JSON editor (as this is short file any text editor would be sufficient, I still might recommend JSONedit)
- fill at least Address and Port fields:
- optionally fill initialization command and command used as keepalive; don't forget terminating newline(s) if required
- start tSIP and check log if plugin connected
Usage
- you can send commands from Lua script with PluginSendMessageText function, e.g.: PluginSendMessageText("tcpclient.dll", "SEND this_would_be_command\n")
- plugin is creating few variables accessible from Lua: tcpclientConn (connection state), tcpclientConnLost (set to "1" allowing to check for connection lost and reconnection)
- plugin is creating reception queue accessible from Lua: tcpclientMsgRx; it holds up to 2000 received messages, can be ignored if these messaged don't need to be checked
- keepalive command allows to detect broken connection; plugin reconnects automatically after short delay
- example keepalive command might consist of just newline
- library can be renamed and multiple copies can be used to maintain independent TCP connections; each plugin instance would name variables and queue based on its lowercase name, e.g. connection state variable for tcpclient2.dll would be named tcpclient2Conn
- as this works with plain text / telnet - Wireshark might be useful for any debugging
Source and binary
- 2020.09.02. Initial release: TcpClient_1_0_0.zip.
Back to tSIP softphone