[Freeswitch-users] Lua creating multiple session's
Jon Schøpzinsky
jos at firstcom.dk
Thu May 23 15:36:46 MSD 2013
Hello List,
Im trying to do dial multiple destination through lua, on a single
incoming call.
I do know that i could do a simple session:execute("bridge",
"dst1,dst2,dst3") but I need to do it in individual session, for
processing I need to do in a later version of the lua script.
I loop through the destinations that needs to be called, creating a new
session for each destination, and storing that in an array.
Firstly, it seems as freeswitch.Session doesn't reply right away, but
waits for early-media. Thats ok though, but makes dialling mobile devices
a rather long wait.
The problem is, that when I do the second freeswitch.Session, it seems to
hold up further lua processing, until the last created call is answered.
Is this how its supposed to work.
Heres my current code:
local legs = {}
for key, dev in pairs(dstDevices) do
freeswitch.consoleLog("info", "Lets call " .. dev.username .. " with
tech " .. dev.devicetech .. "\n")
if dev.devicetech == "1" then
freeswitch.consoleLog("info", "calling " .. dev.username .. " on
uasbc\n")
legs[key] = freeswitch.Session("sofia/gateway/uasbc01/" ..
dev.username);
freeswitch.consoleLog("info", "called " .. dev.username .. " on
uasbc\n")
elseif dev.devicetech == "2" then
freeswitch.consoleLog("info", "calling " .. dev.username .. " on
ccsbc, mvno\n")
legs[key] =
freeswitch.Session("{origination_caller_id_name=+xxxxxxxx,origination_calle
r_id_number=+xxxxxxxxx}sofia/gateway/ccsbc01/+xx" ..
string.match(dev.username, "^mvno_(.+)"))
freeswitch.consoleLog("info", "called " .. dev.username .. " on
ccsbc, mvno\n")
end
End
freeswitch.consoleLog("info", "Enter loop now\n")
It doesn't reach the last consoleLog until the last call is answered.
Venlig hilsen/kind regards
Jon Leren Schøpzinsky
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list