https://retellai.com/?utm_source=discord&utm_medium=seo logo
I am using the create phone call method in python ...
# ❓・ai-evy-support
c
@AI Evy I am using the create phone call method in python only custom llm setup. But everytime I connect and try to use the method I get a 404 not found error from retell. But I am using the correct agent id from retell dash
a
Thanks for tagging me @cartier5. I'll look through relevant sources and get back to you shortly.
### Answer Based on the sources, a 404 error when creating a phone call typically indicates one of these issues [(1) ]() [(2) ]() : Most Common Causes: 1. Phone number not properly configured - Your
from_number
must be a phone number you've purchased and configured through Retell AI 2. Incorrect parameter names - Use
override_agent_id
instead of
agent_id
in your request 3. Phone number lacks outbound agent binding - The phone number should have an
outbound_agent_id
configured, or you need to use the
override_agent_id
parameter Correct Request Structure: Your request payload should look like this :
Copy code
python
{
  "from_number": "+16504144521",
  "to_number": "your_target_number",
  "override_agent_id": "your_agent_id_here",
  "retell_llm_dynamic_variables": {
    "name": "value"
  }
}
​ To learn more, see the sources I considered: [[1] 404 Error on Create a Phone Call](https://retell.discourse.group/t/404-error-on-create-a-phone-call/22) [[2] Here is how that can be fixed](https://retell.discourse.group/t/here-is-how-that-can-be-fixed/23) [[3] Create Phone Number](https://docs.retellai.com/api-references/create-phone-number) [[4] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[5] How can I create an outbound call](https://retell.discourse.group/t/how-can-i-create-an-outbound-call/132) ​
[(1) ]() , [(2) ]() Steps to Fix: 1. Verify your phone number is purchased/imported in Retell AI [(3) ]() [(1) ]() 2. Ensure the phone number has an
outbound_agent_id
configured [(3) ]() [(2) ]() 3. Use
override_agent_id
parameter in your create phone call request [(4) ]() [(1) ]() 4. Check that your
from_number
is in E.164 format (e.g.,
"+14157774444"
) [(4) ]() [(5) ]() If you haven't set up your phone number yet, you'll need to either purchase a new number through Retell AI or import an existing number from a supported provider [(2) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So this create phone call method is for creating outbound calls from my agent to another number?
a
Thanks for the follow-up, @cartier5. I'll get back to you soon.
### Answer Yes, exactly. The Create Phone Call API is specifically designed for making outbound calls from your Retell AI agent to another phone number [(1) ]() . What it does: The method initiates an outbound call where your agent calls a destination number (
to_number
) from your Retell phone number (
from_number
) [(2) ]() [(1) ]() . Basic structure in Python:
Copy code
python
import Retell from 'retell-sdk';

const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;

const phoneCallResponse = await client.call.createPhoneCall({
 from_number: '+14157774444',
 to_number: '+12137774445',
}) ;

console.log(phoneCallResponse.agent_id) ;
[(1) ]() Key parameters: - `from_number`: Your Retell number in E.164 format - `to_number`: The destination number you want to call in E.164 format - `override_agent_id`: The agent ID to handle the call (optional if your phone number already has an outbound agent configured) The agent you specify will handle the conversation when the call connects [(2) ]() [(1) ]() .
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[2] Outbound Calls (Make Calls)](https://docs.retellai.com/deploy/outbound-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy ok well that is probably the problem I am trying to use that method to connect to my retell agent for an inbound call. I have a twilio number I am using to use dtmf tones before I hit retell. How can I forward a call from one endpoint in my server to the web socket endpoint so the call will connect to retell? Or how can I programmatically create a phone call
a
Thanks for the follow-up, @cartier5. I'll get back to you soon.
### Answer Based on the available sources, I don't have documentation that directly explains how to forward an inbound Twilio call through your server to Retell's WebSocket endpoint after handling DTMF tones. However, I can clarify the distinction between the two approaches: Create Phone Call method is specifically for outbound calls where your agent initiates the call to another number [(1) ]() [(2) ]() . This is why you're getting a 404 error when trying to use it for inbound calls - it's not designed for that use case. For inbound calls with a custom LLM setup, you need to set up a WebSocket server that Retell connects to [(3) ]() . The WebSocket endpoint follows this pattern:
wss://your_domain/llm-websocket/
. The sources show how to set up the WebSocket server endpoint :
Copy code
python
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.create() ;
console.log(phoneNumberResponse.inbound_agent_id) ;
Unfortunately, the available sources don't contain specific documentation about: - Forwarding calls from Twilio through your DTMF handling to Retell's WebSocket - Programmatically connecting an already-active inbound call to a WebSocket endpoint For this specific integration pattern (Twilio → DTMF handling → Retell WebSocket) , I'd recommend: Visit [Contact Sales]() or check [) for implementation guidance on this custom telephony scenario.
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[2] How can I create an outbound call](https://retell.discourse.group/t/how-can-i-create-an-outbound-call/132) [[3] Setup WebSocket Server](https://docs.retellai.com/integrate-llm/setup-websocket-server) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.