LiveKit

Pre-Requisites

  • DNS record (in our example we will be using office-iridia.difusedns.com)
  • TLS Certificate for the DNS record

Setting Up LiveKit

Now in this demonstration we will be using the hosted livekit service, but the procedure is pretty much the same for self-hosted as well.

Creating an Inbound Trunk

This basically defines who is allowed to reach LiveKit, we'll not specify any numbers or IPs, but you can do so if they're not dynamic. So if you have a static IP say 1.1.1.1 then you can specify that in the Allowed Addresses section as 1.1.1.1/32

image.png

LiveKit - Create an Inbound Trunk

The JSON for the inbound trunk looks like this:

{
  "sipTrunkId": "ST_JGJGVRaNXNgG",
  "name": "Iridia",
  "allowedAddresses": [
    "0.0.0.0/0"
  ],
  "includeHeaders": "SIP_ALL_HEADERS",
  "mediaEncryption": "SIP_MEDIA_ENCRYPT_ALLOW",
  "createdAt": "2026-04-20T07:33:40.024789Z",
  "updatedAt": "2026-04-20T07:33:39.784102Z"
}

Creating an Outbound Trunk

Here you can see us specifying our Difuse PBX trunk address as well as the Numbers that trunk owns in this case it is +18645284888. And the SRTP configuration is same as the inbound trunk and it should be set to Enabled

image.png

LiveKit - Create an Outbound Trunk

The JSON for the outbound trunk looks like this:

{
  "sipTrunkId": "ST_EjSCJ2bTYT7x",
  "name": "Iridia",
  "address": "office-iridia.difusedns.com:6080",
  "transport": "SIP_TRANSPORT_TLS",
  "numbers": [
    "+18645284888"
  ],
  "mediaEncryption": "SIP_MEDIA_ENCRYPT_ALLOW",
  "createdAt": "2026-04-20T07:36:20.556969Z",
  "updatedAt": "2026-04-20T07:54:22.086445Z"
}

Setting up an Agent/Dispatcher

In this example we're just using the template agent and deploying it on their cloud, that looks something like this:

image.png

LiveKit - Setting Up Test Agent

Once you have setup your agent you can click on the Deploy agent button on the top right to get it ready. Once that is done you can create a dispatch rule to guide calls from your Difuse PBX to LiveKit:

image.png

LiveKit - Create a Dispatch Rule

The JSON for the dispatch rule looked something like this for us, of course in this instance our Agent is called Test-Agent

{
  "sipDispatchRuleId": "SDR_EFwQLj99VbdW",
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "iridia-to-agent-"
    }
  },
  "trunkIds": [
    "ST_JGJGVRaNXNgG"
  ],
  "name": "Iridia To Agent",
  "roomConfig": {
    "agents": [
      {
        "agentName": "Test-Agent"
      }
    ]
  }
}

Setting up Difuse

Once you have those configured, setting up difuse is pretty easy, the configuration looks something like this:

image.png

It's a good idea to create a new transport port for this trunk and use that in the LiveKit console so that you can specify extra configurations such as Contact FQDN which are required for LiveKit to work.

Now if you configured everything right calling 55441234 will let you talk to an agent.