title | sidebarTitle |
---|---|
Call Forwarding |
Call Forwarding |
Vapi's call forwarding functionality allows you to redirect calls to different phone numbers based on specific conditions using tools. This guide explains how to set up and use the transferCall
function for call forwarding.
transferCall
Tool: This tool enables call forwarding to predefined phone numbers with specific messages based on the destination.
- Destinations: A list of phone numbers where the call can be forwarded.
- Messages: Custom messages that inform the caller about the call being forwarded.
The transferCall
tool includes a list of destinations and corresponding messages to notify the caller:
{
"tools": [
{
"type": "transferCall",
"destinations": [
{
"type": "number",
"number": "+1234567890",
"message": "I am forwarding your call to Department A. Please stay on the line."
},
{
"type": "number",
"number": "+0987654321",
"message": "I am forwarding your call to Department B. Please stay on the line."
},
{
"type": "number",
"number": "+1122334455",
"message": "I am forwarding your call to Department C. Please stay on the line."
}
],
"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",
"enum": [
"+1234567890",
"+0987654321",
"+1122334455"
],
"description": "The destination to transfer the call to."
}
},
"required": [
"destination"
]
}
},
"messages": [
{
"type": "request-start",
"content": "I am forwarding your call to Department A. Please stay on the line.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+1234567890"
}
]
},
{
"type": "request-start",
"content": "I am forwarding your call to Department B. Please stay on the line.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+0987654321"
}
]
},
{
"type": "request-start",
"content": "I am forwarding your call to Department C. Please stay on the line.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+1122334455"
}
]
}
]
}
]
}
When the assistant needs to forward a call, it uses the transferCall
function with the appropriate destination:
{
"function": {
"name": "transferCall",
"parameters": {
"destination": "+1234567890"
}
}
}
Customize the messages for each destination to provide clear information to the caller:
{
"messages": [
{
"type": "request-start",
"content": "I am forwarding your call to Department A. Please stay on the line.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+1234567890"
}
]
}
]
}
Use the system prompt to guide the assistant on when to utilize each forwarding number. For example:
- "If the user asks for sales, call the
transferCall
function with+1234567890
." - "If the user requests technical support, use the
transferCall
function with+0987654321
."
- If calls are not being transferred, check the logs for errors.
- Ensure that the correct destination numbers are used.
- Ensure you have written the function description properly to indicate where you want to forward the call
- Test the call forwarding setup thoroughly to confirm its functionality.
By following these guidelines and utilizing the transferCall
tool, you can effectively manage call routing and provide a seamless experience for your users.