foreign-sapphire•15mo ago
transferCall function is not making the call
Hey guys, after spending over $20 in call costs trying to work this out myself I am finally admitting defeat and seeking some help. I can't for the life of me get the transferCall function to actually make the call. I have tried several ways including just using the built in Forwarding Phone Number from the dashboard, Creating a transferCall function via the API as suggested in the docs, and multiple variations of these things.
Here is the latest call ID: 5ef8dc81-9841-4083-b5f1-2b12261cd5c3
The current setup at least reads the message from the "request-start" on the transferCall function, so I think it's getting close. but for some reason the call doesn't actually ring. I have tested making an outbound call from the dashboard to the number and it works fine.
Any ideas would be greatly appreaciated.
7 Replies
@redmaverick84
I'm sorry to hear about the trouble you've been having with the transferCall function. Let's try to resolve this together. Could you please provide me with the conditions under which you're trying to transfer the call? This will help me understand when to trigger the transferCall function and to which number it should be directed.
You can continue this conversation by mentioning me in the message.
foreign-sapphireOP•15mo ago
Here is the "transferCall" fucntion code I have sent via the POST create tool:
'''''''''''''''''''''''
{
"type": "transferCall",
"destinations": [
{
"type": "phoneNumber",
"number": "+61[REDACTED]",
"message": "I am transferring you to Gavin now."
}
],
"function": {
"name": "transferCall",
"description": "Use this function to transfer the call. Only use it when following instructions that explicitly ask you to use the transferCall function. DO NOT call this function unless you are instructed to do so.",
"parameters": {
"type": "object",
"properties": {
"destination": {
"type": "string",
"description": "The destination phone number to transfer the call to."
}
},
"required": [
"destination"
]
}
},
"messages": [
{
"type": "request-start",
"content": "Putting you through to Gavin now...",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+61[REDACTED]"
}
]
},
{
"type": "request-failed",
"content": "Hmm... it doesn't seem like Gavin is available at the moment.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+61[REDACTED]"
}
]
}
]
}
'''''''''''''''''''''''''''
Here is the response from the call ID: bc6c7267-c067-4723-8673-ea9a734b5ff2 Messages log:
{
"role": "tool_calls",
"time": 1721631674212,
"message": "",
"toolCalls": [
{
"id": "call_Lksh1nmsNAPRAiO68vyxKVA3",
"type": "function",
"function": {
"name": "transferCall",
"arguments": "{"destination": "+61[REDACTED]"}"
}
}
],
"secondsFromStart": 5.636
}
{
"role": "bot",
"time": 1721631675567.0002,
"source": "",
"endTime": 1721631677227,
"message": "Putting you through to Gavin now.",
"secondsFromStart": 6.7000003
}
{
"name": "transferCall",
"role": "tool_call_result",
"time": 1721631676716,
"result": "Success.",
"toolCallId": "call_Lksh1nmsNAPRAiO68vyxKVA3",
"secondsFromStart": 8.14
}
{
"role": "bot",
"time": 1721631688047,
"source": "",
"endTime": 1721631689187,
"message": "Are you still there?",
"secondsFromStart": 19.18
}
{
"role": "user",
"time": 1721631689747,
"endTime": 1721631690646.999,
"message": "Yeah. Still waiting.",
"duration": 1.3999996,
"secondsFromStart": 20.88
}
{
"role": "tool_calls",
"time": 1721631691687,
"message": "",
"toolCalls": [
{
"id": "call_1zNkNDgk1vyonTkp1Nf28JVZ",
"type": "function",
"function": {
"name": "transferCall",
"arguments": "{"destination": "+61[REDACTED]"}"
}
}
],
"secondsFromStart": 23.111
}
{
"role": "bot",
"time": 1721631693037,
"source": "",
"endTime": 1721631694697,
"message": "Putting you through to Gavin now.",
"secondsFromStart": 24.17
}
{
"name": "transferCall",
"role": "tool_call_result",
"time": 1721631694174,
"result": "Success.",
"toolCallId": "call_1zNkNDgk1vyonTkp1Nf28JVZ",
"secondsFromStart": 25.598
}
@redmaverick84
Thank you for providing the details of your "transferCall" function code. It seems like you have the right structure for the function, but let's check a few things to ensure it works correctly:
1. Verify the phone number: Make sure that the phone number you're trying to transfer the call to is correct and in the proper international format.
2. Check the conditions: The conditions in your "messages" section are set to match the "destination" parameter exactly with the phone number. Ensure that the conditions are being met when the function is called.
3. Review API response: When you send the POST request to create the transferCall function, make sure you're receiving a successful response from the API. Any error messages could help identify the issue.
4. Test with minimal setup: Try setting up the transferCall function with the minimal necessary parameters to see if it works without the additional conditions and messages.
If you've already verified these points and the issue persists, it might be best to look into the server logs or contact support for a more in-depth investigation. If you can provide any error messages or logs, that would also be helpful in diagnosing the problem.
Would you like me to assist you with anything else at this moment?
@redmaverick84
Based on the logs you've provided, it appears that the
transferCall
function is being called successfully and the system is returning a "Success" result. However, since the call doesn't seem to be connecting, there might be an issue beyond the function call itself.
Here are a few steps we can take to troubleshoot the issue:
1. Check the Destination Number: Ensure that the destination number is active and capable of receiving calls. Since you mentioned that outbound calls from the dashboard work fine, this is likely not the issue, but it's good to double-check.
2. Review the Function Execution: The logs indicate that the function is being executed twice. Make sure that this is intentional and that the function isn't being called more times than necessary, which could potentially cause conflicts.
3. Examine the Call Flow: There might be an issue with the call flow after the transfer is initiated. Check if there are any additional steps or conditions after the transferCall
function that might be affecting the call connection.
4. Inspect the Phone Call Provider Details: Since you're using a phone call provider, ensure that all the necessary details like statusCallbackEvent
, machineDetection
, and machineDetectionTimeout
are configured correctly.
5. Consult the Support Team: If the issue persists, it might be necessary to consult the support team with the call ID and the logs you've provided. They can help investigate the issue in more depth, including checking server-side logs and configurations that are not visible to us here.
If you would like, I can assist you in contacting the support team or provide further guidance on any of the steps above. Please let me know how you would like to proceed.conscious-sapphire•15mo ago
@redmaverick84 you have selected
phone-call-control
please either deselect it or you have to handle the transfer by yourself.
To make vapi handle the transfer of the call please de-select it from servermessages.foreign-sapphireOP•15mo ago
Thanks mate, still not having any luck after removing the phone-call-control option. I also tried to removing all of the other non-used server url options and just leaving the tool-calls options for the other tools on the server side. Here is the Call ID for that test: 6f10ff08-48bb-46d8-860a-830fde9f5d51
If you can think of anything else to check please let me know, i am assuming it is just some small setting somewhere that I have missed. In the mean time I will try to configure the server URL to handle the request and see if that works as an alternative option.
conscious-sapphire•15mo ago
Hey man it has actually transfered the call.
foreign-sapphireOP•15mo ago
Yeah, but the phone doesn't ring before the assistant hangs up. It might be a twilio setting issue perhaps. I will keep investigating and testing to see what I can work out.
I have now got it so that when it sends the transferCall to the server URL, the server successfully makes the call to the number, just need to work out how to connect the existing call with the new call via the twilio api.
Thanks for your help. all good if you want to close the ticket and ill keep looking at Twilio and Server side.