<span style='font-family:Verdana'><span style='font-size:12px'>Thanks for replying, Michael.<br />
<br />
Meanwhile if session creation fails, such session can also be considered as disconnected and gone, however its disconnect cause can be read from session:hangupCause(). To my opinion, it would be very useful if disconnect cause could be always readable in Lua after session completion since such mechanism already exists for failed sessions.<br />
<br />
Thanks / Mike<br />
<br />
<br />
<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: Michael Collins</span></span></p>
        <p style="margin:0px; padding:0px;" >
                <span style="font-family:Verdana"><span style="font-size:12px">Sent: 08/16/11 03:03 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] getting disconnect cause for a leg after bridge in Lua</span></span></p>
        <br />
        <div>
                <p style="margin:0px; padding:0px;" >
                        No, you can't do this because the session you are checking is "gone" as soon as the call leg is disconnected. You are better off using a hangup hook or an event socket application if you need to get that value in realtime. Dialplan scripts are good for connecting endpoints and doing simple logic but they are absolutely not what you want for doing any kind of billing or reporting.</p>
                <div>
                         </div>
                <div>
                        -MC<br />
                        <br />
                        <div class="gmail_quote">
                                On Sat, Aug 13, 2011 at 2:46 AM, Mi Ke <span><<a href="mailto:mi.ke@null.net" >mi.ke@null.net</a>></span> wrote:<br />
                                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
                                        <span style="font-family:Verdana"><span style="font-size:12px">Hi All,<br />
                                        <br />
                                        Is there any way to get a real disconnection cause for leg B in the following script ?<br />
                                        <br />
                                        <br />
                                        if (session_a:ready() and session_b:ready()) then</span></span><br />
                                        <div>
                                                <span style="font-family:Verdana"><span style="font-size:12px"> <br />
                                                 freeswitch.bridge(session_a,session_b)<br />
                                                <br />
                                                 -- session_b gets disconnect here ...<br />
                                                 </span></span></div>
                                        <div>
                                                <span style="font-family:Verdana"><span style="font-size:12px"> local session_b_hangup_cause = session_b:hangupCause()<br />
                                                <br />
                                                <br />
                                                <br />
                                                session_b_hangup_cause is always "SUCCESS" after debridging while log and CDR shows correct value - can get it to my script ?<br />
                                                <br />
                                                Thanks / Mike</span></span></div>
                                        <div>
                                                <span style="font-family:Verdana"><span style="font-size:12px"> </span></span></div>
                                        <div>
                                                <span style="font-family:Verdana"><span style="font-size:12px"> </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>
</blockquote>
<p style="margin:0px; padding:0px;" >
         </p>
</span></span>