https://retellai.com/?utm_source=discord&utm_medium=seo logo
We have two PCAP files from Twilio showing two cal...
# ❓・ai-evy-support
t
@AI Evy We have two PCAP files from Twilio showing two calls to the same agent. Both have identical SIP structure, same To header, same Diversion header, both get 200 OK from LiveKit, both complete successfully. The ONLY difference is the FROM number — one is our own number and one is a client's number that reaches us via 3CX call redirect. The direct call logs in Retell. The redirected call does not. Can you explain why this is happening and what can be done to fix this?
a
Thanks for tagging me @teppie. I'll look through relevant sources and get back to you shortly.
### Answer When calls are redirected through 3CX to Retell, the issue you're experiencing is likely related to how Retell identifies and routes the inbound call based on the phone number [(1) ]() . When using Elastic SIP Trunking with 3CX, you need to import your phone number into Retell and bind it to a specific agent . The phone number must be in E.164 format (including country code, no spaces or special characters) [(2) ]() [(3) ]() . During import, you provide the termination URI to identify your elastic SIP trunk (used for outbound calls) and a unique agent ID to bind the number, ensuring inbound calls are automatically directed to the specified agent [(2) ]() . The key issue is that when the FROM number changes due to 3CX redirect, Retell may not recognize which agent should handle the call because the number isn't properly imported and bound [(1) ]() . Without importing your number and binding it to your agent, Retell cannot determine which agent should handle the inbound call . To resolve this: 1. Import the redirected number - You need to use the Import Phone Number API to bind your 3CX-redirected number to your specific Retell agent . 2. Configure your SIP trunk settings - For your 3CX trunk pointing to
sip:sip.retellai.com
, ensure you're using the correct transport method : - TCP (Recommended) :
sip:sip.retellai.com;transport=tcp
[(4) ]() - UDP: `sip:s
ip.retellai.com;transport=udp` - TLS:
sip:sip.retellai.com;transport=tls
3. Verify origination settings - Check your origination (inbound) settings in your SIP trunk configuration [(1) ]() . You can whitelist Retell's IP blocks in 3CX [(4) ]() : - All regions:
18.98.16.120/30
- Certain US traffic:
143.223.88.0/21
,
161.115.160.0/19
The fact that both calls complete successfully with 200 OK but only one logs in Retell confirms this is a routing/binding issue rather than a connectivity problem. **
​ To learn more, see the sources I considered: [[1] I need to receive calls using 3cx as telephony system](https://community.retellai.com/t/i-need-to-receive-calls-using-3cx-as-telephony-system/435) [[2] AI in SIP Calling & Telephony Solutions | Retell AI](https://www.retellai.com/blog/integrating-ai-with-sip-trunking-and-modern-telephony) [[3] SIP Trunk Outbound Call - No SIP INVITE reaching my server](https://community.retellai.com/t/sip-trunk-outbound-call-no-sip-invite-reaching-my-server/760) [[4] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@User no we bought the number from twilio and gave it to our client for them to set up the call redirect. the number is already in Retell and is working fine when called but when the inbound call comes in from the client's number and redirects to the agent's number, we are not able to see the logs at all but the caller is able to talk to the agent
no we bought the number from twilio and gave it to our client for them to set up the call redirect. the number is already in Retell and is working fine when called but when the inbound call comes in from the client's number and redirects to the agent's number, we are not able to see the logs at all but the caller is able to talk to the agent @AI Evy
a
Thanks for the follow-up, @teppie. I'll get back to you soon.
### Answer Based on your clarification, the issue is that calls redirected through your client's 3CX system are completing successfully but not appearing in Retell's dashboard logs, even though the agent number is properly configured in Retell. This is likely a call registration issue. When calls are redirected through 3CX, the SIP headers may be modified in a way that prevents Retell from properly associating the call with your imported number, even though the call audio completes successfully. The most relevant troubleshooting approach based on the available documentation: Check the To/Request-URI headers in your PCAP files [(1) ]() . When using Elastic SIP Trunking, Retell routes calls based on the destination number in the SIP headers . If 3CX is modifying these headers during the redirect, Retell may not recognize which imported number the call is intended for, preventing proper logging even though LiveKit accepts the call. Verify your Twilio Elastic SIP Trunk origination settings [(2) ]() . The origination setup (for inbound calls) should specify Retell's SIP server address as
sip:sip.retellai.com
. Ensure this is correctly configured in your trunk that receives the redirected calls from 3CX. Consider the Dial to SIP URI method as an alternative [(1) ]() . If the redirect process is too complex for standard Elastic SIP Trunking, you could use the Register Phone Call API to obtain a call-specific SIP URI and have 3CX dial to that URI format:
sip:{call_id}@sip.retellai.com
. This would give you explicit control over call registration and logging. Since both calls reach LiveKit successfully but only the direct call logs properly, the issue is specifically with how Retell identifies and registers the redir
ected call rather than a connectivity problem.
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] Twilio](https://docs.retellai.com/deploy/twilio) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy but we have checked the PCAP files and they are the same. currently our sip trunk goes direct to livekit. will adding in Retell's SIP server address fix it? but it is working for those directly called from the number so I don't understand how that fixes things?
a
Thanks for the follow-up, @teppie. I'll get back to you soon.
### Answer The issue is that you're bypassing Retell's SIP server entirely by pointing directly to LiveKit [(1) ]() . This is why calls complete successfully but don't appear in Retell's logs—Retell never sees them . When using Elastic SIP Trunking, the proper architecture is: Twilio → Retell's SIP server (
sip:sip.retellai.com
) → LiveKit [(1) ]() [(2) ]() . Retell's SIP server handles call registration, logging, and routing to the appropriate agent before passing the call to LiveKit for voice processing [(2) ]() . The reason your direct calls work is likely coincidental—they may be hitting a different code path or the FROM number happens to match your imported number exactly. The redirected calls from 3CX change the FROM header, so when they bypass Retell's SIP server and go straight to LiveKit, there's no registration step to log them in your dashboard [(1) ]() . To fix this: Change your Twilio Elastic SIP Trunk origination URI from LiveKit's address to Retell's SIP server : - Use:
sip:sip.retellai.com;transport=tcp
(TCP is recommended) - Or:
sip:sip.retellai.com;transport=udp
- Or:
sip:sip.retellai.com;transport=tls
This ensures all inbound calls—whether direct or redirected—pass through Retell's infrastructure for proper logging and agent routing [(1) ]() [(2) ]() . Retell will then handle the connection to LiveKit internally [(2) ](
-telephony) . The PCAP files showing identical SIP structure doesn't matter if both calls are bypassing Retell's registration layer entirely [(1) ]() .
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] AI in SIP Calling & Telephony Solutions | Retell AI](https://www.retellai.com/blog/integrating-ai-with-sip-trunking-and-modern-telephony) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy We believe Retell is using the FROM number to identify and log calls, and when the FROM is an unrecognised external number, the call is handled by LiveKit but never logged. Can you confirm this behaviour and advise how to configure Retell to log calls regardless of the FROM number?"
a
Thanks for the follow-up, @teppie. I'll get back to you soon.
### Answer Your understanding is partially correct. When using Elastic SIP Trunking, Retell routes inbound calls based on the destination number (the TO/Request-URI in the SIP headers) , not the FROM number [(1) ]() . The destination number must match a number you've imported into Retell and bound to a specific agent [(1) ]() [(2) ]() . However, the core issue remains: you're bypassing Retell's SIP server by pointing directly to LiveKit. This prevents any call registration or logging in Retell, regardless of the FROM number [(1) ]() . How Retell's call routing works: When properly configured with Elastic SIP Trunking, inbound calls should flow: Twilio →
sip:sip.retellai.com
→ Retell's routing logic → LiveKit [(1) ]() [(3) ]() . Retell uses the destination number to determine which imported number and bound agent should handle the call [(1) ]() [(2) ]() . To configure Retell to log all calls: 1. Update your Twilio Elastic SIP Trunk origination settings to point to Retell's SIP server instead of LiveKit directly [(3) ]() : - Set origination SIP URI to:
sip:sip.retellai.com
[(1) ]() [(3) ]() - For better reliability, specify transport:
sip:sip.retellai.com;transport=tcp
[(1) ]() 2. **Ensure your destin
ation number is imported in Retell** - The number being called (not the FROM number) must be imported via the Import Phone Number API and bound to your agent [(1) ]() [(2) ]() . 3. Whitelist Retell's IP blocks in Twilio (if needed) [(1) ]() : - All regions:
18.98.16.120/30
- Certain US traffic:
143.223.88.0/21
,
161.115.160.0/19
Once calls route through Retell's SIP server, all calls to your imported number will be logged regardless of the FROM number, because Retell identifies calls by the destination number you've imported and bound to an agent [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] I need to receive calls using 3cx as telephony system](https://community.retellai.com/t/i-need-to-receive-calls-using-3cx-as-telephony-system/435) [[3] Twilio](https://docs.retellai.com/deploy/twilio) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.