tSIP softphone: record pause/resume/status

tSIP adds two new button types:

and new script event, "on recording state", allowing to present current state (idle/active/pause) to the user. Following example script uses caption of the button #1 to show this state as text:

local targetButtonId = 1

local execSourceType = GetExecSourceType()
if execSourceType ~= 14 then
	print("Unhandled script source!\n")
local recorderId = GetExecSourceId()

local recorderState = GetRecorderState(recorderId)
local recorderStateStr = "???"
if recorderState == 0 then
	recorderStateStr = "idle"
elseif recorderState == 1 then
	recorderStateStr = "active"
elseif recorderState == 2 then
	recorderStateStr = "paused"

local str = string.format("REC: %s", recorderStateStr)
SetButtonCaption(targetButtonId, str) 

Before tSIP version 0.3 recorder ID was always equal to 0. Starting with tSIP it is equal to call ID. If multiple call feature is used (multiple LINE buttons are defined) then record state display should probably be placed next to each LINE button.

For a better readabity SetButtonImage function can be used with or without function setting button text.

Back to howto list

 "Cookie monsters": 7741416    Parse time: 0.001 s