<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">MC,</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN>&nbsp;</div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">Thank you for your reply. The problem still exists even though I follow your advice to access&nbsp;the variable 'billsec'&nbsp;after the channel hangup is complete.</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN>&nbsp;</div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">lua script: </SPAN></div><SPAN style="RIGHT: auto">
<DIV><SPAN>{</SPAN></DIV>
<DIV><SPAN>session:answer()</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">.........</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">session:hangup()</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">session:sleep(1250)</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN>&nbsp;</DIV></SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">ctsec = session:getVariable('billsec')<BR>freeswitch.consoleLog("INFO","***** Call-Time: sec=" .. ctsec .. "\n")<BR></SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">}</SPAN></DIV></SPAN>
<div style="RIGHT: auto">&nbsp;</div>
<div style="RIGHT: auto">freeswitch log info from console are copied as follows:</div>
<div style="RIGHT: auto">{</div>
<div style="RIGHT: auto"><A href="mailto:freeswitch@W2k3T602">freeswitch@W2k3T602</A>&gt; 2011-12-16 12:06:01.187500 [INFO] switch_rtp.c:3152 Auto Ch<BR>anging port from 127.0.0.1:40036 to 192.168.0.119:40036<BR>2011-12-16 12:06:03.234375 [INFO] switch_cpp.cpp:1199 Prompt file is 'ivr\ivr-we<BR>lcome_to_freeswitch.wav'<BR>2011-12-16 12:06:19.156250 [NOTICE] switch_cpp.cpp:620 Hangup sofia/internal/sip<BR>:1006@127.0.0.1:1312 [CS_EXECUTE] [NORMAL_CLEARING]<BR><STRONG style="RIGHT: auto"><FONT style="BACKGROUND-COLOR: #ff0000">2011-12-16 12:06:24.515625 [ERR] mod_lua.cpp:191 C:\c4dev\freeswitch\Release\scr<BR>ipts/test1.lua:61: attempt to concatenate global 'ctsec' (a nil value)<BR>stack traceback:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\c4dev\freeswitch\Release\scripts/test1.lua:61: in main chunk</FONT><BR></STRONG>2011-12-16 12:06:24.515625 [NOTICE] switch_core_session.c:1354 Session 6 (sofia/<BR>internal/sip:1006@127.0.0.1:1312)
 Ended<BR>2011-12-16 12:06:24.515625 [NOTICE] switch_core_session.c:1356 Close Channel sof<BR>ia/internal/sip:1006@127.0.0.1:1312 [CS_DESTROY]</div>
<div style="RIGHT: auto">}</div>
<div style="RIGHT: auto">&nbsp;</div>
<div style="RIGHT: auto">please continue to explain why this happens.</div>
<div style="RIGHT: auto">&nbsp;</div>
<div style="RIGHT: auto">x.k.</div>
<div style="RIGHT: auto"><VAR id=yui-ie-cursor></VAR>&nbsp;</div>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr readonly="true" contenteditable="false"></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Michael Collins &lt;msc@freeswitch.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> FreeSWITCH Users Help &lt;freeswitch-users@lists.freeswitch.org&gt; <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, December 14, 2011 8:38 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [Freeswitch-users] Question Answertime variable? billsec is not available<BR></FONT><BR>
<DIV style="RIGHT: auto" id=yiv1203089601>Are you trying to access these before the channel hangup is complete? If so then yes, they will always be empty. They are not populated until the call actually ends. Are you doing a hangup hook in Lua or something else?
<DIV><BR></DIV>
<DIV style="RIGHT: auto">-MC<BR><BR>
<DIV style="RIGHT: auto" class=yiv1203089601gmail_quote>On Fri, Dec 9, 2011 at 10:03 PM, king2kin <SPAN dir=ltr>&lt;<A href="mailto:xing2kin@yahoo.com" rel=nofollow target=_blank ymailto="mailto:xing2kin@yahoo.com">xing2kin@yahoo.com</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex; RIGHT: auto" class=yiv1203089601gmail_quote>
<DIV style="RIGHT: auto">
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: times new roman, new york, times, serif; COLOR: #000; FONT-SIZE: 12pt">
<DIV><SPAN>The channel variables for this purpose seems to be </SPAN></DIV>
<DIV><SPAN>{duration, billsec, answersec, flow_billsec, mduration, billmsec, answermsec, uduration, billusec, answerusec}</SPAN></DIV>
<DIV><SPAN>see: source code "switch_channel.c";</SPAN></DIV>
<DIV><SPAN>and wiki document on categories: channel variables</SPAN></DIV>
<DIV><SPAN>see: http://wiki.freeswitch.com/index.php?title=Category:Variable&amp;from=Variable+billmsec&nbsp; </SPAN></DIV>
<DIV><SPAN></SPAN>&nbsp;</DIV>
<DIV><SPAN>However, when I tried to access these channel variables from Lua script or dialplan, their values are always "nil" or empty. </SPAN></DIV>
<DIV><SPAN></SPAN>&nbsp;</DIV>
<DIV><SPAN>-- dialplan:</SPAN></DIV>
<DIV><SPAN>{</SPAN></DIV>
<DIV><SPAN>&nbsp;&nbsp; &lt;action application="answer"/&gt;</SPAN></DIV>
<DIV><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;........</SPAN></SPAN></DIV>
<DIV><SPAN>&nbsp;&nbsp;&nbsp;&lt;action application="log" data="INFO billsec: ${billsec}; billmsec: ${billmsec}"/&gt;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&lt;action application="sleep" data="2000"/&gt;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&lt;action application="hangup"/&gt;&nbsp;&nbsp;</SPAN></DIV>
<DIV><SPAN>}</SPAN></DIV>
<DIV><SPAN><VAR></VAR></SPAN>&nbsp;</DIV>
<DIV><SPAN>-- Lua script:</SPAN></DIV>
<DIV><SPAN>2011-12-10 13:39:55.609375 [ERR] mod_lua.cpp:191 C:\c4dev\freeswitch\Release\scr<BR>ipts/test1.lua:60: attempt to concatenate global 'ctsec' (a nil value)<BR>stack traceback:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\c4dev\freeswitch\Release\scripts/test1.lua:60: in main chunk</SPAN></DIV>
<DIV><SPAN></SPAN>&nbsp;</DIV>
<DIV><SPAN>see:</SPAN></DIV>
<DIV><SPAN>{</SPAN></DIV>
<DIV><SPAN>session:answer()</SPAN></DIV>
<DIV><SPAN>.........</SPAN></DIV>
<DIV><SPAN>ctsec = session:getVariable('billsec')<BR>ctmsec = session:getVariable('billmsec')<BR>freeswitch.consoleLog("INFO","***** Call-Time: sec=" .. ctsec .. "\n")<BR>freeswitch.consoleLog("INFO","***** Call-Time: msec=" .. ctmsec .. "\n")</SPAN></DIV>
<DIV><SPAN>session:hangup()</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN>}</SPAN></DIV>
<DIV><SPAN></SPAN>&nbsp;</DIV>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; MIN-HEIGHT: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px"></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> curriegrad2004 &lt;<A href="mailto:curriegrad2004@gmail.com" rel=nofollow target=_blank ymailto="mailto:curriegrad2004@gmail.com">curriegrad2004@gmail.com</A>&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> FreeSWITCH Users Help &lt;<A href="mailto:freeswitch-users@lists.freeswitch.org" rel=nofollow target=_blank ymailto="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</A>&gt; <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, November 30, 2011 11:15 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [Freeswitch-users] Question Answertime
 variable?<BR></FONT><BR>billseconds or bill_msec would be the one to turn to.<BR><BR>On Wed, Nov 30, 2011 at 4:22 AM, Thomas Hoellriegel &lt;<A href="mailto:admin@blindi.net" rel=nofollow target=_blank ymailto="mailto:admin@blindi.net">admin@blindi.net</A>&gt; wrote:<BR>&gt; Hi all,<BR>&gt; Is there a possibility to determine the caller time for a channel at<BR>&gt; the end of a call?<BR>&gt;<BR>&gt; For example: in asterisk exists a variable:<BR>&gt; ${ANSWEREDTIME}<BR>&gt; I like to store the Answertime in a Database for example:<BR>&gt; Dailly minutes to call a Cellphone.<BR>&gt; Can your help plese?<BR>&gt; Thanks.<BR>&gt;<BR>&gt;<BR>&gt; ---------------<BR>&gt; Du kannst mich jederzeit kostenlos per Festnetz erreichen unter:<BR>&gt; http://www.blindi.net/callback<BR>&gt; homepage: http://www.blindi.net<BR>&gt; blinde-misc mailingliste für blinde. anmeldung unter:<BR>&gt; http://www.blindi.net/mailman/listinfo/blinde-misc<BR>&gt;<BR>&gt;
 _________________________________________________________________________<BR>&gt; Professional FreeSWITCH Consulting Services:<BR>&gt; <A href="mailto:consulting@freeswitch.org" rel=nofollow target=_blank ymailto="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR>&gt; http://www.freeswitchsolutions.com<BR>&gt;<BR>&gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>&gt; http://www.cudatel.com<BR>&gt;<BR>&gt; Official FreeSWITCH Sites<BR>&gt; http://www.freeswitch.org<BR>&gt; http://wiki.freeswitch.org<BR>&gt; http://www.cluecon.com<BR>&gt;<BR>&gt; FreeSWITCH-users mailing list<BR>&gt; <A href="mailto:FreeSWITCH-users@lists.freeswitch.org" rel=nofollow target=_blank ymailto="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR>&gt; http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<BR>&gt; UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 rel=nofollow target=_blank>http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR>&gt; <A href="http://www.freeswitch.org/" rel=nofollow target=_blank>http://www.freeswitch.org</A><BR>&gt;<BR><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org" rel=nofollow target=_blank ymailto="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/" rel=nofollow target=_blank>http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/" rel=nofollow target=_blank>http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/" rel=nofollow target=_blank>http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/" rel=nofollow
 target=_blank>http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/" rel=nofollow target=_blank>http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org" rel=nofollow target=_blank ymailto="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel=nofollow target=_blank>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel=nofollow target=_blank>http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/" rel=nofollow target=_blank>http://www.freeswitch.org</A><BR><BR><BR></DIV></DIV></DIV></DIV><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A
 href="mailto:consulting@freeswitch.org" rel=nofollow target=_blank ymailto="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/" rel=nofollow target=_blank>http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/" rel=nofollow target=_blank>http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/" rel=nofollow target=_blank>http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/" rel=nofollow target=_blank>http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/" rel=nofollow target=_blank>http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org" rel=nofollow target=_blank ymailto="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel=nofollow target=_blank>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel=nofollow target=_blank>http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/" rel=nofollow 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" ymailto="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" ymailto="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><BR></DIV></DIV></div></body></html>