We are currently creating a outbound calling system in which we are using Twilio for outbound calls plus cloudflare, The issue is twilio fires our url but it doesnot hit the cloudflare url present in our function.
MAKE CALL
@api_view(['POST'])
@permission_classes([IsAuthenticated])
def make_call(request):
"""
Make outgoing call
Example: /api/aiagent/make_call/?to=+923145353217
"""
to_number = request.GET.get('to', '')
if not to_number:
return JsonResponse({"error": "'to' parameter required"}, status=400)
try:
client = TwilioClient(
os.getenv("TWILIO_ACCOUNT_SID"),
os.getenv("TWILIO_AUTH_TOKEN")
)
print("ACCOUNT SID:", os.getenv("TWILIO_ACCOUNT_SID"))
print("PHONE NUMBER:", os.getenv("TWILIO_PHONE_NUMBER"))
print("URL:", "https://sandy-publicity-horse-builds.trycloudflare.com/api/aiagent/outgoing_call_handler/")
call = client.calls.create(
url="https://***********.trycloudflare.com/api/aiagent/outgoing_call_handler/",
to=to_number,
from_=os.getenv("TWILIO_PHONE_NUMBER"),
caller_id=os.getenv("TWILIO_PHONE_NUMBER"),
)
return JsonResponse({
"success": True,
"call_sid": call.sid,
"status": call.status,
"to": to_number
})
except Exception as e:
return JsonResponse({"error": str(e)}, status=500)
LOGS:
HTTP response complete for ['127.0.0.1', 52520]
127.0.0.1:52520 - - [29/Apr/2026:15:31:12] "POST /api/aiagent/make_call/?to=+923319067199" 200 110
2026-04-29 15:32:12,300 INFO Timing out client: IPv4Address(type='TCP', host='127.0.0.1', port=52520)
Look it hits the make call url but after that it doesnot hit the cloudflare url. The call is made but it only reads twilios message for upgradation and then there is 6 seconds silence and then the call drops.
I have checked the Call Logs in Twilio they only hit one url and dont hit the cloudflare url at all.
When I check them individually using curl commands they are working fine but when I make a call it doesnot hit the cloudflare url.
I have also checked the Error Logs in Twilio but they are empty as the cloudflare url is not being hit at all.
Moreover We are using Trial version of Twilio and are using number it provides by default and we are sending calls on a verified number. I dont know if its a region issue or something or does the trial version not allow webhooks. It wont work.
We are currently creating a outbound calling system in which we are using Twilio for outbound calls plus cloudflare, The issue is twilio fires our url but it doesnot hit the cloudflare url present in our function.
MAKE CALL
@api_view(['POST'])
@permission_classes([IsAuthenticated])
def make_call(request):
"""
Make outgoing call
Example: /api/aiagent/make_call/?to=+923145353217
"""
to_number = request.GET.get('to', '')
LOGS:
HTTP response complete for ['127.0.0.1', 52520]
127.0.0.1:52520 - - [29/Apr/2026:15:31:12] "POST /api/aiagent/make_call/?to=+923319067199" 200 110
2026-04-29 15:32:12,300 INFO Timing out client: IPv4Address(type='TCP', host='127.0.0.1', port=52520)
Look it hits the make call url but after that it doesnot hit the cloudflare url. The call is made but it only reads twilios message for upgradation and then there is 6 seconds silence and then the call drops.
I have checked the Call Logs in Twilio they only hit one url and dont hit the cloudflare url at all.
When I check them individually using curl commands they are working fine but when I make a call it doesnot hit the cloudflare url.
I have also checked the Error Logs in Twilio but they are empty as the cloudflare url is not being hit at all.
Moreover We are using Trial version of Twilio and are using number it provides by default and we are sending calls on a verified number. I dont know if its a region issue or something or does the trial version not allow webhooks. It wont work.