Inbound Fallback Number > Server Refusal for Trans...
# support
j
@Shubham Bajaj Would it be possible to have our server send a response to an assistant-request so the call gets automatically transferred to the fallback number? Sending a malformed json does not transfer the call and plays a VAPI message to the caller. callid: a683fd52-5d38-4329-80a8-a0f5e9859e25 callid: 0ce0300d-59be-478d-b424-9a0e6b911fd2 Sending a 400 or 500 message returns a message saying that the server responded with error ###. callid: 93aeecc7-cced-4623-862f-af418ecbd04c callid: 3721e8c3-6b53-4976-b5da-4ed1dd2f4534 This is not the desired outcome.
v
To automatically transfer a call to a fallback number when an error occurs (such as a pipeline error), you can use an assistant hook like this in your assistant configuration:
Copy code
json
{
  "hooks": [{
    "on": "call.ending",
    "filters": [{
      "type": "oneOf",
      "key": "call.endedReason",
      "oneOf": ["pipeline-error"]
    }],
    "do": [{
      "type": "transfer",
      "destination": {
        "type": "number",
        "number": "+1234567890"
      }
    }]
  }]
}
Replace
+1234567890
with your fallback number. This will transfer the call if a pipeline error occurs, which is the closest supported approach to your use case according to the documentation.
Note: Directly returning a transfer instruction in the assistant-request response for transient assistants is not documented as supported. [See more in the documentation.](https://docs.vapi.ai/assistants/assistant-hooks#example-transfer-on-pipeline-error) Source: - [Assistant hooks](https://docs.vapi.ai/assistants/assistant-hooks#example-transfer-on-pipeline-error)
j
how can i apply this to transient assistants? The idea would be to have the call transferred if the backend fails to produce an assistant json or even fails to respond.
c
Yes, you can intercept vapi assistant-request or transfer-destination-request webhook and respond with a connect action (or dynamic transfer JSON) pointing to your fallback number so the call auto-forwards..
For transient assistants, set a call.ending hook with pipeline-error filter or use a dynamic transfer webhook that returns a fallback number when your backend fails or times out..
3 Views