https://retellai.com/?utm_source=discord&utm_medium=seo logo
how can i prevent a number for calling through inb...
# ❓・ai-evy-support
n
@AI Evy how can i prevent a number for calling through inbound on retell?
a
Thanks for tagging me @Nicolas. I'll look through relevant sources and get back to you shortly.
### Answer --- You can block specific numbers from inbound calls using the Inbound Webhook. Here's how: [(1) ]() 1. Unset the
Inbound Call Agent
in your phone number settings 2. Enable the
Inbound Webhook
3. In your webhook handler, check the
from_number
field in the request payload to identify the caller To reject a call: - Respond with a
200
status code without including
call_inbound.override_agent_id
in the JSON response To accept a call: - Respond with a
200
status code with
call_inbound.override_agent_id
set to your desired agent Example request payload you'll receive:
Copy code
json
{
  "event": "call_inbound",
  "call_inbound": {
    "agent_id": "agent_12345",
    "agent_version": 1,
    "from_number": "+12137771234",
    "to_number": "+12137771235"
  }
}
You can maintain a blocklist and check if
from_number
matches any blocked numbers, then respond accordingly. [(1) ]() [(2) ]()
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy can you show an example of how should i return the payload, if i dont want to accept the call?
a
Thanks for the follow-up, @Nicolas. I'll get back to you soon.
### Answer To reject an inbound call, respond with a
200
status code and an empty JSON object (or a JSON object that does not include
call_inbound.override_agent_id
) . [(1) ]() Example response to reject a call:
Copy code
json
{}
Or:
Copy code
json
{
  "call_inbound": {}
}
The key is that you're returning a successful
200
response without specifying an
override_agent_id
, which tells Retell not to connect the call to any agent.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy now show an example of a response that i want to pick up the call
a
Thanks for the follow-up, @Nicolas. I'll get back to you soon.
### Answer To accept an inbound call, respond with a
200
status code and include the
override_agent_id
in your response: [(1) ]()
Copy code
json
{
  "call_inbound": {
    "override_agent_id": "agent_12345",
    "override_agent_version": 1,
    "dynamic_variables": {
        "customer_name": "John Doe"
    },
    "metadata": {
        "random_id": "12345"
    }
  }
}
All fields except
override_agent_id
are optional. You can also include: -
dynamic_variables
to pass call-specific data to your agent -
metadata
to store custom information -
agent_override
to override specific agent settings for this call only
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy im returning this and still get connected: result = {"call_inbound": {}} {"statusCode": 200, "body": json.dumps(result)}
a
Thanks for the follow-up, @Nicolas. I'll get back to you soon.
### Answer Based on the documentation, there's an important prerequisite for rejecting calls via the inbound webhook: you must unset the
Inbound Call Agent
in your phone number settings first. [(1) ]() If your number still has an inbound agent configured, the webhook fallback behavior kicks in. The docs state: "If all of those attempts fail, it will check whether this number has an inbound agent id set. If it does, it will then try to connect the call to that agent." To properly reject calls: 1. Unset the
Inbound Call Agent
in the phone number setting 2. Enable the
Inbound Webhook
3. Return a 200 response without
override_agent_id
If you have an inbound agent set on the number, returning an empty
call_inbound
object won't reject the call—it will fall back to that agent.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy can you explain in other words the steps please
a
Thanks for the follow-up, @Nicolas. I'll get back to you soon.
### Answer Sure, here's a simpler breakdown: [(1) ]() Step 1: Go to your phone number settings and remove the inbound agent. Leave that field empty/blank. Step 2: Turn on the inbound webhook and point it to your server endpoint. Step 3: In your webhook code, check the
from_number
to see who's calling: - To block the call: Return
200
with
{}
or
{"call_inbound": {}}
— since there's no agent set on the number and no
override_agent_id
in your response, the call gets rejected - To accept the call: Return
200
with
{"call_inbound": {"override_agent_id": "your_agent_id"}}
Why your current setup isn't working: If you still have an inbound agent assigned to the phone number, Retell will fall back to that agent when your webhook doesn't provide an
override_agent_id
. The number must have no default agent for rejection to work.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy is there a way to use Retell's number and a custom function for SMS on twilio?
a
Thanks for the follow-up, @Nicolas. I'll get back to you soon.
### Answer ### Answer Yes, you can use a Retell Twilio number with SMS capabilities. Here's how it works: For Retell Twilio Numbers: - SMS is natively supported once you complete the approval process (business profile, brand registration, and SMS campaign) [(1) ]() - You can send one-way SMS during calls using the built-in Send SMS tool (Single/Multi Prompt) or SMS Node (Conversation Flow) [(2) ]() [(3) ]() For custom SMS logic via Twilio: If you want more control, you can set up a custom function that calls Twilio's API directly. One approach mentioned in the community: [(4) ]() - Create a custom function in your agent that triggers a webhook - That webhook calls Twilio's SMS API with your desired message content - Since Retell now supports POST requests in custom functions, you can configure this directly inside the agent config For two-way SMS conversations: - Attach a chat agent to the number [(1) ]() - Use the [Create Outbound SMS API]() to programmatically send messages [(5) ]()
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatResponse = await client.chat.createSMSChat({
  from_number: '+12137771234',
  to_number: '+14155551234',
}) ;
Important: SMS capabilities currently only work with Retell Twilio numbers (US numbers only) . Custom telephony numbers require a custom function workaround to send SMS. [(1) ]() [(8) ]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.