create a variable that contains the call duration

Status
Not open for further replies.

luca pellegrini

Joined
Sep 14, 2017
Messages
11
Reaction score
0
I would like to use a variable to find the duration of the call and send it into an email
 
Last edited:
Hi @luca pellegrini,

In order to determine the duration of the call, you need to use a variable to store the date and time when the call started. So as soon as you receive the call, you use an "Assign a Variable" component to set a callflow/project variable, for example "callflow$.StartTicks", to "DateTime.Now.Ticks".

Then, when the call ends and you're about to send the email, you can calculate the number of seconds using the following expression:
DIVIDE_LONG(SUM_LONG(DateTime.Now.Ticks,NEGATIVE_LONG(callflow$.StartTicks)),10000000)

That expression will take "DateTime.Now.Ticks" (which is the current tick counter) and will substract the start ticks. That will tell you the number of "ticks" between the start and the end of the call. Then you divide that by 10.000.000, which is the number of ticks in a second, and you get the number of seconds of the call.

Kind regards.
Ernesto.
 
  • Like
Reactions: luca pellegrini
Finally, in order to send it in an email message, you create the body or subject expression to include that value... If you need help with that let me know. Here you have an example on how to add a variable to the subject:
https://www.3cx.com/docs/cfd-emails-voice-app/

The same applies to the body...
 
thanks edossantos!
 
Last edited:
Status
Not open for further replies.

Forum statistics

Threads
111,856
Messages
589,404
Members
164,693
Latest member
FLCC