How do I integrate Inbound calling to my LiveKit V...
# ask-ai
m
How do I integrate Inbound calling to my LiveKit Voice Agent (to be able to receive incoming calls) using Exotel. I am facing some issues with the setup
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 responding to your request about integrating Exotel inbound calls to your LiveKit Voice Agent and the issues you’re seeing. I can help debug this, but I need a few specifics to narrow the cause: 1. What happens when you call the Exotel number? (no answer, busy, 404, forwarded to voicemail, agent not created, etc.) 2. Is the inbound trunk created in LiveKit? (
lk sip inbound list
) — if yes, share the trunk name/number. 3. How is Exotel configured for the SIP endpoint? Share the SIP URI you used (mask any credentials) and whether you used SIP username/password or IP allowlisting. 4. Any error logs from LiveKit Telephony dashboard or Exotel call logs (SIP responses like 401/403/408/503)? 5. Is Krisp/noise-cancellation enabled on the trunk or dispatch rule? 6. Are you using a dispatch rule that targets the correct
agent_name
? (share the dispatch JSON if possible) Share the answers or snippets and I’ll give targeted next steps for the exact failure mode (authentication, routing, SIP mismatch, or agent dispatch). Sources: Create and configure a Twilio SIP trunk | LiveKit docs | SIP overview | LiveKit docs | SIP inbound trunk | LiveKit docs | sip | livekit/livekit_composite | DeepWiki | SIP trunk setup | LiveKit docs
m
1. I get this on the Exotel Call Logs: Here is what happened: Missed Call from 09503813535 at Fri, 28 Nov 2025 124530. 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 124530 The call was routed to sip:agent_48e23290@4j7vfy40b9i.sip.livekit.cloud, whose number we could not reach 2. Yes an inbound trunk is configured here' s the details:
Copy code
{
  "sipTrunkId": "ST_WKXGcPy5pDhY",
  "name": "trunk-48e23290",
  "metadata": "{\"agentConfigId\":\"48e23290-9ef4-483f-ad32-103ddd8400a1\",\"phoneNumber\":\"+9102247790694\",\"createdAt\":\"2025-11-28T07:10:48.984Z\",\"provider\":\"exotel\"}",
  "numbers": [
    "+9102247790694"
  ],
  "authUsername": "agent_48e23290",
  "authPassword": "Rcol@CwH40@P@0jC"
}
3. Exotel has whitelisted our LiveKit SIP URI:
sip:4jxxxxxxxxx.sip.livekit.cloud
4. I got logs only on Exotel dashboard and none in LiveKit (I am using a self hosted agent) I called the number and there was only an initial greeting (from Exotel which is default) and after that the call ended automatically 5. Here's my dispatch rule:
Copy code
{
  "sipDispatchRuleId": "SDR_57P2qt685YBK",
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "call-48e23290-"
    }
  },
  "trunkIds": [
    "ST_WKXGcPy5pDhY"
  ],
  "name": "dispatch-48e23290",
  "metadata": "{\"agentConfigId\":\"48e23290-9ef4-483f-ad32-103ddd8400a1\",\"phoneNumber\":\"+9102247790694\"}",
  "roomConfig": {
    "agents": [
      {}
    ]
  }
}
Oh yes theres no agent configured Also do I need to deploy my self hosted agent (i feel i did that but not sure) Please guide me further what to do
t
Thanks — I reviewed your details (Exotel log, trunk, dispatch rule). You’re close; two things must be fixed before inbound calls will reach your agent. 1) Fix the dispatch rule • Your
roomConfig.agents
is empty. Update it to include the exact
agentName
your agent uses. Example:
Copy code
"roomConfig": {
  "agents": [
    { "agentName": "my-telephony-agent" }
  ]
}
• Apply the updated dispatch rule:
lk sip dispatch update --id SDR_57P2qt685YBK dispatch-rule.json
2) Ensure your self-hosted agent is running and registered with that same agent name • Start your agent with
agent_name
equal to the name in the dispatch rule. Confirm your agent logs show a successful connection to LiveKit and that it reports the agent name. • If you don’t see any LiveKit logs when calling, the INVITE is not reaching LiveKit—keep the agent running and tail LiveKit server logs while testing. Authentication and SIP routing checks • Exotel must send SIP Digest auth using: ◦ Username: agent_48e23290 ◦ Password: Rcol@CwH40@P@0jC • Confirm Exotel’s trunk SIP URI exactly matches the LiveKit host (domain):
4j7vfy40b9i.sip.livekit.cloud
• If Exotel logs say “whose number we could not reach,” it commonly means authentication failed or the INVITE never reached your LiveKit SIP listener (or LiveKit rejected it). Verify Exotel is configured to use digest auth rather than only forwarding the URI. Quick test sequence to run now 1. Update dispatch rule with
agentName
and apply it. 2. Start your agent and confirm it logs a LiveKit connection and agent registration. 3. Make a test call to +9102247790694 while tailing LiveKit server logs and agent logs. 4. Share any LiveKit log lines around the call (SIP INVITE, auth success/failure, dispatch actions). If you share the updated dispatch JSON and a short copy of the LiveKit/agent logs captured during a test call, I’ll pinpoint the next fix. Sources: Deploying to custom environments | LiveKit Docs | SIP inbound trunk | LiveKit docs | SIP trunk setup | LiveKit docs | Agent dispatch | LiveKit docs | Agents telephony integration | LiveKit docs
m
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"
      }
    ]
  }
}
Also how to do these: 2) Ensure your self-hosted agent is running and registered with that same agent name • Start your agent with
agent_name
equal to the name in the dispatch rule. Confirm your agent logs show a successful connection to LiveKit and that it reports the agent name. • If you don’t see any LiveKit logs when calling, the INVITE is not reaching LiveKit—keep the agent running and tail LiveKit server logs while testing. Authentication and SIP routing checks • Exotel must send SIP Digest auth using: ◦ Username: agent_48e23290 ◦ Password: Rcol@CwH40@P@0jC • Confirm Exotel’s trunk SIP URI exactly matches the LiveKit host (domain):
4j7vfy40b9i.sip.livekit.cloud
• If Exotel logs say “whose number we could not reach,” it commonly means authentication failed or the INVITE never reached your LiveKit SIP listener (or LiveKit rejected it). Verify Exotel is configured to use digest auth rather than only forwarding the URI.
t
Great — your dispatch rule now correctly specifies
agentName: "studio-voice-agent"
. Next steps: start and verify your self-hosted agent, confirm Exotel is sending authenticated SIP INVITEs, and capture logs while testing. Follow these concise steps. 1) Start your self-hosted agent with the matching agent name • Ensure your agent process is launched with
agent_name = "studio-voice-agent"
. Example patterns: ◦ Python worker option: set
agent_name="studio-voice-agent"
when creating Worker/WorkerOptions. ◦ Node/TS: set
agentName: "studio-voice-agent"
in your worker options. • Run the agent (example):
python agent.py
or your usual start command. 2) What to look for in agent logs (confirm success) • "Registered" or "connected" to LiveKit • The agent reports its name:
studio-voice-agent
• "Listening for incoming jobs" or similar If you don’t see these lines, the agent either failed to connect (check LIVEKIT_URL, API keys/secrets) or crashed on startup. 3) Verify LiveKit receives the SIP INVITE • Tail your LiveKit SIP/gateway logs while making a test call. • Expected log lines when Exotel calls: ◦
SIP INVITE received
(with username or From header) ◦
Authentication success
or
Authentication failed
◦
Dispatching job to agent 'studio-voice-agent'
◦
Room created: call-48e23290-...
If none of these appear, the INVITE never reached LiveKit. 4) Confirm Exotel SIP auth and routing • In Exotel trunk settings enable SIP Digest auth using: ◦ Username: agent_48e23290 ◦ Password: Rcol@CwH40@P@0jC • Set the destination/SIP URI to the LiveKit host:
agent_48e23290@4j7vfy40b9i.sip.livekit.cloud
(or
+9102247790694@4j7vfy40b9i.sip.livekit.cloud
if Exotel requires DID in URI). • Use TLS (port 5061) or TCP if Exotel supports it. • If Exotel shows “whose number we could not reach,” that usually means auth failed or the INVITE couldn’t reach your SIP listener — confirm Exotel actually sends credentials and the domain/port are reachable. 5) Quick test sequence (do these in order) 1. Start agent and confirm agent logs show connected + correct agent name. 2. Tail LiveKit SIP logs. 3. Call the Exotel number and watch logs for INVITE/auth/dispatch lines. 4. If dispatch appears but agent doesn’t accept, check agent-side handling for job acceptance. 6) If you see specific log lines, share them • Share the LiveKit SIP logs around the call (INVITE, auth result, dispatch) and any agent logs at the same timestamps. Mask any secrets. • If LiveKit shows authentication failed, confirm Exotel’s digest auth settings and credentials. If there are no LiveKit logs, share Exotel SIP response codes (e.g., 401/403/408/503) shown in their call log. If you want, run one test now and paste: • The LiveKit SIP/gateway log lines during the call • Your agent startup logs • The Exotel call log entry (SIP response code) I’ll interpret the logs and tell you the exact field to fix. Sources: SIP dispatch rule | LiveKit docs | Using Wavix to accept and make calls | LiveKit docs | SIP trunk setup | LiveKit docs | Secure trunking | LiveKit docs | Agent dispatch | LiveKit docs
m
Copy code
Here is what happened:Missed Call from 09503813535 at Fri, 28 Nov 2025 15:37:17. 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 15:37:17 The call was routed to sip:agent_48e23290@4j7vfy40b9i.sip.livekit.cloud, whose number we could not reach
got this error on exotel dashboard also i couldn't find any auth settings on exotel like for username or password
t
Thanks — clear next actions based on Exotel not supporting SIP username/password. 1) Update your LiveKit inbound trunk to accept Exotel by allowing Exotel IPs (or all addresses for testing). Example:
Copy code
{
  "sipTrunkId": "ST_AKbeCAFkj2NH",
  "name": "trunk-48e23290",
  "numbers": [
    "+9102247790694"
  ],
  "allowed_addresses": [
    "0.0.0.0/0"
  ]
}
Use Exotel’s outbound SIP CIDRs instead of 0.0.0.0/0 if you want tighter security. 2) Configure Exotel destination • Set destination/SIP URI to either: ◦
agent_48e23290@4j7vfy40b9i.sip.livekit.cloud
◦ or
+9102247790694@4j7vfy40b9i.sip.livekit.cloud
(if Exotel requires DID in user part) • Use TLS/port 5061 or TCP if available. 3) Start your self‑hosted agent with the exact agent name in the dispatch rule • Ensure agent uses agent_name = "studio-voice-agent". • Start it and confirm logs show: ◦ Registered/connected to LiveKit ◦ "Listening for incoming jobs" or similar 4) Tail LiveKit SIP logs while making a test call • Look for:
SIP INVITE received
, auth result,
Dispatching job to agent 'studio-voice-agent'
, and room creation. • If you see no LiveKit logs, the INVITE never reached LiveKit (check Exotel SIP URI, domain, port, firewall). 5) If the call still fails, paste these (mask secrets): • Exotel call log entry including SIP response code (401/403/408/503 etc.) • LiveKit SIP/gateway log lines captured during the call • Agent startup logs around the same timestamp I’ll interpret the logs and tell you the exact field to fix. Sources: SIP inbound trunk | LiveKit docs | SIP APIs | LiveKit docs | SIP overview | LiveKit docs | SIP outbound trunk | LiveKit docs | Agents telephony integration | LiveKit docs
m
where can i check SIP INVITE and other logs on livekit?
t
If you’re on LiveKit Cloud (hosted) • Console → select project → Telephony → Call Logs — click a call to see event details (SIP request/response, dispatch status, room created). • Console → Telephony → Debug → SIP Logs (if available) to stream raw SIP messages (INVITE/200/BYE). If you use the LiveKit CLI • Verify trunks:
lk sip inbound list
• Stream call events:
lk sip call log watch --project <PROJECT_ID>
— events include
sipRequest
,
sipResponse
, and dispatch info. If you self‑host LiveKit • Tail the SIP gateway logs: ◦ Docker Compose:
docker logs -f livekit-sip
◦ Binary:
tail -f /var/log/livekit-sip.log
(or wherever you wrote logs) • Enable debug logging in LiveKit config (
log_level: debug
) to get full SIP traces. • Grep for keywords while testing:
grep -E "INVITE|Authentication|Dispatching|Room created" -n
What to capture and share (mask secrets) • The raw SIP INVITE and any SIP response codes around the call time • LiveKit SIP/gateway log lines showing auth result or dispatch actions • Agent logs at the same timestamp Paste those snippets and I’ll interpret them and tell you the exact field to fix.
m
soumyadeepdas@Soumyadeeps-MacBook-Pro livekit-agents % lk sip inbound list Using default project [provue2] ┌─────────────────┬────────────────┬────────────────┬──────────────────┬────────────────┬─────────────────────────────────────────────────────────┬────────────┬─────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ SipTrunkID │ Name │ Numbers │ AllowedAddresses │ AllowedNumbers │ Authentication │ Encryption │ Headers │ Metadata │ ├─────────────────┼────────────────┼────────────────┼──────────────────┼────────────────┼─────────────────────────────────────────────────────────┼────────────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ ST_AKbeCAFkj2NH │ trunk-48e23290 │ +9102247790694 │ 0.0.0.0/0 │ │ fe19e8499109d8a585fe27a9370654a76fe5481dfad2984d / ** │ DISABLE │ │ {"agentConfigId":"48e23290-9ef4-483f-ad32-103ddd8400a1","phoneNumber":"+9102247790694","createdAt":"2025-11-28T074154.828Z","provider":"exotel"} │ └─────────────────┴────────────────┴────────────────┴──────────────────┴────────────────┴─────────────────────────────────────────────────────────┴────────────┴─────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ soumyadeepdas@Soumyadeeps-MacBook-Pro livekit-agents % lk sip call log watch --project p_4j7vfy40b9i No help topic for 'call' soumyadeepdas@Soumyadeeps-MacBook-Pro livekit-agents %
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
m
also on exotel they have API Key as Username and API Token as Password does that make sense?
hii, on exotel they have API Key as Username and API Token as Password does that make sense?