<span>Michale,</span><br /><span> </span><br /><span>thanks again. That's what I wanted to hear from you!</span><br /><span> </span><br /><span>Sergey,</span><br /><span> </span><br /><span>in my FS server, it works like explained on wiki:</span><br /><span> </span><br /><span> </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> </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. </span><br /><span> </span><br /><span> </span><br /><span> </span><br /><span>Thanks for your test, anyway.</span><br /><span> </span><br /><span>-----Messaggio originale-----</span><br /><span>Da: Sergey Scheglov <sid@eltc.ru></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 />> Hi,<br />> <br />> thank you for your help, but doesn't work.<br />> legA:ready() is true when the first session start and not when the<br />> call is answered. So legB is called at the same time.<br />> <br />> Any other suggestion?<br />> <br />> <br />> <br />> <br />> -----Messaggio originale-----<br />> Da: Sergey Scheglov <br />> Inviato il: 13 Set 2011 - 17:15<br />> A: freeswitch-users@lists.freeswitch.org<br />> <br />> <br />> ? 13 Sep 2011 09:39:33 -0000<br />> chrisbware@interfree.it wrote:<br />> <br />> ><br />> > Hi guys,<br />> ><br />> > I've read anything on this argument on Wiki but I can't find a<br />> > complete answer.<br />> ><br />> > I need to bridge two calls in Lua, waiting the first to be answered.<br />> > My basic script is:<br />> ><br />> > local GwParams =<br />> > "origination_caller_id_number="..gateway..",sip_auth_username="..gateway..",sip_auth_password="..sip_passwd<br />> > local slegA =<br />> > "[ignore_early_media=false,"..GwParams.."]sofia/external/"..callee.."@"..sip_domain<br />> > local slegB =<br />> > "[ignore_early_media=true,"..GwParams.."]sofia/external/"..called.."@"..sip_domain<br />> ><br />> > legA = freeswitch.Session(slegA);<br />> > legB = freeswitch.Session(slegB);<br />> > freeswitch.bridge(legA, legB);<br />> ><br />> ><br />> > It works but legA and legB are called at the same time. Using:<br />> ><br />> > while (legA:answered()== false) do end;<br />> ><br />> > between the two session do the job but called parties can't hear<br />> > audio.<br />> ><br />> > I promise to add a script on wiki if you help me ! :)<br />> ><br />> > Thanks in advance.<br />> ><br />> ><br />> > -------------------------------------------------------------------------------<br />> > Valore legale alle tue mail<br />> > InterfreePEC - la tua Posta Elettronica Certificata<br />> > <a href="http://pec.interfree.it" target="new">http://pec.interfree.it</a><br />> > -------------------------------------------------------------------------------<br />> ><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><br />> ><br />> <br />> Try:<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 />> ----<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><br />> <br />> -------------------------------------------------------------------------------<br />> Valore legale alle tue mail<br />> InterfreePEC - la tua Posta Elettronica Certificata<br />> <a href="http://pec.interfree.it" target="new">http://pec.interfree.it</a><br />> -------------------------------------------------------------------------------<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>