Hey, I am facing some issues when integrating with...
# ask-ai
m
Hey, I am facing some issues when integrating with Exotel for inbound calling on the exotel dashboard i got this:
Copy code
Here is what happened:Missed Call from 09503813535 at Fri, 28 Nov 2025 16:05:07. One or all of the agents failed to attend or were busy The number 02247790694 received a call from 09503813535 at Fri, 28 Nov 2025 16:05:07 The call was routed to sip:4j7vfy40b9i.sip.livekit.cloud, whose number we could not reach
t
Thanks for reaching out, Soumyadeep. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m looking into the Exotel inbound call failure message you shared about the SIP endpoint being unreachable. A few quick checks and actions that often resolve this: • Confirm the SIP URI you entered in Exotel matches your LiveKit SIP subdomain exactly (no
sip:
prefix). In your error it shows
4j7vfy40b9i.sip.livekit.cloud
— please verify that matches your Project’s SIP endpoint. • If Exotel needs a transport parameter, try adding
;transport=tcp
or
;transport=tls
to the SIP URI in Exotel’s trunk settings. • Check any username/password or auth settings that Exotel may send — ensure they match what LiveKit expects for your inbound trunk. • Verify your LiveKit inbound trunk and dispatch rule: is the trunk active and does the dispatch rule route calls to an active agent or SIP registration? • Confirm the LiveKit agent/worker that should receive the call was running/registered at the time of the call. • If you use region pinning, ensure the call is coming from an allowed region for your project. To help me pinpoint the problem, please share: 1. The exact SIP URI string you configured in Exotel (you can redact secrets). 2. Whether you added a transport param (tcp/tls) in Exotel. 3. Whether you use LiveKit Phone Numbers or a third‑party trunk, and a brief description of your dispatch rule (where calls should route). 4. Whether the receiving agent was online/registered when the call arrived. Send those details and I’ll suggest the next specific steps. Sources: SIP trunk setup | LiveKit docs | SIP inbound trunk | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docs | Secure trunking | LiveKit docs | SIP cloud and region pinning | LiveKit docs
m
1. sip4j7vfy40b9i.sip.livekit.cloud5060;transport=tcp 2. tcp 3. We used Exophones by Exotel. This is the LiveKit dispatch rule :
Copy code
{
  "sipDispatchRuleId": "SDR_quQ8py5Ux9yZ",
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "call-48e23290-"
    }
  },
  "trunkIds": [
    "ST_AKbeCAFkj2NH"
  ],
  "name": "dispatch-48e23290",
  "metadata": "{\"agentConfigId\":\"48e23290-9ef4-483f-ad32-103ddd8400a1\",\"phoneNumber\":\"+9102247790694\"}",
  "roomConfig": {
    "agents": [
      {
        "agentName": "studio-voice-agent"
      }
    ]
  }
}
4. Yes the agent was active. Here are the agent details:
Copy code
A_ud42TpAZ4DzU
studio-voice-agent
t
Thanks — I’ve reviewed your SIP URI, transport, dispatch rule, and agent info. I’ll focus on what can cause the “number we could not reach” when Exotel routes to
sip:4j7vfy40b9i.sip.livekit.cloud:5060;transport=tcp
. Immediate checks and next steps you can run now 1. Confirm Exotel should send the SIP URI without the
sip:
prefix; in their UI use
4j7vfy40b9i.sip.livekit.cloud:5060;transport=tcp
. 2. Verify Exotel is sending the INVITE to port 5060 over TCP (not UDP). Ask Exotel or check their trunk settings/logs to confirm transport actually used. 3. Check LiveKit inbound-trunk credentials/auth: ◦ If your trunk requires digest auth or a username/password, confirm Exotel is configured to provide those credentials. 1. Inspect SIP signaling/headers in Exotel logs and LiveKit call logs at the timestamp (Fri, 28 Nov 2025 160507) to see the exact SIP response code or connection failure reason. 2. Confirm firewall/NAT rules allow TCP traffic to port 5060 on
4j7vfy40b9i.sip.livekit.cloud
from Exotel’s outbound IP ranges. If Exotel uses dynamic IPs, you may need to allow their full range or request their egress IPs. 3. Region/edge mismatch: ensure Exotel’s egress region can reach the LiveKit SIP edge for your project. If you have region pinning, confirm calls route to the pinned region. If the above checks don’t reveal the issue, please provide two items so I can narrow this down: • The SIP response or error from Exotel logs for that call (SIP status code like 4xx/5xx or a transport error message). • A short excerpt of the Exotel INVITE (headers) or LiveKit log for that call timestamp (redact any secrets). I can then map the SIP response to the most likely failure (auth, transport, firewall, or routing) and give exact fixes. Would you like me to prioritize checking transport/auth or the firewall/region aspects first?
m
1. and 2. are verified 3. No the trunk does not require auth I am using a self hosted agent locally is that an issue?
t
Thanks — you’ve verified transport and auth, and confirmed the agent is self‑hosted locally. That could indeed be the cause. Key points and next steps: Why a local/self‑hosted agent can cause "number we could not reach" • LiveKit (the SIP edge) must be able to reach your agent’s SIP endpoint/registration. If your agent is running on a machine behind NAT/firewall without a public address or proper port forwarding, incoming INVITEs from Exotel → LiveKit won’t reach it. • If the agent registers to LiveKit but its advertised contact (claimed IP/port) is private, the SIP INVITE from the PSTN path may not be routed back correctly. • Firewalls, NAT, or blocked TCP 5060 can drop the TCP INVITE before your agent ever sees it. What to check and do now 1. Confirm the agent is registered and shows as available in your LiveKit call logs at the call timestamp. 2. Ensure the agent is publicly reachable (or reachable by the LiveKit SIP edge): ◦ If hosting locally, set up port forwarding for SIP signaling (TCP 5060 or your chosen port) and relevant media ports, or use a VPN/SSH tunnel to a publicly reachable host. ◦ Alternatively, host the agent on a public server or a cloud VM with a static public IP. 1. Verify the agent’s SIP contact uses the public IP/hostname (or uses STUN/ICE for media) so responses and RTP flow correctly. 2. Confirm no firewall blocks TCP 5060 inbound from LiveKit/Exotel egress IPs and that any NAT maps preserve source/destination ports. 3. If possible, get the LiveKit call log or SIP trace showing the INVITE and any transport error; that will confirm whether the INVITE reached LiveKit, was forwarded, or failed to route to the agent. If you want, tell me: • How your agent registers to LiveKit (public hostname/IP shown in registration or private IP?), and • Whether you can open TCP 5060 on your router/host or prefer to move the agent to a public VM. I’ll recommend the simplest actionable option based on your setup.
m
can i make another agent in livekit cloud and test?
t
Yes — creating a cloud-hosted agent is a good test and will quickly tell you if the problem is your local agent/NAT or something upstream. What to do (minimal steps) 1. Create a new agent in LiveKit Cloud (use the same agent name used in your dispatch rule or add the new agent to the rule). 2. Ensure the cloud agent is started/registered and shows as available in LiveKit at the time of the test. 3. Keep your dispatch rule pointing to the roomPrefix you already use (no change needed if the new agent name matches or is added to
roomConfig.agents
). 4. Trigger an inbound call from Exotel and watch LiveKit call logs / agent status for the incoming INVITE and allocation to the new agent. 5. If the call connects to the cloud agent, the issue is your local agent (NAT/firewall/port forwarding). If it still fails with the same “could not reach” message, share the SIP response or LiveKit call log for that attempt. If you’d like, tell me the new agent name you’ll use and I’ll confirm whether your current dispatch rule needs any change.
m
i created the agent on cloud but it does not seem to connect
t
Thanks — I’ll help narrow why the cloud agent isn’t connecting. A few quick checks and the specific info I need: Checks to run now • Verify the cloud agent process is running and successfully registers with LiveKit (look for a registration/connected status in your agent logs or LiveKit dashboard). • Confirm the agent uses a valid LiveKit access token and the correct Project/SIP subdomain. • Make sure the new agent is included in the dispatch rule’s
roomConfig.agents
(either replace the old agent name or add the new one). • Check LiveKit call/agent logs at the time you started the cloud agent for any errors (auth, connection refused, or TLS/transport failures). Please paste these details (redact secrets): 1. The cloud agent name you created and the exact entry in
roomConfig.agents
(if changed). 2. A brief excerpt of the agent startup logs showing connection/register attempts and any error lines. 3. The LiveKit call or agent log lines at the timestamp when you attempted the test (any SIP INVITE, registration, or error messages). With those I’ll map the failure (auth, token, transport, or dispatch rule mismatch) and give the exact next steps.
m
how do i check agent logs on livekit?
t
You can view agent logs two ways — CLI (quick, real‑time) or the LiveKit Cloud dashboard (Agent insights). Steps: Using the CLI 1. Run:
Copy code
lk agent logs
This tails runtime logs for the agent defined in your current directory’s
livekit.toml
. 1. To target a specific agent:
Copy code
lk agent logs --id CA_MyAgentId
1. To view build logs:
Copy code
lk agent logs --log-type=build
Using the LiveKit Cloud dashboard • Open your project → Agent insights / Sessions. Runtime logs appear there if Agent Observability is enabled and the agent was started with observability (e.g.,
record=True
). Notes • Cloud runtime logs are real‑time only unless you forward them to an external service (Datadog, CloudWatch, Sentry, etc.) via configured secrets. • If you paste the runtime log errors you see (redact secrets), I’ll help interpret them and next steps. Sources: Log collection | LiveKit Docs | Agent deployment CLI reference | LiveKit docs | Agent insights in LiveKit Cloud | LiveKit docs | Streamline Troubleshooting with Agent Observability
m
and is there any way to see sip logs on livekit
t
Yes — you can see SIP-related logs and call diagnostics in LiveKit. Here’s how to get the info that will help diagnose your cloud agent not connecting and the Exotel "could not reach" failure. 1) View LiveKit telephony/call logs (best first step) • Go to LiveKit Cloud → Telephony → Call Logs. • Look up the call at Fri, 28 Nov 2025 160507 and note any SIP status codes, error text, trunk ID, and dispatch rule used. 2) Check Agent runtime logs (shows SIP join events and agent registration) • CLI: run
Copy code
lk agent logs --id <YOUR_AGENT_ID>
or just
lk agent logs
if your current directory targets that agent. • Dashboard: open Agent insights / Sessions if Agent Observability is enabled. 3) Inspect SIP participant attributes in your agent (real‑time) • In your agent code or via SDK, log SIP attributes for incoming participants:
sip.callID
,
sip.phoneNumber
,
sip.callStatus
,
sip.trunkID
. 4) Useful artifacts to paste here (redact secrets) • The Call Log entry from Telephony for the timestamp (including any SIP status code/message). • Your cloud agent runtime log lines around the time you started it (registration/connect attempts and any errors). • Any SIP-related attributes or short SIP trace excerpt your agent captured. If you share those three items, I’ll map the error to the likely cause (transport/firewall, routing/dispatch, or agent registration mismatch) and provide exact fixes. Would you like steps to enable Agent Observability or to run the
lk agent logs
command now? Sources: SIP participant | LiveKit docs | Using Wavix to accept and make calls | LiveKit docs | Make outbound calls | LiveKit docs | SIP troubleshooting guide | LiveKit docs | Say hello to improved Cloud analytics
m
these are the pcap logs from exotel
t
Thanks — please share the relevant parts of the PCAP logs so I can pinpoint the failure. The most useful snippets are: • The SIP INVITE from Exotel (full request headers). • The SIP response(s) to that INVITE (status code and headers). • Any TCP connection errors or retransmissions around the INVITE time. • Timestamps matching Fri, 28 Nov 2025 160507. If you can’t share the full PCAP, export and paste the SIP text for those messages (redact any credentials). I’ll analyze them and tell you whether this is a transport/firewall, routing/dispatch, or agent registration issue and give exact next steps.