<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> </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 the variable 'billsec' after the channel hangup is complete.</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </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> </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"> </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>> 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> 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"> </div>
<div style="RIGHT: auto">please continue to explain why this happens.</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">x.k.</div>
<div style="RIGHT: auto"><VAR id=yui-ie-cursor></VAR> </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 <msc@freeswitch.org><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <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><<A href="mailto:xing2kin@yahoo.com" rel=nofollow target=_blank ymailto="mailto:xing2kin@yahoo.com">xing2kin@yahoo.com</A>></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&from=Variable+billmsec </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 "nil" or empty. </SPAN></DIV>
<DIV><SPAN></SPAN> </DIV>
<DIV><SPAN>-- dialplan:</SPAN></DIV>
<DIV><SPAN>{</SPAN></DIV>
<DIV><SPAN> <action application="answer"/></SPAN></DIV>
<DIV><SPAN><SPAN> ........</SPAN></SPAN></DIV>
<DIV><SPAN> <action application="log" data="INFO billsec: ${billsec}; billmsec: ${billmsec}"/> <BR> <action application="sleep" data="2000"/> <BR> <action application="hangup"/> </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 'ctsec' (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('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> </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 <<A href="mailto:curriegrad2004@gmail.com" rel=nofollow target=_blank ymailto="mailto:curriegrad2004@gmail.com">curriegrad2004@gmail.com</A>><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> FreeSWITCH Users Help <<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><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 <<A href="mailto:admin@blindi.net" rel=nofollow target=_blank ymailto="mailto:admin@blindi.net">admin@blindi.net</A>> wrote:<BR>> Hi all,<BR>> Is there a possibility to determine the caller time for a channel at<BR>> the end of a call?<BR>><BR>> For example: in asterisk exists a variable:<BR>> ${ANSWEREDTIME}<BR>> I like to store the Answertime in a Database for example:<BR>> Dailly minutes to call a Cellphone.<BR>> Can your help plese?<BR>> Thanks.<BR>><BR>><BR>> ---------------<BR>> Du kannst mich jederzeit kostenlos per Festnetz erreichen unter:<BR>> http://www.blindi.net/callback<BR>> homepage: http://www.blindi.net<BR>> blinde-misc mailingliste für blinde. anmeldung unter:<BR>> http://www.blindi.net/mailman/listinfo/blinde-misc<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>> http://www.freeswitchsolutions.com<BR>><BR>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>> http://www.cudatel.com<BR>><BR>> Official FreeSWITCH Sites<BR>> http://www.freeswitch.org<BR>> http://wiki.freeswitch.org<BR>> http://www.cluecon.com<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>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<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>_________________________________________________________________________<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>