<div dir="ltr">here is the solution:<div><a href="http://blog.godson.in/2010/12/use-of-returnringready-originate.html">http://blog.godson.in/2010/12/use-of-returnringready-originate.html</a><br></div><div><br></div><div style>
when using freeswitch.Session(); in lua script, it works in blocked mode and will not terminate until receives response from the called party (or goes timeout), nevertheless i think it&#39;s a bug as the call origination cannot terminate upon receiving message from the calling party.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/22 Ashish gautam <span dir="ltr">&lt;<a href="mailto:ashish@nms.co.in" target="_blank">ashish@nms.co.in</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>Here is some question: </div><div><br></div><div>When we use api hangup hook, the session is not alive and the hangup cause cannot be grabbed based upon the uuid. So in the api hangup hook, how can it be extracted?<br>

<div><br></div><div><div><div class="h5"><br><br><div class="gmail_quote">On Sat, Jul 20, 2013 at 5:05 AM, Brian Foster <span dir="ltr">&lt;<a href="mailto:bdfoster@davri.com" target="_blank">bdfoster@davri.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I&#39;m pretty sure in your case the script is terminated as soon as the call is terminated. So you need to run a script outside of that bridge. You could use something like api hangup hook in order to run your script. Regardless of how you do it, try not to lock the thread when doing so. All sorts of weird stuff can happen if your script malfunctions.<div>



<br></div><div>Have fun.</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">Thank you,<div><br></div><div>Brian Foster</div><div>Project Manager/Owner&#39;s Representative</div><div>Davri Investments, Incorporated</div>



<div>P: +1-317-787-2686</div><div>M: +1-317-600-9753</div><div>Indianapolis, Indiana</div></div></div>
<br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 6:36 AM, Vincent Xia <span dir="ltr">&lt;<a href="mailto:gmangudai@gmail.com" target="_blank">gmangudai@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div dir="ltr"><div>the scenario is Alice calls Bob and Alice hangs up before Bob answers the call,<br></div><div>while using the default dialplan as</div><div>&lt;action application=&quot;bridge&quot; data=&quot;user/${dialed_extension}@${domain_name}&quot; /&gt;</div>




<div>Bob instantly goes hangup after Alice hung up,</div><div><br></div><div>but after change the dialplan to have a lua script process the bridging, as</div><div>&lt;action application=&quot;lua&quot; data=&quot;bridge.lua $1&quot; /&gt;  // $1 is the destination_number</div>




<div>Bob will still be ringing for quite a long time, the bridge.lua is simple:</div><div><br></div><div>dest = argv[1]</div><div><br></div><div>session:execute(&quot;set&quot;, &quot;hangup_after_bridge=true&quot;);</div>




<div>dial_string = string.format(&#39;user/%s&#39;, dest)</div><div>sessionB = freeswitch.Session(dial_string)</div><div><br></div><div>if sessionB:ready() then</div><div><span style="white-space:pre-wrap">        </span>freeswitch.bridge(session, sessionB);</div>




<div>else</div><div><span style="white-space:pre-wrap">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot;---session NOT ready \n &quot;)</div><div><span style="white-space:pre-wrap">        </span>-- ORININATOR_CANCEL can be checked here though omitted for simplicity</div>




<div><span style="white-space:pre-wrap">        </span>session:hangup();</div><div>end</div><div><br></div><div>why the bridge.lua is not able to respond to ORININATOR_CANCEL after Alice hangs up?</div><div><br></div></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">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" target="_blank">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>
<br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">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" target="_blank">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>
<br></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><span style="color:rgb(0,0,102);font-family:georgia,serif">Ashish Gautam</span><br><font face="georgia, serif" color="#000066"><br>
Nucleus Microsystems (Pvt.) Ltd.<br>
<br>Ph. 011 47574758</font>
</font></span></div></div>
<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>
<br></blockquote></div><br></div>