<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div><br>
<div class="acompli_signature">Anthony,</div>
<div class="acompli_signature"><br>
</div>
<div class="acompli_signature">Many thanks for your detailed response. &nbsp;It now makes sense to me and I will adjust my code appropriately. &nbsp;</div>
<div class="acompli_signature"><br>
</div>
<div class="acompli_signature">Andrew</div>
<br>
</div>
<div class="gmail_quote">_____________________________<br>
From: Anthony Minessale &lt;<a href="mailto:anthony.minessale@gmail.com" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="1">anthony.minessale@gmail.com</a>&gt;<br>
Sent: Friday, February 27, 2015 5:08 pm<br>
Subject: Re: [Freeswitch-users] Re- FreeSWITCH CDRs ${billsec} not correct when using Lua scripts and running a hangup handler with any delays inside it<br>
To: FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="3">freeswitch-users@lists.freeswitch.org</a>&gt;<br>
<br>
<br>
<meta content="text/html; charset=utf-8">
<div dir="ltr">I would say you did not actually understand what he was saying based on your response.
<div><br>
</div>
<div>I can try to explain: </div>
<div><br>
</div>
<div>The channel is busy executing your script.&nbsp; All scripts must exit immediately when the channel is transferred or hungup.&nbsp; That's why you must always wrap things in session:ready()&nbsp;
</div>
<div>If you hangup the call from your script the next thing you MUST do is exit from the script so the session can transition to the hangup state.&nbsp; Until then it will never be able to complete the EXECUTE state.
</div>
<div>What you can do is set the api_hangup_hook to another lua script that can run once the call is hungup or use CDRS to process billing data from another system designated for billing.
</div>
<div><br>
</div>
<div>You may not like the idea now but one day you will come to understand that doing call logic and billing all in the same script in the foreground of the call is not a good way to do things.
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 26, 2015 at 8:27 PM, Andrew Keil <span dir="ltr">
&lt;<a href="mailto:andrew.keil@visytel.com">andrew.keil@visytel.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 lang="EN-AU">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Steven,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Many thanks for your fast response.&nbsp; I understand what you are saying, however even when I add “session:hangup()” as the first line inside my hangup handler (function
 myHangupHook(s, status, arg)), that is prior to the pause of 5 seconds waiting for an event that never comes (at the moment) the resulting CDRs are based on when the Lua script completes (it seems) and not when the call disconnects.&nbsp; I fully understand that
 this is a two way conversation (ie. Remote Disconnect received then Release sent and Release Complete received).
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Does this mean there is no way (within Lua under FreeSWITCH) to clear up a call correctly, then complete some extra code within the Lua script, then end the Lua
 script and generate correct CDRs from within FreeSWITCH?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Regarding subscribing to the HANGUP event or using the Lua script to fire events to a third party application I will be looking into this, however I thought I
 would first ask if I was missing something within FreeSWITCH.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">One more question is there a FreeSWITCH action to correctly release the call apart from session:hangup() {which obviously does not work when the remote end disconnects
 first}?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">I am more than happy to experiment with any ideas.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Andrew<u></u><u></u></span></p>
<p class="MsoNormal"><a><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u>&nbsp;<u></u></span></a></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a>]
<b>On Behalf Of </b>Steven Ayre<br>
<b>Sent:</b> Friday, 27 February 2015 10:47 AM<br>
<b>To:</b> FreeSWITCH Users Help<br>
<b>Subject:</b> Re: [Freeswitch-users] Re- FreeSWITCH CDRs ${billsec} not correct when using Lua scripts and running a hangup handler with any delays inside it<u></u><u></u></span></p>
<div>
<div class="h5">
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
<div>
<p class="MsoNormal">Sorry, jumped the gun a little based on the subject.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
<div>
<p class="MsoNormal">A more relevant answer is that during the hangup state the call is still in the process of hanging up, it isn't hung up and ended until the hangup_complete event. So your 5s sleep is extending the life of the call.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
<div>
<p class="MsoNormal">Is it perhaps possible to subscribe to the hangup event and process it asyncronously?<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
<div>
<p class="MsoNormal">On 26 February 2015 at 23:32, Steven Ayre &lt;<a href="mailto:steveayre@gmail.com">steveayre@gmail.com</a>&gt; wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">CDR processing should be done in the reporting not hangup state.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">On 26 February 2015 at 22:50, Andrew Keil &lt;<a href="mailto:andrew.keil@visytel.com">andrew.keil@visytel.com</a>&gt; wrote:<u></u><u></u></p>
</div>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<div>
<div>
<p class="MsoNormal">To FreeSWITCH users,<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">I am currently experimenting with Lua scripts on FreeSWITCH (latest build) and found an interesting issue with FreeSWITCH default CDRs (inside log/cdr-csv/1000.csv).<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">See below for my simple Lua script called from a diaplan as follows:<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&lt;include&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &lt;!-- To test Lua script&nbsp; --&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &lt;extension name=&quot;ivr_demo&quot;&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^(9101)$&quot;&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;lua&quot; data=&quot;myservice.lua&quot;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/condition&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; &lt;/extension&gt;<u></u><u></u></p>
<p class="MsoNormal">&lt;/include&gt;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">What I noticed is that placing a call into FreeSWITCH via a SIP phone (calling 9101) and landing on myservice.lua everything processes as expected.&nbsp; If I hangup after 3 seconds then I should expect the CDR to show ${billsec} = 3.&nbsp; However
 this is not the case since both ${duration} and ${billsec} are actually set once the Lua script completes (not based on HANGUP).&nbsp; So inside 1000.csv I see duration and billsec both having 8 seconds.<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">You will see below that inside my hangup handler (function myHangupHook(s, status, arg)) I fire an event and wait up to 5000ms for an event to be returned (currently I am not returning an event so the 5000ms will take place).&nbsp; This explains
 the extra 5 seconds after the 3 seconds of the call.<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">My question is since FreeSWITCH knows that the HANGUP has taken place why is the ${billsec} not correct (ie. should be 3 seconds)?<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">I tried adding “session:hangup()” as the first line inside my hangup handler (function myHangupHook(s, status, arg)) and this made no difference.<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">Is there a solution to this issue?&nbsp; Perhaps there is a different CDR variable that will contain the correct duration based on when HANGUP was actually received.<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">Thanks in advance for any assistance with this.<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">Regards,<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">Andrew Keil<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">Simple Lua Script:<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">-- myservice.lua<u></u><u></u></p>
<p class="MsoNormal">-- To test a simple service<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">function MainService()<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;MAIN SERVICE SECTION &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- answer the call<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;ANSWER CALLER &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:answer();<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- sleep a second<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;Sleep for 1000ms &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:sleep(1000);<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;Playing 12345 &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:say(&quot;12345&quot;, &quot;en&quot;, &quot;number&quot;, &quot;pronounced&quot;);<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;Finished playing 12345 &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (session:ready()) then<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- hangup<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;HANGUP &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:hangup()&nbsp; <u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<u></u><u></u></p>
<p class="MsoNormal">end<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">--------------------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">-- Functions section …<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">function myHangupHook(s, status, arg)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;myHangupHook: &quot; .. status .. &quot; &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; -- send hangup event test (after caller hangs up)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; local event = freeswitch.Event(&quot;CUSTOM&quot;, &quot;visytel::HANGUP?&quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; event:addHeader(&quot;hi&quot;, &quot;there&quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; event:addHeader(&quot;channel-uuid&quot;, channeluuid)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Add Event consumer if a response is required!<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local con = freeswitch.EventConsumer(&quot;CUSTOM&quot;, &quot;visytel::HANGUP!&quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; -- fire event<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;Fire HANGUP event &quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; event:fire()&nbsp;&nbsp;&nbsp; <u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Wait for 5000ms to test response<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local retevent = con:pop(1, 5000)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if retevent then<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;, &quot;Reply received! &quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(&quot;INFO&quot;,&nbsp; string.format(&quot;Reply received: %s &quot;,retevent:getHeader(&quot;Result&quot;)))<u></u><u></u></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<u></u><u></u></p>
<p class="MsoNormal">end<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">-- Setup handlers here<u></u><u></u></p>
<p class="MsoNormal">myparam=&quot;empty&quot;;<u></u><u></u></p>
<p class="MsoNormal">session:setHangupHook(&quot;myHangupHook&quot;, &quot;myparam&quot;)<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">-- Source channel-uuid here {used inside myHangupHook handler and for all fired events inside the header<u></u><u></u></p>
<p class="MsoNormal">channeluuid = session:getVariable(&quot;uuid&quot;);<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">MainService()<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
<p class="MsoNormal">-- End of lua script<u></u><u></u></p>
<p class="MsoNormal">&nbsp;<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
</div>
<p class="MsoNormal">_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com">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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</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">http://www.freeswitchsolutions.com</a>
<br>
<br>
Official FreeSWITCH Sites <br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a> <br>
<a href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a> <br>
<a href="http://www.cluecon.com">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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
<br>
UNSUBSCRIBE: <a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">
http://lists.freeswitch.org/mailman/options/freeswitch-users</a> <br>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a> <br>
</blockquote>
</div>
<br>
<br>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Anthony Minessale II &nbsp; &nbsp; &nbsp; &#9836; @anthmfs&nbsp;&nbsp;&#9836; @FreeSWITCH&nbsp;&nbsp;&#9836;
<div><br>
<div>&#9758; <a href="http://freeswitch.org/">http://freeswitch.org/</a> &nbsp;&#9758; <a href="http://cluecon.com/">
http://cluecon.com/</a> &nbsp;&#9758; <a href="http://twitter.com/FreeSWITCH">http://twitter.com/FreeSWITCH</a>
</div>
<div>
<div>&#9758; <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch&nbsp;&#9758; <u><a href="http://freeswitch.org/g&#43;">http://freeswitch.org/g&#43;</a></u>
<br>
<br>
</div>
<div>ClueCon Weekly Development Call&nbsp; <br>
</div>
<div>&#9742;&nbsp; <a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a> &nbsp;&#9742;
<a href="tel:&#43;19193869900" x-apple-data-detectors="true" x-apple-data-detectors-type="telephone" x-apple-data-detectors-result="38">
&#43;19193869900</a>&nbsp; </div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</body>
</html>