[Freeswitch-users] Lua creating multiple session's

Anthony Minessale anthony.minessale at gmail.com
Thu May 23 22:02:01 MSD 2013


Yes the constructor is blocking until the session has media or is concluded
to have failed to setup (whichever comes first)
If you need to do things async you can either use ESL from a remote
process.  You can also write your app in C so you have more control and
ability to do that type of thing.


On Thu, May 23, 2013 at 6:36 AM, Jon Schøpzinsky <jos at firstcom.dk> wrote:

> 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
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130523/bd9f0515/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list