Video doorphone

tSIP does not support video calls at the moment (version 0.1.56.1) as from my experience SIP video calls create some technical problems with interoperability and are not very popular in general. I think that part of reason for calling is that we don't have to see each other face to face. Video doorphones might be exception, although there are very few devices on the market that offer good interoperability for SIP calls - usually they are riddled with bugs, sometimes not work at all (or it is nearly impossible to find working settings and compatible device to answer the call). One decent brand seems to be 2N, but their prices are hefty.

In this application tSIP works as part of video doorphone system, but instead of "real" SIP video doorphone you can use video doorphone that supports only RTSP or separate network camera. PC monitor is used to display video streamed directly from camera to media player while audio is handled either by softphone or by desk phone - it doesn't even has to be SIP phone.
Video doorphone with tSIP and mplayer

The idea is to trigger (launch) mplayer when doorphone extension (not necessary SIP doorphone) becomes active. For this purpose "on blf state" event script is used. To receive BLF events from PABX you have to add BLF button for doorphone extension and then configure following script as "on blf state":

local execSourceType = GetExecSourceType()	-- 7 = BLF state change
if execSourceType ~= 7 then
	print("Unexpected context for BLF state script!\n")
	return
end
local contactId = GetExecSourceId()			-- contact id in this context

local number, state = GetBlfState(contactId)

-- replace with your doorphone number
if number ~= "100" then
  return
end

--[[
for state value:
enum dialog_info_status {
	DIALOG_INFO_UNKNOWN = 0,		///< not subscribed / subscription failed
	DIALOG_INFO_TERMINATED,
	DIALOG_INFO_EARLY,
	DIALOG_INFO_CONFIRMED
};
If contactId is out of range (e.g. there is no subscription) then value = -1 is returned.
This is unexpected in script running on event though.
]]

if state == 3 then -- DIALOG_INFO_CONFIRMED
  -- start media player
  ShellExecute("open", "D:\\OperaVideoCache\\OperaVideoCache.exe", "ffmpeg://rtsp://camera_ip/stream_url", nil, 1)
else
  -- close media player
  local winapi = require("tsip_winapi")
  local hWnd = winapi.FindWindow(nil, "Opera Video Cache Player")
  if hWnd ~= 0 then
  	-- 16 = WM_CLOSE
  	print("Sending WM_CLOSE\n")
  	winapi.SendMessage(hWnd, 16, 0, 0) 
  end  
end

As extension state changes to "CONFIRMED" immediately after it starts calling video can be received before answering the connection from doorphone. From my tests it may require roughly 5 seconds to show video stream - I haven't done extensive testing but it seems to be related to buffering in mplayer and/or selected bitrate from camera.

I've used my other application, Opera Video Cache Player (OVCP) - basically frontend for mplayer - as it remembers its window size and location thus can be placed in convenient way on the screen. As mplayer is running in slave mode its console is not visible and OVCP hides all the controls, thus minimal part of the screen is wasted for preview. OVCP also remembers volume level, so audio transmitter over RTSP can be muted if softphone is used same time.

Back to tSIP softphone


 "Cookie monsters": 3150005    Parse time: 0.000 s