equal-aqua
equal-aqua14mo ago

Respond to an `assistant-request` with a call redirect?

We want to conditionally redirect some calls going to Vapi to another number, and preferrably we could do this without having to wait for the assistant to load in, trigger some user input, then use a tool call. Ideally we could return a certain response from the assistant-request which would cause the call to redirect instantly. Is this possible?
8 Replies
Vapi
Vapi14mo ago
@heebers Yes, it is possible to conditionally redirect calls in VAPI without waiting for the assistant to load. You can achieve this by implementing logic on your server that handles the assistant-request message. When your server receives an assistant-request, you can check the caller's phone number or any other relevant conditions and decide whether to return an assistant's details or a response that instructs VAPI to redirect the call immediately. If you decide to redirect the call, you can respond with a JSON object that contains the necessary instructions for redirection instead of returning an assistant. The exact structure of this JSON object would depend on the specific capabilities and requirements of VAPI. If VAPI supports such a feature, the response would typically include the target phone number to which the call should be redirected. If you need the exact JSON structure or further assistance on how to implement this, please ask support for more info on this. You can continue this conversation by mentioning me in the message. Got it. Tagging @Vapi Team for additional help.
harsh-harlequin
harsh-harlequin14mo ago
yes can transfer the call but after the user response. because the first message won't allow you to call the tool. what's is in your mind? it's intresting.
equal-aqua
equal-aquaOP14mo ago
we want to have the bot transfer the call immediately if a check on our server-side passes (aka if the number of the caller is in a registry) we currently have to route this thru to another twilio number to provide that conditional routing, but if we could trigger a forward when responding to the assistant request message, that would remove the need for the extra routing number
harsh-harlequin
harsh-harlequin14mo ago
1. don't set any assistant on vapi 2. vapi will make the request to your server for assistant 3. return the assistant based on number
equal-aqua
equal-aquaOP14mo ago
yes, but if the number is in the list then we want it to forward to another number, not an assistant
harsh-harlequin
harsh-harlequin14mo ago
see using assistant this is the only method
equal-aqua
equal-aquaOP14mo ago
so the desired workflow is not possible?
harsh-harlequin
harsh-harlequin14mo ago
yes bcoz w/o assistant cannot =, back to twilio flow. Sorry buddy.

Did you find this page helpful?