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.
Key Concepts
Call Forwarding Tools
transferCall
Tool: This tool enables call forwarding to predefined phone numbers with specific messages based on the destination.
Parameters and Messages
- Destinations: A list of phone numbers where the call can be forwarded.
- Messages: Custom messages that inform the caller about the call being forwarded.
Setting Up Call Forwarding
1. Defining Destinations and Messages
The transferCall
tool includes a list of destinations and corresponding messages to notify the caller:
You can also specify the extension
parameter to forward the call to an extension.
2. Using the transferCall
Function
When the assistant needs to forward a call, it uses the transferCall
function with the appropriate destination:
3. Customizing Messages
Customize the messages for each destination to provide clear information to the caller:
Instructing the Assistant
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
.”
Troubleshooting
- 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.
Call Transfers Mode
Vapi supports two types of call transfers:
- Blind Transfer (default): Directly transfers the call to another agent without providing any prior information to the recipient.
- Warm Transfer: Transfers the call to another agent after providing context about the call. The context can be either a full transcript or a summary, based on your configuration.
Warm Transfer
To implement a warm transfer, add a transferPlan
object to the transferCall
tool syntax and specify the transfer mode.
Modes of Warm Transfer
1. Warm Transfer with Summary
In this mode, Vapi provides a summary of the call to the recipient before transferring.
-
Configuration:
- Set the
mode
to"warm-transfer-with-summary"
. - Define a
summaryPlan
specifying how the summary should be generated. - Use the
{{transcript}}
variable to include the call transcript.
- Set the
-
Example:
2. Warm Transfer with Message
In this mode, Vapi delivers a custom message to the recipient before transferring the call.
-
Configuration:
- Set the
mode
to"warm-transfer-with-message"
. - Provide the custom message in the
message
property. - Note that the
{{transcript}}
variable is not available in this mode.
- Set the
-
Example:
Complete Example
Here is a full example of a transferCall
payload using the warm transfer with summary mode:
3. Warm Transfer with Wait and Say Message
In this mode, Vapi waits for the recipient to speak first and then delivers a custom message to the recipient before transferring the call.
-
Configuration:
- Set the
mode
to"warm-transfer-wait-for-operator-to-speak-first-and-then-say-message"
. - Provide the custom message in the
message
property. - Note that the
{{transcript}}
variable is not available in this mode.
- Set the
-
Example:
4. Warm Transfer with Wait and Say Summary
In this mode, Vapi waits for the recipient to speak first and then delivers a summary of the call to the recipient before transferring the call.
-
Configuration:
- Set the
mode
to"warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary"
. - Define a
summaryPlan
specifying how the summary should be generated. - Use the
{{transcript}}
variable to include the call transcript.
- Set the
-
Example:
5. Warm Transfer with TwiML
In this mode, Vapi executes TwiML instructions on the destination call leg before connecting the destination number.
-
Configuration:
- Set the
mode
to"warm-transfer-with-twiml"
. - Provide the TwiML instructions in the
twiml
property. - Supports only
Play
,Say
,Gather
, andPause
verbs. - Maximum TwiML length is 4096 characters.
- TwiML must be provided as a single-line string without line breaks or tabs, and must be a valid XML string. For example:
<Say>Hello</Say>
is valid, but<Say>Hello\n</Say>
is not.
- Set the
-
Example:
Here is a full example of a transferCall
payload using the warm transfer with TwiML mode:
Notes:
- In all warm transfer modes, the
{{transcript}}
variable contains the full transcript of the call and can be used within thesummaryPlan
. - For more details about transfer plans and configuration options, please refer to the transferCall API documentation