<div dir="ltr"><div><div>The api_hangup_hook quite literally launches an API command when the channel hangs up. There is also a reporting_hangup_hook that executes a bit earlier in the life cycle of the channel. In any case, if you need to "do stuff" you can do it in a script that is launched. The session_in_hangup_hook will let you access channel variables from the channel that just got hung up.<br>
<br>Here is a link to a Lua example in the wiki that shows how to use the session_in_hangup_hook in a Lua script that gets executed at hangup:<br><br><a href="https://wiki.freeswitch.org/wiki/Lua#Special_Case:_env_object">https://wiki.freeswitch.org/wiki/Lua#Special_Case:_env_object</a><br>
<br></div>I don't know anything about mod_managed so I'll have to defer to those who do. However, If you copied and pasted code directly from the source then I'd wager that check_hangup_hok() should probably be check_hangup_hook(). <br>
<br></div><div>-MC<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 28, 2014 at 10:06 AM, Andre Demattia <span dir="ltr"><<a href="mailto:andretodd@verizon.net" target="_blank">andretodd@verizon.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="font-family:Calibri,sans-serif;font-size:11pt">How does the API Hangup hook work?<br>Also in mod managed a Hangup hook crashes, not sure if its the hook you are suggesting.<br>
<br>void MangedSession::check_hangup_hok() <br> { <br> ATTACH_THREADS <br> if(!hangupDelegate){ <br> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hangupDelegate is null."); <br> return; <br> } <br> hangupDelegate(); // crashes here for null object <br>
<br><br><br><a href="https://jira.freeswitch.org/browse/FS-6484" target="_blank">https://jira.freeswitch.org/browse/FS-6484</a><br>Thanks<br>Andre <br></div></div><div dir="ltr"><hr><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">From: </span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:msc@freeswitch.org" target="_blank">Michael Collins</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Sent: </span><span style="font-family:Calibri,sans-serif;font-size:11pt">7/28/2014 12:46 PM</span><br><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">To: </span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">FreeSWITCH Users Help</a></span><br>
<span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Subject: </span><span style="font-family:Calibri,sans-serif;font-size:11pt">Re: [Freeswitch-users] FreeSWITCH SLEEP</span><br><br></div><div dir="ltr">
<div>Do you necessarily need the channel to be active while "doing stuff" or would an <a href="https://wiki.freeswitch.org/wiki/Variable_api_hangup_hook" target="_blank">api_hangup_hook</a> be sufficient? <br></div>
-MC<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 25, 2014 at 11:40 AM, Andre <span dir="ltr"><<a href="mailto:andretodd@verizon.net" target="_blank">andretodd@verizon.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div link="blue" vlink="purple" lang="EN-US"><div><div><div>
<p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">After a call I have transfer after bridge on. When the call goes back to the dial plan I want to sleep the call do some stuff and hang-up. <u></u><u></u></span></p>
<p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt"><u></u> <u></u></span></p><p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">On the original bridge I do have hangup after bridge on.<u></u><u></u></span></p>
<p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt"><u></u> <u></u></span></p><p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">What is the correct syntax for me to sleep then hangup? <u></u><u></u></span></p>
<p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">Do I have to Answer the call for sleep to work?<u></u><u></u></span></p><p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">Example: After transfer go to :<u></u><u></u></span></p>
<p><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt">//do I need to Answer again for sleep to work?<u></u><u></u></span></p><p><span lang="EN"><action application="sleep" data="5000"/><u></u><u></u></span></p>
<p><span lang="EN">// run some scripts not related to freeswitch<u></u><u></u></span></p><p><span lang="EN"><action application="hangup"/></span><span style="color:rgb(31,73,125);font-family:"Calibri","sans-serif";font-size:11pt"><u></u><u></u></span></p>
</div></div></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>
</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>