Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active March 22, 2025 11:02
Show Gist options
  • Save mark05e/b8f31135eda0c39366402666f41668b3 to your computer and use it in GitHub Desktop.
Save mark05e/b8f31135eda0c39366402666f41668b3 to your computer and use it in GitHub Desktop.

Integrating TSIP: Browser Protocol vs. REST API

This post explores two methods for integrating with TSIP (SIP Client): leveraging browser protocol integration and utilizing a REST API through shell2http.

Method 1: Browser Protocol Integration

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.

Method 2: REST API via shell2http

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.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment