This document was generated from CDN thread
Created by: Gokulnaath Gopal on 06-09-2010 09:33:27 PM
Hi,
I'm trying to build a custom element onCallEnd action(Java Code), in which I want to retrieve the Call duration.
How do I use CallData.Duration inside onCallEndAction or else do we have any build-in functions (like getSrcAppName()) to get the Call Duration?
Subject: RE: Call Duration in onCallEnd Action
Replied by: Gokulnaath Gopal on 08-09-2010 08:51:40 AM
Hi,
Found a Temp solution. Thought of Sharing it.
//CallStartDate and CallEndDate are Date Objects
CallStartDate=callEndAPI.getStartDate();
// Find the Call Duration in seconds
diffSeconds=(CallEndDate.getTime() - CallStartDate.getTime())/1000;
Duration=diffSeconds;
Gokul
Subject: RE: Call Duration in onCallEnd Action
Replied by: Hemal Mehta on 08-09-2010 05:12:12 PM
You can alternatively also store the start time in session variable and when the call ends you can take the difference between the two as the start time is in session and is accessible.
Subject: RE: Call Duration in onCallEnd Action
Replied by: Gokulnaath Gopal on 08-09-2010 09:45:10 PM
Hi,
Yeah, initially I was thinking of doing that. I believe that will be a overhead if we using multiple applications (on application Transfer).
Basically, I'm trying to find the call duration onCallEnd class. This class will be invoked in any part of IVR Tree on Transfer back to ICM/ Caller Hangup/ IVR Hangup. We can set a session using CallData.Duration. But I don't know how do set a session in Java code for CallData. Let me know, if you know how do we set a session for CallData values.
Gokul