tSIP: using NirCmd utility

NirCmd utility allows to do many useful tasks without displaying any user interface. It can be started from tSIP softphone using "Execute" buttons (or keyboard shortcuts assigned to them).

Volume control

While NirCmd function list is very impressive, volume control seems to be at the top of the list as it was requested few times but still missing from tSIP. NirCmd gives very good control over it as it allows to control volume individually for each audio interface. Volume can be changed by value (+/- buttons) or set to specific value (e.g. create presets to be used for outgoing call through GSM gateways). Personally I'm mostly using separate "Skype USB phone" and I don't have the need for call volume control (set once and forgotten) but NirCmd may be convenient way to mute or reduce main volume or even volume for specific application (audio player) during call (setappvolume, changeappvolume, and muteappvolume).

It seems that best way to learn how to use NirCmd is through testing it from console while observing Windows' Volume Mixer.
Example "Volume +" button configuration for Windows XP, USB phone (device #2):
tSIP: NirCmd volume control
Same syntax seems to work with Windows 7, although NirCmd reference provides separate example with component name in quotes, like:

nircmd changesysvolume -5000 "Speakers" 1


Nircmd can be used to generate audio messages using Microsoft TTS engine, example:

function SpeakNumber(numberString)	-- part of the VAD
	-- separated digits might be preferable for 4+ digits => adding spaces
	local numberStringToSpeak = ""
	for i = 1, #numberString do
		local c = numberString:sub(i,i)
		numberStringToSpeak = numberStringToSpeak .. c .. " "

	-- let's use paths relative to exe location for nircmd
	-- (nircmd.exe placed next to tSIP.exe)
	local filename = GetExeName()
	local lastBsIndex = string.find(filename:reverse(), "\")
	local dir = string.sub(filename, 1, -lastBsIndex)
	local nircmdExe = dir .. "nircmd.exe"

	local args = string.format("speak text \"Longest hold on extension %s\"", numberStringToSpeak)
	local ret = ShellExecute("open", nircmdExe, args, nil, 0)
	print(string.format("nircmd ShellExecute return code: %d\n", ret))

local numberToSpeak = "1234"

Back to howto list.

 "Cookie monsters": 6149019    Parse time: 0.001 s