AINerd
01/21/2026, 8:40 PMAI Evy
01/21/2026, 8:40 PMAI Evy
01/21/2026, 8:40 PMAI Evy
01/21/2026, 8:40 PMAI Evy
01/21/2026, 8:40 PMAINerd
01/21/2026, 9:06 PMAI Evy
01/21/2026, 9:06 PMAI Evy
01/21/2026, 9:06 PMAI Evy
01/21/2026, 9:06 PM{{current_time}} dynamic variable in your Global Prompt to provide the agent with the current timestamp. [(1) ]()
2. Create a custom function that calculates elapsed time. Many users have implemented time lookups by passing relevant data through a custom function to handle time-based logic.
For tracking call duration specifically, you would likely need to:
- Record the call start time when the call begins (via webhook or your backend)
- Pass that start time as a dynamic variable to the agent
- Use a custom function that compares the start time against the current time to determine if 2 minutes have elapsed
The sources don't show a native "elapsed call duration" variable within the agent prompt itself, so implementing this through a custom function that your backend manages is the recommended approach.
Check out these potentially useful sources:
- [Create Voice Agent]()
- [Step 2: Configure the basic settings]()
Would you like me to try providing a general answer on how custom functions could be structured for this use case?AI Evy
01/21/2026, 9:06 PMAINerd
01/21/2026, 9:09 PMAINerd
01/21/2026, 9:09 PMAI Evy
01/21/2026, 9:09 PMAI Evy
01/21/2026, 9:09 PMtranscript_object itself does not contain a call duration variable. [(1) ]()
However, the call object (returned by Get Call or List Calls APIs) includes a separate field called duration_ms which represents the duration of the call in milliseconds. , [(2) ]()
The transcript_object contains an array of utterances with the following structure: [(1) ]()
json
"transcript_object": [
{
"role": "agent",
"content": "hi how are you doing?",
"words": [
{
"word": "hi",
"start": 0.7,
"end": 1.3
}
]
}
]
Each word has start and end timestamps (in seconds) , which indicate when that word was spoken during the call.
To calculate elapsed time from the transcript, you could use the end timestamp of the last word in the most recent utterance—this would give you the approximate time elapsed since the call began.
For the overall call duration, use duration_ms from the call object, not from transcript_object.AI Evy
01/21/2026, 9:09 PMAI Evy
01/21/2026, 9:09 PM