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?
The channel variables for this purpose seems to be{duration, billsec, answersec, flow_billsec, mduration, billmsec, answermsec, uduration, billusec, answerusec}see: source code "switch_channel.c";and wiki document on categories: channel variablesHowever, when I tried to access these channel variables from Lua script or dialplan, their values are always "nil" or empty.-- dialplan:{<action application="answer"/>........<action application="log" data="INFO billsec: ${billsec}; billmsec: ${billmsec}"/>
<action application="sleep" data="2000"/>
<action application="hangup"/>}-- Lua script:2011-12-10 13:39:55.609375 [ERR] mod_lua.cpp:191 C:\c4dev\freeswitch\Release\scr
ipts/test1.lua:60: attempt to concatenate global 'ctsec' (a nil value)
stack traceback:
C:\c4dev\freeswitch\Release\scripts/test1.lua:60: in main chunksee:{session:answer().........ctsec = session:getVariable('billsec')
ctmsec = session:getVariable('billmsec')
freeswitch.consoleLog("INFO","***** Call-Time: sec=" .. ctsec .. "\n")
freeswitch.consoleLog("INFO","***** Call-Time: msec=" .. ctmsec .. "\n")session:hangup()}From: curriegrad2004 <curriegrad2004@gmail.com>
To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org>
Sent: Wednesday, November 30, 2011 11:15 PM
Subject: Re: [Freeswitch-users] Question Answertime variable?
billseconds or bill_msec would be the one to turn to.
On Wed, Nov 30, 2011 at 4:22 AM, Thomas Hoellriegel <admin@blindi.net> wrote:
> Hi all,
> Is there a possibility to determine the caller time for a channel at
> the end of a call?
>
> For example: in asterisk exists a variable:
> ${ANSWEREDTIME}
> I like to store the Answertime in a Database for example:
> Dailly minutes to call a Cellphone.
> Can your help plese?
> Thanks.
>
>
> ---------------
> Du kannst mich jederzeit kostenlos per Festnetz erreichen unter:
> http://www.blindi.net/callback
> homepage: http://www.blindi.net
> blinde-misc mailingliste für blinde. anmeldung unter:
> http://www.blindi.net/mailman/listinfo/blinde-misc
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting@freeswitch.org
> http://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
> http://www.cudatel.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users@lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org