Skip to content

Commit 7321d36

Browse files
authored
dynamic handoff custom error and live call control handoff examples (#707)
1 parent 156ca8e commit 7321d36

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

fern/calls/call-features.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,30 @@ curl -X POST 'https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/742
129129
}'
130130
```
131131

132+
### 6. Handoff Call
133+
Handoff the call to a different assistant.
134+
135+
```bash
136+
curl -X POST 'https://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/control'
137+
-H 'content-type: application/json'
138+
--data-raw '{
139+
"type": "handoff",
140+
"destination": {
141+
"type": "assistant",
142+
"contextEngineeringPlan": "none",
143+
"assistant": {
144+
"name": "new_assistant",
145+
"voice": {
146+
"provider": "vapi",
147+
"voiceId": "Neha"
148+
},
149+
}
150+
},
151+
"content": "Handing off your call now"
152+
}'
153+
```
154+
155+
132156
## Call Listen Feature
133157

134158
The `listenUrl` allows you to connect to a WebSocket and stream the audio data in real-time. You can either process the audio directly or save the binary data to analyze or replay later.

fern/tools/handoff.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ destination: {
226226
},
227227
```
228228

229+
If the handoff should not executed, either respond with an empty destination, or provide a custom error. The custom error will be added to the message history.
230+
```json
231+
{
232+
error: "Example custom error message"
233+
}
234+
````
235+
229236
### 3.2 Dynamic Handoff with Custom Parameters
230237

231238
Pass additional context to your webhook for intelligent routing:

0 commit comments

Comments
 (0)