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>-MC<br><br><div class="gmail_quote">On Fri, Dec 9, 2011 at 10:03 PM, king2kin <span dir="ltr">&lt;<a href="mailto:xing2kin@yahoo.com">xing2kin@yahoo.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><div style="color:#000;background-color:#fff;font-family:times new roman,new york,times,serif;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 &quot;switch_channel.c&quot;;</span></div>
<div><span>and wiki document on categories: channel variables</span></div>
<div><span>see: <a href="http://wiki.freeswitch.com/index.php?title=Category:Variable&amp;from=Variable+billmsec" target="_blank">http://wiki.freeswitch.com/index.php?title=Category:Variable&amp;from=Variable+billmsec</a>  </span></div>

<div><span></span> </div>
<div><span>However, when I tried to access these channel variables from Lua script or dialplan, their values are always &quot;nil&quot; or empty. </span></div>
<div><span></span> </div>
<div><span>-- dialplan:</span></div>
<div><span>{</span></div>
<div><span>   &lt;action application=&quot;answer&quot;/&gt;</span></div>
<div><span><span>    ........</span></span></div>
<div><span>   &lt;action application=&quot;log&quot; data=&quot;INFO billsec: ${billsec}; billmsec: ${billmsec}&quot;/&gt; <br>   &lt;action application=&quot;sleep&quot; data=&quot;2000&quot;/&gt;  <br>   &lt;action application=&quot;hangup&quot;/&gt;  </span></div>

<div><span>}</span></div>
<div><span><var></var></span> </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 &#39;ctsec&#39; (a nil value)<br>stack traceback:<br>        C:\c4dev\freeswitch\Release\scripts/test1.lua:60: in main chunk</span></div>

<div><span></span> </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(&#39;billsec&#39;)<br>ctmsec = session:getVariable(&#39;billmsec&#39;)<br>freeswitch.consoleLog(&quot;INFO&quot;,&quot;***** Call-Time: sec=&quot; .. ctsec .. &quot;\n&quot;)<br>freeswitch.consoleLog(&quot;INFO&quot;,&quot;***** Call-Time: msec=&quot; .. ctmsec .. &quot;\n&quot;)</span></div>

<div><span>session:hangup()</span></div>
<div><span>}</span></div>
<div><span></span> </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;PADDING-LEFT:0px;PADDING-RIGHT:0px;min-height:0px;FONT-SIZE:0px;BORDER-TOP:#ccc 1px solid;BORDER-RIGHT:#ccc 1px solid;PADDING-TOP:0px" readonly>
</div><b><span style="FONT-WEIGHT:bold">From:</span></b> curriegrad2004 &lt;<a href="mailto:curriegrad2004@gmail.com" target="_blank">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" target="_blank">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" target="_blank">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; <a href="http://www.blindi.net/callback" target="_blank">http://www.blindi.net/callback</a><br>
&gt; homepage: <a href="http://www.blindi.net" target="_blank">http://www.blindi.net</a><br>&gt; blinde-misc mailingliste für blinde. anmeldung unter:<br>&gt; <a href="http://www.blindi.net/mailman/listinfo/blinde-misc" target="_blank">http://www.blindi.net/mailman/listinfo/blinde-misc</a><br>
&gt;<br>&gt; _________________________________________________________________________<br>&gt; Professional FreeSWITCH Consulting Services:<br>&gt; <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
&gt; <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>&gt;<br>&gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>&gt; <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
&gt;<br>&gt; Official FreeSWITCH Sites<br>&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>&gt; <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
&gt; <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>&gt;<br>&gt; FreeSWITCH-users mailing list<br>&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>&gt;<br><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><br></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>