From d4252d095cffba11507a2c600af455de089fbc2c Mon Sep 17 00:00:00 2001 From: Sri Date: Wed, 5 Mar 2025 11:48:43 -0800 Subject: [PATCH 1/2] VAP-3931 Added more transferPlan details and along with twiml notes --- fern/call-forwarding.mdx | 104 ++++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 30 deletions(-) diff --git a/fern/call-forwarding.mdx b/fern/call-forwarding.mdx index 7079ffeaa..10c9a0ea0 100644 --- a/fern/call-forwarding.mdx +++ b/fern/call-forwarding.mdx @@ -3,7 +3,6 @@ title: Call Forwarding slug: 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 @@ -53,17 +52,11 @@ The `transferCall` tool includes a list of destinations and corresponding messag "properties": { "destination": { "type": "string", - "enum": [ - "+1234567890", - "+0987654321", - "+1122334455" - ], + "enum": ["+1234567890", "+0987654321", "+1122334455"], "description": "The destination to transfer the call to." } }, - "required": [ - "destination" - ] + "required": ["destination"] } }, "messages": [ @@ -119,7 +112,6 @@ When the assistant needs to forward a call, it uses the `transferCall` function } } } - ``` ### 3. Customizing Messages @@ -142,7 +134,6 @@ Customize the messages for each destination to provide clear information to the } ] } - ``` ## Instructing the Assistant @@ -176,12 +167,13 @@ To implement a warm transfer, add a `transferPlan` object to the `transferCall` 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. +- **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. -* **Example:** +- **Example:** ```json "transferPlan": { @@ -204,14 +196,15 @@ In this mode, Vapi provides a summary of the call to the recipient before transf #### 2. Warm Transfer with Message -In this mode, Vapi delivers a custom static message to the recipient before transferring the call. +In this mode, Vapi delivers a custom message to the recipient before transferring the call. + +- **Configuration:** -* **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 `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. -* **Example:** +- **Example:** ```json "transferPlan": { @@ -259,17 +252,69 @@ Here is a full example of a `transferCall` payload using the warm transfer with } ``` -#### 3. Warm Transfer with TwiML +#### 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. + +- **Example:** + +```json +"transferPlan": { + "mode": "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message", + "message": "Hey, this call has been forwarded through Vapi." +} +``` + +#### 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. + +- **Example:** + +```json +"transferPlan": { + "mode": "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary", + "summaryPlan": { + "enabled": true, + "messages": [ + { + "role": "system", + "content": "Please provide a summary of the call." + }, + { + "role": "user", + "content": "Here is the transcript:\n\n{{transcript}}\n\n" + } + ] + } +} +``` + +#### 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`, `Hangup`, and `Pause` verbs. - * Maximum TwiML length is 4096 characters. +- **Configuration:** -* **Example:** + - Set the `mode` to `"warm-transfer-with-twiml"`. + - Provide the TwiML instructions in the `twiml` property. + - Supports only `Play`, `Say`, `Gather`, and `Pause` verbs. + - Maximum TwiML length is 4096 characters. + - TwiML must be provided as a single-line string without line breaks or tabs. + +- **Example:** ```json "transferPlan": { @@ -278,7 +323,6 @@ In this mode, Vapi executes TwiML instructions on the destination call leg befor } ``` - Here is a full example of a `transferCall` payload using the warm transfer with TwiML mode: ```json From 29994c0569cbd10be68a8ab1f14c1a05168f7f2f Mon Sep 17 00:00:00 2001 From: Sri Date: Wed, 5 Mar 2025 11:57:37 -0800 Subject: [PATCH 2/2] add more docs --- fern/call-forwarding.mdx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/fern/call-forwarding.mdx b/fern/call-forwarding.mdx index 10c9a0ea0..9bd4b567e 100644 --- a/fern/call-forwarding.mdx +++ b/fern/call-forwarding.mdx @@ -99,6 +99,19 @@ The `transferCall` tool includes a list of destinations and corresponding messag } ``` +You can also specify the `extension` parameter to forward the call to an extension. + +```json + "destinations": [ + { + "type": "number", + "number": "+1234567890", + "extension": "4603", + "message": "I am forwarding your call to Department A. Please stay on the line." + } + ] +``` + ### 2. Using the `transferCall` Function When the assistant needs to forward a call, it uses the `transferCall` function with the appropriate destination: @@ -312,7 +325,7 @@ In this mode, Vapi executes TwiML instructions on the destination call leg befor - Provide the TwiML instructions in the `twiml` property. - Supports only `Play`, `Say`, `Gather`, and `Pause` verbs. - Maximum TwiML length is 4096 characters. - - TwiML must be provided as a single-line string without line breaks or tabs. + - TwiML must be provided as a single-line string without line breaks or tabs, and must be a valid XML string. For example: `Hello` is valid, but `Hello\n` is not. - **Example:** @@ -349,4 +362,7 @@ Here is a full example of a `transferCall` payload using the warm transfer with } ``` -**Note:** In all warm transfer modes, the `{{transcript}}` variable contains the full transcript of the call and can be used within the `summaryPlan`. +**Notes:** + +- In all warm transfer modes, the `{{transcript}}` variable contains the full transcript of the call and can be used within the `summaryPlan`. +- For more details about transfer plans and configuration options, please refer to the [transferCall API documentation](https://docs.vapi.ai/api-reference/tools/create#request.body.transferCall.destinations.number.transferPlan)