[Freeswitch-users] Calculate the Call Duration ( BillSec)

Aloysius Lloyd lloyd.aloysius at gmail.com
Thu Mar 18 07:38:01 PDT 2010


Hi All,

The following lua script for calculate the call duration. But the issue here
, the duration is calculating from the outbound initiate time.

How to get the call answer time?


session:preAnswer();
-- sleep a second
session:sleep(1000);
--
digits = session:playAndGetDigits(10, 20, 3, 5000, "#", "enter-dest.wav",
"invalid-digits.wav", "\\d+|\\*");

-- Initiate an outbound call
outSession = freeswitch.Session("sofia/gateway/voipms/"..digits,session)


starttime  = os.time();
freeswitch.consoleLog("info",   "Start Time"..starttime.." \n");

freeswitch.consoleLog("info",   "Before Bridge the Call \n");
freeswitch.bridge(session, outSession);
freeswitch.consoleLog("info",   "After Bridge the Call \n");

endtime = os.time();
freeswitch.consoleLog("info",   "End Time"..endtime.." \n");

billsec = os.difftime(endtime,starttime);
freeswitch.consoleLog("info",   "Blling Sec"..billsec.." \n");

-- hangup
session:hangup();


Thanks
Lloyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100318/3b98a6f4/attachment-0002.html 


More information about the FreeSWITCH-users mailing list