Skip to content

SIP duplicate INVITE / 482 Request merged when ws_url changed from localhost to domain (separating SIP from LiveKit server) #606

@ashusatp

Description

@ashusatp

Hi team,

I am trying to separate my SIP service from the LiveKit server, but I am encountering a duplicate SIP request issue when the SIP server connects to LiveKit using a domain instead of localhost.

Previously, everything worked correctly when all services were running on the same instance.

Previous Setup (Working)

All services were running on the same server:

  • LiveKit
  • Redis
  • SIP

The SIP service was connecting to LiveKit locally:

ws_url: ws://localhost:7880

In this configuration, outbound calls worked perfectly and no SIP errors occurred.

New Setup (Distributed Deployment)

I am now trying to separate the services across multiple servers.

Architecture:

Server 1
  LiveKit Server

Server 2
  SIP Server

Server 3
  Redis

Since SIP is now running on a different machine, I updated the configuration to use the LiveKit domain:

ws_url: wss://livekit.my-domain.com

However, after making this change, outbound calls started failing.

Error

When creating a SIP participant, I receive the following error:

Error creating SIP participant: TwirpError(code=internal, message=twirp error unknown: unexpected status from INVITE response: sip status: 482: Request merged, status=500, metadata={'error_details': 'CA0SR3VuZXhwZWN0ZWQgc3RhdHVzIGZyb20gSU5WSVRFIHJlc3BvbnNlOiBzaXAgc3RhdHVzOiA0ODI6IFJlcXVlc3QgbWVyZ2VkGjwKJXR5cGUuZ29vZ2xlYXBpcy5jb20vbGl2ZWtpdC5TSVBTdGF0dXMSEwjiAxIOUmVxdWVzdCBtZXJnZWQ=', 'sip_status': 'Request merged', 'sip_status_code': '482'})

Full log excerpt:

Error creating SIP participant: TwirpError(code=internal, message=twirp error unknown: unexpected status from INVITE response: sip status: 482: Request merged, status=500) | [room=outbound-agent-GYXPwtHb7lQxjXPRmXUqbJYsHA-125d7e2bf589407387a85b232633a10f_+9172890080554]

Observed Behavior

From the SIP logs it appears that multiple INVITE requests are being triggered for the same call, which causes the SIP provider to return:

482 Request merged

This only happens when the SIP server connects to LiveKit via the domain (wss://...). When using localhost and all the services on one instance, everything works correctly.

What I Am Trying To Achieve

I want to run the components separately for scalability:

  • LiveKit Server
  • SIP Service
  • Redis

All on different machines.

However, after separating them, I am unable to make outbound SIP calls successfully.

Questions

Is this architecture supported?


LiveKit Server  → Server A
SIP Service     → Server B
Redis           → Server C

Are there any additional configurations required when SIP connects to LiveKit using a domain instead of localhost?

Could this issue be related to WebSocket signaling timing or SIP participant creation retries?

Environment

LiveKit version: latest
SIP image: livekit/sip:latest
Deployment: Docker

If there are any recommended configurations for running SIP and LiveKit on separate machines, I would really appreciate the guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions