<div dir="ltr">Yes the constructor is blocking until the session has media or is concluded to have failed to setup (whichever comes first)<div>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.  </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 23, 2013 at 6:36 AM, Jon Schøpzinsky <span dir="ltr">&lt;<a href="mailto:jos@firstcom.dk" target="_blank">jos@firstcom.dk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello List,<br>
<br>
Im trying to do dial multiple destination through lua, on a single<br>
incoming call.<br>
<br>
I do know that i could do a simple session:execute(&quot;bridge&quot;,<br>
&quot;dst1,dst2,dst3&quot;) but I need to do it in individual session, for<br>
processing I need to do in a later version of the lua script.<br>
<br>
I loop through the destinations that needs to be called, creating a new<br>
session for each destination, and storing that in an array.<br>
Firstly, it seems as freeswitch.Session doesn&#39;t reply right away, but<br>
waits for early-media. Thats ok though, but makes dialling mobile devices<br>
a rather long wait.<br>
<br>
The problem is, that when I do the second freeswitch.Session, it seems to<br>
hold up further lua processing, until the last created call is answered.<br>
Is this how its supposed to work.<br>
<br>
Heres my current code:<br>
<br>
local legs = {}<br>
<br>
for key, dev in pairs(dstDevices) do<br>
      freeswitch.consoleLog(&quot;info&quot;, &quot;Lets call &quot; .. dev.username .. &quot; with<br>
tech &quot; .. dev.devicetech .. &quot;\n&quot;)<br>
      if dev.devicetech == &quot;1&quot; then<br>
        freeswitch.consoleLog(&quot;info&quot;, &quot;calling &quot; .. dev.username .. &quot; on<br>
uasbc\n&quot;)<br>
        legs[key] = freeswitch.Session(&quot;sofia/gateway/uasbc01/&quot; ..<br>
dev.username);<br>
        freeswitch.consoleLog(&quot;info&quot;, &quot;called &quot; .. dev.username .. &quot; on<br>
uasbc\n&quot;)<br>
      elseif dev.devicetech == &quot;2&quot; then<br>
        freeswitch.consoleLog(&quot;info&quot;, &quot;calling &quot; .. dev.username .. &quot; on<br>
ccsbc, mvno\n&quot;)<br>
        legs[key] =<br>
freeswitch.Session(&quot;{origination_caller_id_name=+xxxxxxxx,origination_calle<br>
r_id_number=+xxxxxxxxx}sofia/gateway/ccsbc01/+xx&quot; ..<br>
string.match(dev.username, &quot;^mvno_(.+)&quot;))<br>
        freeswitch.consoleLog(&quot;info&quot;, &quot;called &quot; .. dev.username .. &quot; on<br>
ccsbc, mvno\n&quot;)<br>
      end<br>
  End<br>
<br>
<br>
freeswitch.consoleLog(&quot;info&quot;, &quot;Enter loop now\n&quot;)<br>
<br>
It doesn&#39;t reach the last consoleLog until the last call is answered.<br>
<br>
<br>
<br>
Venlig hilsen/kind regards<br>
<br>
Jon Leren Schøpzinsky<br>
<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900
</div>