<span>Michale,</span><br /><span>&nbsp;</span><br /><span>thanks again. That's what I wanted to hear from you!</span><br /><span>&nbsp;</span><br /><span>Sergey,</span><br /><span>&nbsp;</span><br /><span>in my FS server, it works like explained on wiki:</span><br /><span>&nbsp;</span><br /><span>&nbsp;</span><br /><h4><span class="mw-headline">session:ready</span></h4><span>- checks whether the session is still active (true anytime<strong> between call starts and hangup</strong>)</span><br /><span>&nbsp;</span><br /><span>So is "true" even when legA is ringing. As you can see in Michael script, you need to put it on a "while do" cycle.&nbsp;</span><br /><span>&nbsp;</span><br /><span>&nbsp;</span><br /><span>&nbsp;</span><br /><span>Thanks for your test, anyway.</span><br /><span>&nbsp;</span><br /><span>-----Messaggio originale-----</span><br /><span>Da: Sergey Scheglov &lt;sid@eltc.ru&gt;</span><br /><span>Inviato il: 14 Set 2011 - 09:12</span><br /><span>A: freeswitch-users@lists.freeswitch.org</span><br /><span><br /><br />? 13 Sep 2011 12:21:38 -0000<br />chrisbware@interfree.it wrote:<br /><br />&gt; Hi,<br />&gt;  <br />&gt; thank you for your help, but doesn't work.<br />&gt; legA:ready() is true when the first session start and not when the<br />&gt; call is answered. So legB is called at the same time.<br />&gt;  <br />&gt; Any other suggestion?<br />&gt;  <br />&gt;  <br />&gt;  <br />&gt;  <br />&gt; -----Messaggio originale-----<br />&gt; Da: Sergey Scheglov <br />&gt; Inviato il: 13 Set 2011 - 17:15<br />&gt; A: freeswitch-users@lists.freeswitch.org<br />&gt; <br />&gt; <br />&gt; ? 13 Sep 2011 09:39:33 -0000<br />&gt; chrisbware@interfree.it wrote:<br />&gt; <br />&gt; &gt;<br />&gt; &gt; Hi guys,<br />&gt; &gt;<br />&gt; &gt; I've read anything on this argument on Wiki but I can't find a<br />&gt; &gt; complete answer.<br />&gt; &gt;<br />&gt; &gt; I need to bridge two calls in Lua, waiting the first to be answered.<br />&gt; &gt; My basic script is:<br />&gt; &gt;<br />&gt; &gt; local GwParams =<br />&gt; &gt; "origination_caller_id_number="..gateway..",sip_auth_username="..gateway..",sip_auth_password="..sip_passwd<br />&gt; &gt; local slegA =<br />&gt; &gt; "[ignore_early_media=false,"..GwParams.."]sofia/external/"..callee.."@"..sip_domain<br />&gt; &gt; local slegB =<br />&gt; &gt; "[ignore_early_media=true,"..GwParams.."]sofia/external/"..called.."@"..sip_domain<br />&gt; &gt;<br />&gt; &gt; legA = freeswitch.Session(slegA);<br />&gt; &gt; legB = freeswitch.Session(slegB);<br />&gt; &gt; freeswitch.bridge(legA, legB);<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt; It works but legA and legB are called at the same time. Using:<br />&gt; &gt;<br />&gt; &gt; while (legA:answered()== false) do end;<br />&gt; &gt;<br />&gt; &gt; between the two session do the job but called parties can't hear<br />&gt; &gt; audio.<br />&gt; &gt;<br />&gt; &gt; I promise to add a script on wiki if you help me ! :)<br />&gt; &gt;<br />&gt; &gt; Thanks in advance.<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt; -------------------------------------------------------------------------------<br />&gt; &gt; Valore legale alle tue mail<br />&gt; &gt; InterfreePEC - la tua Posta Elettronica Certificata<br />&gt; &gt; <a href="http://pec.interfree.it" target="new">http://pec.interfree.it</a><br />&gt; &gt; -------------------------------------------------------------------------------<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt;<br />&gt; &gt; FreeSWITCH-users mailing list<br />&gt; &gt; FreeSWITCH-users@lists.freeswitch.org<br />&gt; &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br />&gt; &gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br />&gt; &gt; <a href="http://www.freeswitch.org" target="new">http://www.freeswitch.org</a><br />&gt; &gt;<br />&gt; <br />&gt; Try:<br />&gt; <br />&gt; legA = freeswitch.Session(slegA);<br />&gt; if (legA:ready()) then<br />&gt; legB = freeswitch.Session(slegB, legA);<br />&gt; freeswitch.bridge(legA, legB);<br />&gt; end<br />&gt; <br />&gt; ----<br />&gt; <br />&gt; Scheglov Sergey<br />&gt; <br />&gt; <br />&gt; FreeSWITCH-users mailing list<br />&gt; FreeSWITCH-users@lists.freeswitch.org<br />&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br />&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br />&gt; <a href="http://www.freeswitch.org" target="new">http://www.freeswitch.org</a><br />&gt; <br />&gt; -------------------------------------------------------------------------------<br />&gt; Valore legale alle tue mail<br />&gt; InterfreePEC - la tua Posta Elettronica Certificata<br />&gt; <a href="http://pec.interfree.it" target="new">http://pec.interfree.it</a><br />&gt; -------------------------------------------------------------------------------<br /><br />Just checked this script from cli:<br />luarun test.lua<br />--<br />local slegA="user/1000"<br />local slegB="user/1001"<br /><br />legA = freeswitch.Session(slegA);<br />if (legA:ready()) then<br />legB = freeswitch.Session(slegB, legA);<br />freeswitch.bridge(legA, legB);<br />end<br /><br />Leg B is created after the leg A answered.<br /><br />Also, look this example<br /><a href="http://wiki.freeswitch.org/wiki/Bridging_two_calls_with_retry" target="new">http://wiki.freeswitch.org/wiki/Bridging_two_calls_with_retry</a><br />-- <br />Scheglov Sergey<br /><br /><br />FreeSWITCH-users mailing list<br />FreeSWITCH-users@lists.freeswitch.org<br /><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br />UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="new">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br /><a href="http://www.freeswitch.org" target="new">http://www.freeswitch.org</a></span><br />

<br>-------------------------------------------------------------------------------<br>Valore legale alle tue mail<br>InterfreePEC - la tua Posta Elettronica Certificata<br>http://pec.interfree.it<br>-------------------------------------------------------------------------------<br>