[Freeswitch-users] Question Answertime variable? billsec is not available
king2kin
xing2kin at yahoo.com
Fri Dec 16 07:14:02 MSK 2011
MC,
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.
lua script: {
session:answer()
.........
session:hangup()
session:sleep(1250)
ctsec = session:getVariable('billsec')
freeswitch.consoleLog("INFO","***** Call-Time: sec=" .. ctsec .. "\n")
}
freeswitch log info from console are copied as follows:
{
freeswitch at W2k3T602> 2011-12-16 12:06:01.187500 [INFO] switch_rtp.c:3152 Auto Ch
anging port from 127.0.0.1:40036 to 192.168.0.119:40036
2011-12-16 12:06:03.234375 [INFO] switch_cpp.cpp:1199 Prompt file is 'ivr\ivr-we
lcome_to_freeswitch.wav'
2011-12-16 12:06:19.156250 [NOTICE] switch_cpp.cpp:620 Hangup sofia/internal/sip
:1006 at 127.0.0.1:1312 [CS_EXECUTE] [NORMAL_CLEARING]
2011-12-16 12:06:24.515625 [ERR] mod_lua.cpp:191 C:\c4dev\freeswitch\Release\scr
ipts/test1.lua:61: attempt to concatenate global 'ctsec' (a nil value)
stack traceback:
C:\c4dev\freeswitch\Release\scripts/test1.lua:61: in main chunk
2011-12-16 12:06:24.515625 [NOTICE] switch_core_session.c:1354 Session 6 (sofia/
internal/sip:1006 at 127.0.0.1:1312) Ended
2011-12-16 12:06:24.515625 [NOTICE] switch_core_session.c:1356 Close Channel sof
ia/internal/sip:1006 at 127.0.0.1:1312 [CS_DESTROY]
}
please continue to explain why this happens.
x.k.
From: Michael Collins <msc at freeswitch.org>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Sent: Wednesday, December 14, 2011 8:38 AM
Subject: Re: [Freeswitch-users] Question Answertime variable? billsec is not available
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?
-MC
On Fri, Dec 9, 2011 at 10:03 PM, king2kin <xing2kin at yahoo.com> wrote:
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 variables
>see: http://wiki.freeswitch.com/index.php?title=Category:Variable&from=Variable+billmsec
>
>However, 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 chunk
>
>see:
>{
>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 at gmail.com>
>To: FreeSWITCH Users Help <freeswitch-users at 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 at 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 at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at 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 at freeswitch.org
>http://www.freeswitchsolutions.com
>
>
>
>
>Official FreeSWITCH Sites
>http://www.freeswitch.org
>http://wiki.freeswitch.org
>http://www.cluecon.com
>
>FreeSWITCH-users mailing list
>FreeSWITCH-users at 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 at freeswitch.org
>http://www.freeswitchsolutions.com
>
>
>
>
>Official FreeSWITCH Sites
>http://www.freeswitch.org
>http://wiki.freeswitch.org
>http://www.cluecon.com
>
>FreeSWITCH-users mailing list
>FreeSWITCH-users at 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 at freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111215/4ffffa7b/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list