i have a self host livekit server with sip server,...
# ask-ai
t
i have a self host livekit server with sip server, here are the livekit docker-compose
Copy code
This docker-compose requires host networking, which is only available on Linux
# This compose will not function correctly on Mac or Windows
services:
  caddy:
    image: livekit/caddyl4
    command: run --config /etc/caddy.yaml --adapter yaml
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./caddy.yaml:/etc/caddy.yaml
      - ./caddy_data:/data
  livekit:
    image: livekit/livekit-server:latest
    command: --config /etc/livekit.yaml
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./livekit.yaml:/etc/livekit.yaml
  redis:
    image: redis:7-alpine
    command: redis-server /etc/redis.conf
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./redis.conf:/etc/redis.conf
and yaml files
Copy code
port: 7880
bind_addresses:
    - ""
rtc:
    tcp_port: 7881
    port_range_start: 50000
    port_range_end: 60000
    use_external_ip: true
    enable_loopback_candidate: false
redis:
    address: localhost:6379
    username: ""
    password: ""
    db: 0
    use_tls: false
    sentinel_master_name: ""
    sentinel_username: ""
    sentinel_password: ""
    sentinel_addresses: []
    cluster_addresses: []
    max_redirects: null
turn:
    enabled: true
    domain: livekit-turn.sheraa.online
    tls_port: 5349
    udp_port: 3478
    external_tls: true
keys:
    APIFBsJmw5f6yFa: UC0tep5oNqsk6wJO1J7pQkfj9m8WBMKVWwkDM0a5B3e
and sip server docker compose file
Copy code
services:
  redis:
    image: redis
    network_mode: host
    command: ["redis-server", "--port", "6369"]
    volumes:
      - redis_data:/data

  sip:
    image: livekit/sip
    network_mode: host
    environment:
      SIP_CONFIG_BODY: |
        api_key: 'APIFBsJmw5f6yFa'
        api_secret: 'UC0tep5oNqsk6wJO1J7pQkfj9m8WBMKVWwkDM0a5B3e'
        ws_url: 'ws://127.0.0.1:7880'
        redis:
          address: '127.0.0.1:6369'
        sip_port: 5060
        rtp_port: 10000-20000
        use_external_ip: true
        logging:
          level: debug

volumes:
  redis_data:
and can reach the livekit normally and speak to the agent throw the console but i can not reach the agent with the phone call here are the inbound_trunk and dispatch_rule
Copy code
trunks: items {
  sip_trunk_id: "ST_LyxkzVx3GVxn"
  name: "My trunk"
  numbers: "+14234819314"
  krisp_enabled: true
}

trunks: items {
  sip_dispatch_rule_id: "SDR_VYgHKXdnnmfx"
  rule {
    dispatch_rule_individual {
      room_prefix: "call-"
    }
  }
  trunk_ids: "ST_LyxkzVx3GVxn"
  name: "My dispatch rule"
  room_config {
    agents {
      agent_name: "inbound-agent"
      metadata: "{\"agent_type\": \"voice-assistant\"}"
    }
  }
}
and i got the following error in the sip server
Copy code
2025-11-08T13:47:52.387Z	DEBUG	New connection	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transport<TCP>", "raddr": "54.172.60.0:41982"}
2025-11-08T13:47:52.388Z	DEBUG	Getting connection	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transport<TCP>", "addr": "54.172.60.0:41982"}
2025-11-08T13:47:52.388Z	INFO	sip	sip/inbound.go:178	processing invite	{"nodeID": "NE_wpgwS4EgZ2Ma", "callID": "SCL_zJ7podxeExai", "fromIP": "54.172.60.0", "toIP": "100.24.25.62:5060", "fromHost": "pstn.twilio.com", "fromUser": "hello", "toHost": "100.24.25.62", "toUser": "+14234819314", "sipTag": "12882665_c3356d0b_8659d4b9-7d0f-49ff-aae3-60fb1aeb0801", "sipCallID": "f6929c2d4b01bb229686692e9cd9b257@0.0.0.0", "twilioAccSID": "AC1ce490ae634ba83cf208fceea09a86d6", "twilioCallSID": "CA45253dec9a11da96ceaca315d5b3bdfb"}
2025-11-08T13:47:53.389Z	WARN	sip	sip/inbound.go:223	Rejecting inbound, auth check failed	{"nodeID": "NE_wpgwS4EgZ2Ma", "callID": "SCL_zJ7podxeExai", "fromIP": "54.172.60.0", "toIP": "100.24.25.62:5060", "fromHost": "pstn.twilio.com", "fromUser": "hello", "toHost": "100.24.25.62", "toUser": "+14234819314", "sipTag": "12882665_c3356d0b_8659d4b9-7d0f-49ff-aae3-60fb1aeb0801", "sipCallID": "f6929c2d4b01bb229686692e9cd9b257@0.0.0.0", "twilioAccSID": "AC1ce490ae634ba83cf208fceea09a86d6", "twilioCallSID": "CA45253dec9a11da96ceaca315d5b3bdfb", "error": "no response from servers"}
2025-11-08T13:47:53.389Z	DEBUG	Server transaction terminating	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer"}
2025-11-08T13:47:53.389Z	DEBUG	Server transaction destroyed	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer", "tx": "z9hG4bKbc44.a1b5f3e2fd3fa3b9a34c849a80e65df7.0__54.172.60.0__5060__INVITE"}
2025-11-08T13:47:53.389Z	DEBUG	Server transaction terminating	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer"}
2025-11-08T13:47:53.389Z	DEBUG	Server transaction destroyed	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer", "tx": "z9hG4bKbc44.a1b5f3e2fd3fa3b9a34c849a80e65df7.0__54.172.60.0__5060__INVITE"}
2025-11-08T13:47:53.391Z	DEBUG	Getting connection	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transport<TCP>", "addr": "54.172.60.0:41982"}
2025-11-08T13:47:53.391Z	DEBUG	Server transaction terminating	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer"}
2025-11-08T13:47:53.391Z	DEBUG	Server transaction destroyed	{"nodeID": "NE_wpgwS4EgZ2Ma", "caller": "transaction.Layer", "tx": "z9hG4bKbc44.a1b5f3e2fd3fa3b9a34c849a80e65df7.0__54.172.60.0__5060__INVITE"}
t
Thanks for reaching out, Youssef. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like you're encountering the "auth check failed" error, which usually points to a hiccup in the authentication process for inbound SIP calls. Don’t worry — let’s walk through some steps together to get this sorted out: 1. Verify Credentials: First, please double-check that the
auth_username
and
auth_password
in your trunk configuration exactly match the credentials your SIP provider sends in the
Proxy-Authorization
header. 2. Authentication Flow: It’s important to confirm that your SIP provider supports digest authentication and is properly responding to the
407 Unauthorized
challenge with the necessary
Proxy-Authorization
header. 3. Check Username: Make sure the username in the
Proxy-Authorization
header aligns perfectly with the expected
auth_username
. 4. Provider Support: Some providers, like Twilio Elastic SIP Trunking, might not support username/password authentication. It’s a good idea to verify this directly with your provider. 5. Trunk Configuration: Take a moment to review the syntax and fields in your trunk setup, especially the
auth_username
and
auth_password
, to ensure everything is correctly entered. 6. IP and Number Restrictions: Check that the incoming calls are coming from allowed numbers and IP ranges as specified in your configuration. 7. Review Logs: Lastly, have a look at your SIP server logs for messages like "No Proxy header found" or "Authentication failed - response mismatch" — these can give valuable clues about what’s going on. Following these steps should help you pinpoint and resolve the issue. If anything feels unclear or you’d like a hand with any part of this, please don’t hesitate to reach out. I’m here to help! Sources: SIP inbound trunk | LiveKit docs | lib/livekit/sip_service_client.rb | protobufs/livekit_sip.proto | test/lktest/sip.go