Is there a way to reject a call before Twilio and ...
# support
v
You can reject calls after they reach your Vapi server by checking the caller's number and responding with an error in your webhook. Here's a Node.js/Express example:
Copy code
js
app.post("/webhooks/vapi", (req, res) => {
  const spamNumbers = new Set(["+11234567890"]);
  const incomingNumber = req.body?.call?.from?.phoneNumber;
  if (incomingNumber && spamNumbers.has(incomingNumber)) {
    return res.json({ error: "Sorry, your number is blocked due to spam reports." });
  }
  // ...proceed with call
});
Note: This still incurs Twilio costs, as the call is accepted before rejection. [See full example in Vapi docs](https://docs.vapi.ai/server-url/spam-call-rejection) Source: - [Spam call rejection](https://docs.vapi.ai/server-url/spam-call-rejection)
y
This is a way to do it but still incurs Twilio costs (as the call is accepted and handled by twilio) I want the call to be rejected even before so I don't have any costs associated with tha tcall
c
Hi yanyan, How can I assist you with your query regarding Vapi and Twilio? Please provide more details about your specific issue or question.
2 Views