<div dir="ltr">"<span style="font-family:sans-serif;font-size:13px;line-height:19.049999237060547px;background-color:rgb(255,255,255)">add emulation for asterisk DIALSTATUS magic var (r:9d98d49f) <== done during ClueCon! see ML thread"</span><div>
<font face="sans-serif"><span style="line-height:19.047618865966797px">So you probably don't really want to reference that...</span></font></div><div><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><br></span></div>
<div><span style="font-family:Verdana,Arial,Helvetica,sans-serif">-Avi</span></div><div><br><div class="gmail_quote">On Wed, Jan 23, 2013 at 11:41 PM, Benoit Raymond <span dir="ltr"><<a href="mailto:benoit.raymond@amiconcept.com" target="_blank">benoit.raymond@amiconcept.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="FR-CA" link="blue" vlink="purple"><div><p class="MsoNormal"><a name="13c69603e20ce715__MailEndCompose"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Avi,<u></u><u></u></span></a></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The originate_disposition variable does indeed report the status of the b-leg regardless of the bridge to have connected or not. The bridge_hangup_cause is no longer reported (I use FS 1.3.13) but rather last_bridge_hangup_cause is reported only of the bridge completed so if the originator cancel the call, this variable won’t be there.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Having said that, I executed the info application after the bridge so I could see all the variables and parameters returned. There is a DIALSTATUS variable that matches the originate_disposition but its value is a bit different than what originate_disposition returns.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I haven’t finalize my script yet but looking at yours, it looks quite clean to me.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Cheers,<u></u><u></u></span></p>
<div class="im"><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Benoit Raymond</span></b><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">AMI Concept Inc.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Business VoIP Solutions / Web Design<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Phone: <a href="tel:%28450%29%20553-1231" value="+14505531231" target="_blank">(450) 553-1231</a><u></u><u></u></span></p>
<p class="MsoNormal"><a href="http://www.amiconcept.com/" target="_blank"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:blue">http://www.amiconcept.com</span></a><span lang="EN-CA" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p></div><p class="MsoNormal"><b><span lang="FR" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">De :</span></b><span lang="FR" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>De la part de</b> Avi Marcus<br>
<b>Envoyé :</b> 23 janvier 2013 02:17<br><b>À :</b> FreeSWITCH Users Help<br><b>Objet :</b> Re: [Freeswitch-users] Retrieving hangupCause from b-leg in mod_lua<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal">
<u></u> <u></u></p><div><p class="MsoNormal">Try:<u></u><u></u></p><div><div><p class="MsoNormal">cause = session:getVariable("originate_disposition")<u></u><u></u></p></div><div><p class="MsoNormal">cause2=session:getVariable("bridge_hangup_cause")<u></u><u></u></p>
</div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I'm not exactly sure what gets into which variable... But I think I needed both because sometimes "user_busy" was only in the second one. I'm not 100% sure...<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Here's my production error script here: <a href="https://gist.github.com/4602781" target="_blank">https://gist.github.com/4602781</a><u></u><u></u></p>
</div><div><p class="MsoNormal">(if the user accessed via a the calling card IVR, it passes them back to the menu. Otherwise, it hangs up on them. Remove or keep as appropriate.)<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u> <u></u></p></div><div><p class="MsoNormal">Please share your results if you are able to make it cleaner.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><br clear="all">
<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">-Avi Marcus</span><br>BestFone<u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<u></u> <u></u></p><div><p class="MsoNormal">On Wed, Jan 23, 2013 at 5:18 AM, Benoit Raymond <<a href="mailto:benoit.raymond@amiconcept.com" target="_blank">benoit.raymond@amiconcept.com</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span lang="EN-CA">Hello,</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA">Is there a way in lua to figure out why the b-leg hung up? I have an inbound call that I need to bridge so when lua is invoked, there is a session created for the inbound call and then I use session:execute(“bridge”, “the b-leg path”) and either the call is bridged or call_timeout kicks in. I need to continue my script based on the hangup cause whether the b-leg produced a NO_ANSWER, USER_BUSY or any other condition. The session:hangupCause is of no use since my session is still active.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA">I found the variable “bridge_hangup_cause” on the wiki but it returns nil if I do session:getVariable(“bridge_hangup_cause”).</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA">I am using 1.3.13</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA"> </span><u></u><u></u></p><p class="MsoNormal">
<span lang="EN-CA">Thanks much.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA"> </span><u></u><u></u></p><p class="MsoNormal"><b><span lang="EN-CA">Benoit Raymond</span></b><u></u><u></u></p><p class="MsoNormal">
<span lang="EN-CA">AMI Concept Inc.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA">Business VoIP Solutions / Web Design</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-CA">Phone: <a href="tel:(450)%20553-1231" target="_blank">(450) 553-1231</a></span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt"><a href="http://www.amiconcept.com/" target="_blank">http://www.amiconcept.com</a></span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p></div></div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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><u></u><u></u></p>
</div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></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></div>