<span style='font-family:Verdana'><span style='font-size:12px'>Many thanks, Avi ! The following code worked for me:<br />
<br />
local ob_session = freeswitch.Session("{return_ring_ready=true,execute_on_answer=lua ob_answer.lua}" .. called_id,session)<br />
<br />
<div>
        if (ob_session:ready()) then</div>
<div>
         freeswitch.bridge(session,ob_session)<br />
        else<br />
         --- process failure here<br />
        end<br />
        <br />
        All channel data related to the bridge and both legs are available from ob_answer.lua via session:getVariable()<br />
        <br />
        All the best / Mike</div>
<div>
        <br />
         </div>
<br />
<p style="margin:0px; padding:0px;" >
         </p>
<blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite">
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></p>
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">From: Avi Marcus</span></span></p>
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">Sent: 07/15/11 01:48 AM</span></span></p>
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">To: FreeSWITCH Users Help</span></span></p>
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: [Freeswitch-users] non-blocking bridge in Lua</span></span></p>
        <br />
        <div>
                <div>
                        <div>
                                Some options:</div>
                        You can set an execute_on_answer on the leg B to run your new lua script
                        <div>
                                <a href="http://wiki.freeswitch.org/wiki/Variable_execute_on_answer" target="_blank">http://wiki.freeswitch.org/wiki/Variable_execute_on_answer</a></div>
                        <div>
                                 </div>
                        <div>
                                Or, you can schedule all this stuff in the originate string, with either execute_on_answer or export nolocal:api_on_answer=sched_transfer or the like.</div>
                        <div>
                                 </div>
                        <div>
                                <div>
                                        <span style="font-family:Verdana, Arial, Helvetica, sans-serif"><span style="font-size:small">-Avi Marcus</span></span></div>
                                <br />
                                <br />
                                <div class="gmail_quote">
                                        On Fri, Jul 15, 2011 at 1:31 AM, Mi Ke <span><<a href="http://mi.ke" target="_blank">mi.ke</a>@<a href="http://null.net" target="_blank">null.net</a>></span> wrote:<br />
                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
                                                <div>
                                                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">Hi all !<br />
                                                        <br />
                                                        I want to make a Lua app which will start with Leg A, collect input, initiate outbound Leg B and when it answers, periodically play decreasing series of beeps to Leg A depending on how many minutes left to disconnect (remaining time queried via odbc). <br />
                                                        <br />
                                                        My initial idea was to issue a non-blocking bridge command after Leg B session originate returns ring-ready and then to do the rest in while loop, but the bridge called by api:executeString("bgapi bridge legB_session legA_session") just returns Job UUID without actually bridging sessions. A usual freeswitch.bridge call blocks further script execution until unbridged, disallowing me to check Leg B states when it's active.<br />
                                                        <br />
                                                        Is there any elegant way to acheive my goals using Lua/Dialplan apps ? To create an app starting with Leg A and constantly watching for Leg B existense/states, playing corresponding feedback messages to Leg A ?<br />
                                                        <br />
                                                        Thanks in advance for yours hints/responses<br />
                                                        <br />
                                                        Mike</span></span><br />
                                                         </span></span></div>
                                                <br />
                                                _______________________________________________<br />
                                                Join us at ClueCon 2011, Aug 9-11, Chicago<br />
                                                <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<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>
                        </div>
                </div>
        </div>
</blockquote>
<p style="margin:0px; padding:0px;" >
         </p>
</span></span>