SIP Dispatch Rule

How to create and configure a LiveKit SIP Dispatch Rule.

caution:

SIP is currently in Developer Preview.

To provision an SIP Dispatch Rule with the SIP Service, use the CreateSIPDispatchRule API. It returns an SIPDispatchRuleInfo object that describes the created SIPDispatchRule. These parameters can also be queried at any time using the ListSIPDispatchRule API.

Direct SIP Dispatch Rule

This creates a SIP Dispatch rule that puts a caller into a single room, optionally protected by a pin.

By default, a SIP Dispatch Rule will be matched against all your trunks. You can populate the trunk_ids if you wish for a SIP Dispatch Rule to only match a single trunk. You can also optionally hide the phone number of the caller by setting hide_phone_number.

Create a file at sipDispatchRule.json with the following contents:

{
"trunk_ids": [],
"hide_phone_number": false
"rule": {
"dispatchRuleDirect": {
"roomName": "open-room",
"pin": ""
}
},
}

Calls will be immediately connected to open-room on LiveKit.

Then create the SIP Dispatch Rule using livekit-cli:

export LIVEKIT_URL=<your LiveKit server URL>
export LIVEKIT_API_KEY=<your API Key>
export LIVEKIT_API_SECRET=<your API Secret>
livekit-cli create-sip-dispatch-rule --request sipDispatchRule.json

Individual SIP Dispatch Rule

This creates a SIP Dispatch rule that creates a new room for each caller. The created room will be the phone number of the caller plus a random suffix. You can optionally add a specific room name prefix by using the roomPrefix option.

By default a SIP Dispatch Rule will be matched against all your trunks. You can populate the trunk_ids if you wish for a SIP Dispatch Rule to only match a single trunk. You can also optionally hide the phone number of the caller by setting hide_phone_number.

Create a file at sipDispatchRule.json with the following contents:

{
"trunk_ids": [],
"hide_phone_number": false
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-",
"pin": ""
}
},
}

Then create the SIP Dispatch Rule using livekit-cli:

export LIVEKIT_URL=<your LiveKit server URL>
export LIVEKIT_API_KEY=<your API Key>
export LIVEKIT_API_SECRET=<your API Secret>
livekit-cli create-sip-dispatch-rule --request sipDispatchRule.json