This post explores two methods for integrating with TSIP (SIP Client): leveraging browser protocol integration and utilizing a REST API through shell2http.
TSIP supports a custom protocol, tsip:
, which allows direct execution of Lua scripts from a web browser. This method eliminates the need for an intermediary server.
To execute a script, construct a URL with the tsip:
protocol and the SCRIPT_B64
parameter, which contains the base64-encoded Lua script.
Example:
tsip:SCRIPT_B64=U2hvd01lc3NhZ2UoIkhlbGxvLCB3b3JsZCEiKQ==
This URL, when clicked in a browser with the tsip:
protocol association configured, will execute the Lua script ShowMessage("Hello, world!")
within TSIP.
For more complex integrations or scenarios where direct browser interaction is not suitable, a REST API can be created using shell2http. This approach allows executing TSIP commands via HTTP requests.
The following command sets up a shell2http server on port 8800, exposing an endpoint /tsip_b64script
that executes TSIP with a base64-encoded Lua script:
shell2http.exe -port 8800 -form /tsip_b64script "C:\tsip\tsip.exe /tsip=SCRIPT_B64=%v_input%"
To execute a script, send an HTTP GET request to the endpoint with the input
parameter containing the base64-encoded Lua script.
Example:
http://localhost:8800/tsip_b64script?input=U2hvd01lc3NhZ2UoIkhlbGxvLCB3b3JsZCEiKQ==
This request will execute the same Lua script as the browser protocol example.
Note: These methods only provide one way integration.