https://retellai.com/?utm_source=discord&utm_medium=seo logo
Can I transfer the call to a human if the call is ...
# ❓・ai-evy-support
a
@AI Evy Can I transfer the call to a human if the call is ongoing for 2 minutes
a
Thanks for tagging me @AINerd. I'll look through relevant sources and get back to you shortly.
### Answer Yes, you can transfer a call to a human agent using the Transfer Call Tool. [(1) ]() To trigger a transfer based on call duration (e.g., 2 minutes) , you would need to: 1. Add the Transfer Call Tool to your agent by clicking "+ Add" in the tools section and selecting "Transfer Call" from the dropdown menu. 2. Update your prompt to include the transfer condition. You can incorporate instructions such as: "If the call has been ongoing for 2 minutes, use the transfer_call tool to transfer the conversation to a human agent." 3. **Choose your transfer type**: - **Cold transfer**: The call is transferred to a destination number and that's it. - **Warm transfer**: The AI agent can detect if the other side is human, leave private messages not heard by the user, and do a three-way introduction. For Conversation Flow agents, you can use the Call Transfer Node to handle transfers. Transition happens when transfer fails, and there's a pre-populated edge you can connect to handle transfer failure. [(2) ]() **Note**: The sources don't explicitly document a built-in "call duration" variable. You may need to track elapsed time through your own logic or custom function to determine when 2 minutes have passed, then trigger the transfer tool accordingly.
​ To learn more, see the sources I considered: [[1] Transfer call](https://docs.retellai.com/build/single-multi-prompt/transfer-call) [[2] Call Transfer Node](https://docs.retellai.com/build/conversation-flow/call-transfer-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
@AI Evy how to calculate the elapsed time within the Agent prompt
a
Thanks for the follow-up, @AINerd. I'll get back to you soon.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer The available sources don't explicitly document a built-in method to calculate elapsed call time directly within the agent prompt. However, based on community discussion, there are a couple of approaches you can consider: 1. Use the
{{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?
​ To learn more, see the sources I considered: [[1] Agent Error](https://discord.com/channels/1186424376300679209/1440081763362930760) ​
a
what is the call duration variable in the transcript_object
@AI Evy what is the call duration variable in the transcript_object
a
Thanks for the follow-up, @AINerd. I'll get back to you soon.
### Answer The
transcript_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) ]()
Copy code
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
.
​ To learn more, see the sources I considered: [[1] Get Call](https://docs.retellai.com/api-references/get-call) [[2] List Calls](https://docs.retellai.com/api-references/list-calls) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.