Integrating tSIP with web browser

tSIP softphone can be integrated with web browser (or e.g. mail reader like Thunderbird) using Windows' custom protocol mechanism.

To create protocol association run tSIP as administrator and use function located in Settings/Integration.
tSIP browser integration settings
Default protocol name is "tsip" but but it can be changed to e.g. "tel" or "callto" as needed. Also, multiple protocol names can be associated with same application. Association creates few registry entries under HKEY_CLASSES_ROOT:
Windows registry: SIP softphone integration
To remove association manually delete registry entries.
Note: administrator rights are needed only for protocol registration (and may collide with normal operation under Vista and newer Windows version), launch application as usual after this.

Version 0.1.19 handles two commands: CALL and HANGUP. When creating html file these commands are just plain links:
Call *74101
Answer (since 0.1.28)

Using javascript more fancy user interface can be created, e.g. offering standard telephone keyboard.

If you created association earlier you would probably see some confirmation popup from the browser that can be disabled for subsequent actions:
Opera custom protocol browser popup
Some browsers (Firefox-based in particular) may be not be able to check registry for protocol association or be not flexible enough to pass parameters as required by application.

To mitigate this problem additional batch file can be used (change path according to your exe location):

start "" "D:\_PROJEKTY\libre\tSIP\tSIP\Release_Build\tSIP.exe" /tsip="%1"

How does it work? After clicking the link tSIP.exe is launched with specified parameters. Since typically you wouldn't want to launch new copy of softphone with every new call (and it wouldn't make any sense with HANGUP command) first thing that application is doing is checking if another copy of it is running. If another copy (or more precisely: main window of another copy, though it does not have to be visible, application may sit in tray all the time) if found then new instance passes arguments to it and closes silently. If another copy is not found, then new instance executes command by itself (i.e. user sees softphone launched).

This function is intended for business/CRM-like usage, so softphone filters out from dialed number any digits outside of standard DTMF set. Thus, spaces or () for specifying regional number can be used freely inside of links.

tSIP uses WM_COPYDATA message to pass command between instances. In some cases - when target application runs with elevated privileges - newer version of Windows (Vista and above) block passing this message for security reasons. "Allow WM_COPYDATA to be passed to when elevated" disables this by using ChangeWindowMessageFilter function. Application restart is needed.

Note: protocol association in registry uses absolute path to executable - using it makes application less portable, i.e. executable of associated application should stay in same place after association. My implementation does not also handle scenario with multiple tSIP softphone copies running simultaneously - command would be passed to random application copy, although using multiple protocol names for multiple softphone instances might be workaround for this - that way you can decide which softphone copy would receive request. Javascript may be helpful in this scenario allowing to switch link protocol/softphone target on the user side.

Note: try Telify extension for Firefox and Thunderbird!
Telify configuration

 "Cookie monsters": 2672706    Parse time: 0.002 s