Can I directly transfer the call before saying the...
# support
t
I have a business where I need to check the schedule to decide whether to transfer the call to a person or handle the call with AI. Currently, I use a Twilio webhook to handle this, but when I import the phone number to VAPI, the webhook endpoint changes to the VAPI endpoint. 1. Can I make a direct transfer in an assistant-request? 2. If it is transfered to a person then if they don't pick the call can I use VAPI assistant to handle the call ?
v
message has been deleted
@theflash489 Absolutely, you can manage call routing within your VAPI assistant to decide whether to transfer the call to a person or handle it with AI. When you receive an
assistant-request
message, your server can determine the appropriate action based on the current schedule. To implement this, you would typically have logic on your server that checks the schedule upon receiving the
assistant-request
. If the schedule indicates that the call should be transferred to a person, your server can respond with a JSON object containing the assistant configuration that includes a directive to transfer the call. Here's a simplified example of how your server might respond to transfer the call:
Copy code
json
{
  "actions": [
    {
      "action": "transfer",
      "targetType": "phone",
      "target": "PERSON_PHONE_NUMBER"
    }
  ]
}
Replace
PERSON_PHONE_NUMBER
with the actual phone number you want to transfer the call to. If the schedule indicates that the call should be handled by AI, you can respond with the assistant configuration that includes the AI handling logic. Remember to ensure that your server logic accounts for time zones and any other relevant factors when checking the schedule. If you need further assistance with setting up your server to handle these requests, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
t
The bot's answer is incorrect but I've found that I need to use destination property to response for assistant-request
How about the question 2 ?
@Vapi
v
@theflash489 I apologize for any confusion earlier. Regarding your second question, if a call is transferred to a person and they do not pick up, you can indeed configure your VAPI assistant to handle the call afterward. This can be set up using a fallback mechanism where the call is redirected back to the VAPI assistant if the person does not answer. Here's how you might handle this scenario: 1. Transfer the call to a person using the
destination
property in your assistant's response to an
assistant-request
. 2. Set up a fallback or timeout within your call transfer logic that redirects the call back to the VAPI assistant if the person does not answer within a certain time frame. 3. Once the call is redirected back, the VAPI assistant can take over and interact with the caller using predefined logic or AI. If you need specific guidance on how to implement this fallback mechanism or if you have any other questions, please don't hesitate to ask for more information.
t
@User Yeah, Give me the guidance how to implement the fallback. Please note that I need to check in my database whether it should call back to the VAPI or not
@Vapi any answer ?
@User Can you confirm about this case ? I need to respond to my customer
s
1. Yes you can use VAPI to direct transfer post returning response to
assistant-request
server event by setting the assistant first message mode to
assistant-speaks-first-with-model-generated-message
and using trigger the transferCall function in the prompt. 2. If the person doesn't picks the call then by default VAPI assistant won't continue with the call instead you have to find a way around to transfer the call to the assistant back or to another assistant. @theflash489 hope this clears your doubts, do let me know if you require further help.
t
Hi @Shubham Bajaj , For 2, I am thinking that I will set webhook in twilio to point to our endpoint and when the person does not pick the call I will redirect redirect it to vapi endpoint. Is it ok if the webhook in twilio is not vapi endpoint ?
s
To hook the call into the Vapi checkout this repository https://github.com/VapiAI/advanced-concepts-custom-llm Do let me know if you require further help.
t
Hi @Shubham Bajaj , I don't want to use custom llm
For 2, as you suggested, I need to find a way to transfer the call back to the assistant. Do you have any ideas on how to achieve this? Additionally, I'm curious about the call status after forwarding. Specifically, I want to know if the call was picked up by anyone. When I checked the "end-of-call-report" logs, the status was "ringing," which doesn't seem accurate. Is it possible to determine if the call was actually answered?
s
@theflash489 your correct my bad, it was https://github.com/VapiAI/advanced-concepts-phone-call-provider-bypass not custom-llm.
> Additionally, I'm curious about the call status after forwarding. Specifically, I want to know if the call was picked up by anyone. When I checked the "end-of-call-report" logs, the status was "ringing," which doesn't seem accurate. Is it possible to determine if the call was actually answered? Can you share the call id of this call. > For 2, as you suggested, I need to find a way to transfer the call back to the assistant. Do you have any ideas on how to achieve this? @theflash489 give me some time on this to check with the team.
t
This repo might be outdated. I see it uses a create call API to create a call and get Twiml for response for Twilio. However, I just checked your Swagger documentation about creating a call at https://api.vapi.ai/api#/Calls/CallController_create. I don't see the property phoneCallProviderBypassEnabled in the request and the property phoneCallProviderDetails in the response. Do you have a latest example ?
This is a callId 7a901152-9ca4-42d6-b8e2-402437995169 I see the status in call object is always ringing for all server-message request
s
Copy code
json
{
  /**
   * This prevents Vapi from initiating calls directly. Defaults to disabled.
   *
   * Suitable for external call handling, such as with Twilio Studio Flow, with integration details provided in `call.phoneCallProviderDetails`.
   */
  @IsOptional()
  @IsBoolean()
  @ApiHideProperty()
  phoneCallProviderBypassEnabled?: boolean;
}
logs
🔵 09:34:33:993 Server Message Requested...(status-update , https://ql0mogs3b6.execute-api.us-east-1.amazonaws.com/dev/vapi-incomming-call): { "type": "status-update", "status": "forwarding", 🔵 09:34:36:652 Server Message Requested...(status-update , https://ql0mogs3b6.execute-api.us-east-1.amazonaws.com/dev/vapi-incomming-call): { "type": "status-update", "status": "ended", "endedReason": "assistant-forwarded-call" }
@theflash489 can you check the logs again in your side, I do see the correct status-updates.
t
I mean the status field within the call object. I assume this field reflects the call status provided by Twilio. Is this correct ?
s
The call object is stale sometimes and we are working on it, can you use
status-update
and
end-of-call-report
ended-reason?
t
That doesn't matter to me. My goal is to determine if the forwarded call was answered. Currently, I'm using Twilio's DialCallStatus to check if the call was answered. Does VAPI support to determine if the call was actually answered ?
Hi bro, I've tried with this. When the webhook URL is set to https://api.vapi.ai/twilio/inbound_call, forwarding calls works successfully. However, when I use my own API as the webhook and call VAPI to create a call and retrieve twiml, the transfer doesn't work as expected. The logs show a successful transfer, but I don't receive any transfered call and the call ends after about 2 or 3 seconds. The callId is 933b08df-fc81-4a85-be37-0e15676a88e1 I just want to report this to you to check if it is a bug. Regarding this thread, I would like to know the status of the forwarded call. If you have any updates on this, please let me know
s
You can use the both but already mentioned your call was sucesfully transferd from our side and twilio has accepted it. If it was failure or other reason the status wouldn't be forwarding > ending, and endedReason to be assistant-forwarded-call.
I don't see any issue with call forwarding status @User
@theflash489 remove the server event
phone-call-control
and then try. This server event makes a send request to your server for control the call transfer instead of Vapi, so removing it and tryin again is benefical for you.
logs
🔵 10:54:09:229 Server Message Requested...(phone-call-control , https://ql0mogs3b6.execute-api.us-east-1.amazonaws.com/dev/vapi-incomming-call): { "type": "phone-call-control", "request": "forward", "forwardingPhoneNumber": "+18324226779", "destination": { "type": "number", "number": "+18324226779", "description": "this phone number is to use to transfer to agent of dealership Autolabs Motor" } }
t
I agree that the call forwarding status is working as your expectation. However, I need to track these calls in my system. If someone picks up the forwarded call, it should be marked as 'Transferred' If no one picks up or the user ends the call, it should be marked as 'Abandoned'. Can you suggest how I can implement this tracking using VAPI?
s
If a call is forwarded then calls end with reason with
assistant-forwarded-call
and status ended, if someone doesn't picks the call then status remains the same
ended
, and if user ends the call then it's marked as
customer-ended-the-call
.
@theflash489 do let me know if I can close this ticket if all of your questions are resovled?
t
I've noticed that the behavior doesn't match your description. I'm consistently receiving
status-update
events with an
ended
status, an
assistant-forwarded-call
reason, and
end-of-call-report
events after that, even when the forwarded call is still ringing. After I pick up the call, say something, and end the call, there are no additional requests with the status
customer-ended-the-call
. The call ID is b56c45c8-c0ce-4aa7-bcf1-a312f5e27829 for you to check.
s
@theflash489 No, that's not what I meant. Here's what I meant: 1. If a call is forwarded and someone answers, the call end reason is
assistant-forwarded-call
, and the status is
ended
. 2. If a call is forwarded and no one answers, the call end reason is still
assistant-forwarded-call
, and the status is
ended
. 3. If the customer ends the call after it’s forwarded, the status stays
ended
, and the call end reason remains
assistant-forwarded-call
. Once a call is forwarded, it’s considered done on our side. You won’t get any more status updates for it. By the way, the end-of-call report isn’t connected to the call end reason.
@theflash489 do let me know if you have more questions, and else if all questions are answered related to this thread can I close this ticket?
t
Oh, that's unfortunate. That is not what I expected. However, it is clear, and you can close this ticket
s
@theflash489 can you let me know your expectations?
t
I expect a request from VAPI to notify me the status of a forwarded call, such as whether someone answers the call, and after the call is completed, I should receive a request with the status like
completed
. If no one answers the call, I should receive a request with the status like
no-answer
or
busy
. That is what I need. Additionally, I also expect VAPI to support recording the forwarded call, but I see that you have already answered in another thread that VAPI does not support this.
s
Raise the feature-request over here https://vapi.canny.io
2 Views