[Freeswitch-users] Lua event hook limitations

Eugene Prokopiev enp at itx.ru
Tue Jul 28 12:17:14 UTC 2020


Hi,

What is allowed do in lua event hook and what is not?

I tried to catch UA register event and send call to registered UA, so I did:

<configuration name="lua.conf">
<settings>
<hook event="CUSTOM" subclass="sofia::register" script="reg2call.lua"/>
</settings>
</configuration>

local name  = event:getHeader("username")
local realm = event:getHeader("realm")
local user  = string.format("%s@%s", name, realm)

freeswitch.consoleLog("notice", string.format("REGISTRATION FROM USER
%s\n", user))

local session = freeswitch.Session(string.format("user/%s", user))
session:setAutoHangup(false)
session:transfer("000", "XML", "webrtc")
freeswitch.consoleLog("notice", string.format("USER %s TRANSFER\n", user))

But in many cases I receiving CUSTOM sofia::register event with some
delay (up to 2 mins)

Why and how it can be fixed?

-- 
WBR,
Eugene Prokopiev



More information about the FreeSWITCH-users mailing list