Retrieving hangupCause from b-leg in mod_lua
Hello, 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. I found the variable "bridge_hangup_cause" on the wiki but it returns nil if I do session:getVariable("bridge_hangup_cause"). I am using 1.3.13 Thanks much. Benoit Raymond AMI Concept Inc. Business VoIP Solutions / Web Design Phone: (450) 553-1231 http://www.amiconcept.com <http://www.amiconcept.com/>
Try: cause = session:getVariable("originate_disposition") cause2=session:getVariable("bridge_hangup_cause") 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... Here's my production error script here: https://gist.github.com/4602781 (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.) Please share your results if you are able to make it cleaner. -Avi Marcus BestFone On Wed, Jan 23, 2013 at 5:18 AM, Benoit Raymond < benoit.raymond@amiconcept.com> wrote:
Hello,****
** **
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.****
** **
I found the variable “bridge_hangup_cause” on the wiki but it returns nil if I do session:getVariable(“bridge_hangup_cause”).****
** **
I am using 1.3.13****
** **
Thanks much.****
** **
*Benoit Raymond*****
AMI Concept Inc.****
Business VoIP Solutions / Web Design****
Phone: (450) 553-1231****
** **
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Avi, 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 wont be there. 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. I havent finalize my script yet but looking at yours, it looks quite clean to me. Cheers, Benoit Raymond AMI Concept Inc. Business VoIP Solutions / Web Design Phone: (450) 553-1231 <http://www.amiconcept.com/> http://www.amiconcept.com De : freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] De la part de Avi Marcus Envoyé : 23 janvier 2013 02:17 À : FreeSWITCH Users Help Objet : Re: [Freeswitch-users] Retrieving hangupCause from b-leg in mod_lua Try: cause = session:getVariable("originate_disposition") cause2=session:getVariable("bridge_hangup_cause") 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... Here's my production error script here: https://gist.github.com/4602781 (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.) Please share your results if you are able to make it cleaner. -Avi Marcus BestFone On Wed, Jan 23, 2013 at 5:18 AM, Benoit Raymond <benoit.raymond@amiconcept.com> wrote: Hello, 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. I found the variable bridge_hangup_cause on the wiki but it returns nil if I do session:getVariable(bridge_hangup_cause). I am using 1.3.13 Thanks much. Benoit Raymond AMI Concept Inc. Business VoIP Solutions / Web Design Phone: (450) 553-1231 <tel:(450)%20553-1231> http://www.amiconcept.com <http://www.amiconcept.com/> _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/> FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com <http://www.cudatel.com/> Official FreeSWITCH Sites http://www.freeswitch.org <http://www.freeswitch.org/> http://wiki.freeswitch.org <http://wiki.freeswitch.org/> http://www.cluecon.com <http://www.cluecon.com/> FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org <http://www.freeswitch.org/>
"add emulation for asterisk DIALSTATUS magic var (r:9d98d49f) <== done during ClueCon! see ML thread" So you probably don't really want to reference that... -Avi On Wed, Jan 23, 2013 at 11:41 PM, Benoit Raymond < benoit.raymond@amiconcept.com> wrote:
Hi Avi,****
** **
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.****
** **
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.****
** **
I haven’t finalize my script yet but looking at yours, it looks quite clean to me.****
** **
Cheers,****
** **
*Benoit Raymond*****
AMI Concept Inc.****
Business VoIP Solutions / Web Design****
Phone: (450) 553-1231****
** **
*De :* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *De la part de* Avi Marcus *Envoyé :* 23 janvier 2013 02:17 *À :* FreeSWITCH Users Help *Objet :* Re: [Freeswitch-users] Retrieving hangupCause from b-leg in mod_lua****
** **
Try:****
cause = session:getVariable("originate_disposition")****
cause2=session:getVariable("bridge_hangup_cause")****
** **
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...****
** **
Here's my production error script here: https://gist.github.com/4602781*** *
(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.)* ***
** **
Please share your results if you are able to make it cleaner.****
** **
****
-Avi Marcus BestFone****
** **
On Wed, Jan 23, 2013 at 5:18 AM, Benoit Raymond < benoit.raymond@amiconcept.com> wrote:****
Hello,****
****
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.****
****
I found the variable “bridge_hangup_cause” on the wiki but it returns nil if I do session:getVariable(“bridge_hangup_cause”).****
****
I am using 1.3.13****
****
Thanks much.****
****
*Benoit Raymond*****
AMI Concept Inc.****
Business VoIP Solutions / Web Design****
Phone: (450) 553-1231****
****
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org****
** **
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Avi Marcus
-
Benoit Raymond