Hey all! I’m running into an issue with the LiveKi...
# self-hosting
a
Hey all! I’m running into an issue with the LiveKit SIP setup using Docker images for the server. Inbound calls are not connecting, and the SIP service is returning a
486 flood
error. Additionally, I’m not seeing any logs on the FastAPI server for the webhook endpoint which is hosted on the same EC2 and port 9010. Here are the details: Error from SIP container logs:
Copy code
sip-1      | 2025-09-18T09:53:13.400Z   INFO    sip     sip/client.go:77        client starting {"nodeID": "NE_9VbcLbvnHeWL", "local": "172.31.40.210", "external": "<PII-livekit-server-address-hidden>"}
sip-1      | 2025-09-18T09:53:13.400Z   INFO    sip     sip/server.go:239       server starting {"nodeID": "NE_9VbcLbvnHeWL", "local": "172.31.40.210", "external": "<PII-livekit-server-address-hidden>"}
sip-1      | 2025-09-18T09:53:13.401Z   INFO    sip     sip/server.go:174       sip signaling listening on      {"nodeID": "NE_9VbcLbvnHeWL", "local": "172.31.40.210", "external": "<PII-livekit-server-address-hidden>", "port": 5060, "announce-port": 5060, "proto": "udp"}
sip-1      | 2025-09-18T09:53:13.405Z   INFO    sip     sip/server.go:197       sip signaling listening on      {"nodeID": "NE_9VbcLbvnHeWL", "local": "172.31.40.210", "external": "<PII-livekit-server-address-hidden>", "port": 5060, "announce-port": 5060, "proto": "tcp"}
sip-1      | 2025-09-18T09:53:53.520Z   INFO    sip     sip/inbound.go:178      processing invite       {"nodeID": "NE_9VbcLbvnHeWL", "callID": "SCL_VEKeWtzCJhGx", "fromIP": "<My-IP>", "toIP": "<PII-livekit-server-address-hidden>:5060", "fromHost": "<my-IP>", "fromUser": "91******6266", "toHost": "<PII-livekit-server-address-hidden>", "toUser": "+91*******02", "sipTag": "f149502c", "sipCallID": "GwYVsdt5Y6_sTUjnXU-xFg.."}
livekit-1  | 2025-09-18T09:53:53.529Z   DEBUG   livekit service/ioservice_sip.go:151    SIP trunk matched for auth       {"toUser": "+91*******02", "fromUser": "91******6266", "src": "<My-IP>", "sipTrunk": "ST_GoWxzhUkhrMq"}
livekit-1  | 2025-09-18T09:53:53.541Z   DEBUG   livekit service/ioservice_sip.go:107    SIP trunk matched       {"toUser": "+91*******02", "fromUser": "91******6266", "src": "<My-IP>", "sipTrunk": "ST_GoWxzhUkhrMq"}
sip-1      | 2025-09-18T09:53:53.559Z   INFO    sip     sip/inbound.go:782      Closing inbound call    {"nodeID": "NE_9VbcLbvnHeWL", "callID": "SCL_VEKeWtzCJhGx", "fromIP": "113.193.112.20", "toIP": "<PII-livekit-server-address-hidden>:5060", "fromHost": "<my-IP>", "fromUser": "91******6266", "toHost": "<PII-livekit-server-address-hidden>", "toUser": "+91*******02", "sipTag": "f149502c", "sipCallID": "GwYVsdt5Y6_sTUjnXU-xFg..", "sipTrunk": "ST_GoWxzhUkhrMq", "jitterBuf": false, "sipTrunk": "ST_GoWxzhUkhrMq", "status": 486, "reason": "flood"}
sip-1      | 2025-09-18T09:53:53.559Z   INFO    sip     sip/inbound.go:777      call statistics {"nodeID": "NE_9VbcLbvnHeWL", "callID": "SCL_VEKeWtzCJhGx", "fromIP": "<My-IP>", "toIP": "<PII-livekit-server-address-hidden>:5060", "fromHost": "<my-IP>", "fromUser": "91******6266", "toHost": "<PII-livekit-server-address-hidden>", "toUser": "+91*******02", "sipTag": "f149502c", "sipCallID": "GwYVsdt5Y6_sTUjnXU-xFg..", "sipTrunk": "ST_GoWxzhUkhrMq", "jitterBuf": false, "sipTrunk": "ST_GoWxzhUkhrMq", "status": 486, "reason": "flood", "stats": {"port":{"streams":0,"packets":0,"packets_ignored":0,"packets_input":0,"mux_packets":0,"mux_bytes":0,"audio_packets":0,"audio_bytes":0,"dtmf_packets":0,"dtmf_bytes":0},"room":{"input_packets":0,"input_bytes":0,"mixer_samples":0,"mixer_frames":0,"output_samples":960,"output_frames":1},"mixer":{"tracks":0,"tracks_total":0,"restarts":0,"mixes":1,"mixes_timed":1,"mixes_jump":0,"mixes_zero":0,"input_samples":0,"input_frames":0,"mixed_samples":0,"mixed_frames":0,"output_samples":960,"output_frames":1}}}
Inbound SIP Trunk:
Copy code
{
    "items": [
        {
            "sip_trunk_id": "ST_GoWxzhUkhrMq",
            "name": "Livekit SIP Inbound Test",
            "metadata": "",
            "numbers": [
                "+91*******02"
            ],
            "allowed_addresses": [
                "0.0.0.0/0"
            ],
            "auth_username": "",
            "auth_password": "",
            "headers": {},
            "include_headers": "SIP_NO_HEADERS",
 
        }
    ]
}
Dispatch Rule:
Copy code
{
  "items": [
    {
      "sip_dispatch_rule_id": "SDR_4HysS8DUN6Ui",
      "rule": {
        "dispatch_rule_individual": {
          "room_prefix": "sip-call-",
          "pin": ""
        }
      },
      "trunk_ids": [
        "ST_GoWxzhUkhrMq"
      ],
      "hide_phone_number": false,
      "inbound_numbers": [
        "+91******002"
      ],
      "name": "Inbound Agent Handler",
      "attributes": {},
      "room_preset": "",
      "room_config": null,
      "media_encryption": "SIP_MEDIA_ENCRYPT_DISABLE"
    }
  ]
}
Docker-compose.yaml
Copy code
version: "3.9"

services:

  livekit:
    image: livekit/livekit-server:latest
    network_mode: host           # Use host network for direct RTP/SIP access
    environment:
      LIVEKIT_KEYS: |
        devkey: secret
      LIVEKIT_CONFIG: |
        port: 7880
        logging: { level: debug }
        webhook:
          api_key: devkey
          urls:
            - http://127.0.0.1:9010/webhooks/livekit
        rtc:
          tcp_port: 7881
          udp_port: 7882
          use_external_ip: true
        redis:
          address: amazon-redis-cache:6379
          tls:
            enabled: true
    command: ["--dev", "--bind", "0.0.0.0"]
    restart: unless-stopped

  sip:
    image: livekit/sip:latest
    network_mode: host           # RTP/SIP best on host net
    environment:
      SIP_CONFIG_BODY: |
        log_level: debug
        api_key: devkey
        api_secret: secret
        ws_url: ws://*.*.***.**:7880
        redis:
          address: amazon-redis-cache:6379
          tls:
            enabled: true
        sip_port: 5060
        rtp_port: 10000-20000
        use_external_ip: true
        flood_protection:
          enabled: false
          invites_per_second: 1000
          burst: 1000

        rate_limits:
          invites_per_minute: 1000
          invites_burst: 1000
    restart: no
The webhook is running on the same EC2 on port 9010
Copy code
@app.post("/webhooks/livekit")
async def livekit_webhook(request: Request):
    payload = await request.json()
    event = payload.get("event")
    room = payload.get("room", {}).get("name") or payload.get("room_name")
    
    logger.info(f"[WEBHOOK] Received event={event}, room={room}")
    
    # Differentiate between inbound and outbound calls
    if room:
        if room.startswith("call-") and len(room.split("-")) == 2:
            # Outbound call format: "call-{uuid}"
            await handle_outbound_webhook(event, room, payload)
        elif room.startswith("sip-call-"):
            # Inbound call format using dispatch_rule_individual with prefix "sip-call-"
            await handle_inbound_webhook(event, room, payload)
        else:
            logger.warning(f"[WEBHOOK] Unknown room format: {room}")
    
    return {"ok": True}
async def handle_inbound_webhook(event: str, room: str, payload: dict):
    logger.info(f"[INBOUND WEBHOOK] Processing event={event} for room={room}")
    
    if event == "room_started":
        logger.info(f"[INBOUND] Dispatching inbound agent to room {room}")
        lkapi = lk_client()
        try:
            await lkapi.agent_dispatch.create_dispatch(
                api.CreateAgentDispatchRequest(
                    agent_name=INBOUND_AGENT_NAME,
                    room=room,
                    metadata=json.dumps({
                        "call_type": "inbound",
                        "room": room,
                        "timestamp": time.time()
                    }),
                )
            )
            logger.info(f"[INBOUND] Agent dispatched to room {room}")
        except Exception as e:
            logger.error(f"[INBOUND] Agent dispatch failed: {e}")
        finally:
            await lkapi.aclose()
    
    elif event == "participant_joined":
        participant = payload.get("participant", {})
        if participant.get("kind") == "sip":
            logger.info(f"[INBOUND] SIP participant joined room {room}")
    
    elif event == "room_finished":
        logger.info(f"[INBOUND] Call ended in room {room}")
i
Did you got any solution for this? i'm facing same flood error.