diff --git a/.changeset/callee-dispatch-rule.md b/.changeset/callee-dispatch-rule.md new file mode 100644 index 00000000..b93784a3 --- /dev/null +++ b/.changeset/callee-dispatch-rule.md @@ -0,0 +1,5 @@ +--- +'livekit-server-sdk': patch +--- + +Add `callee` dispatch rule support to `createSipDispatchRule` diff --git a/packages/livekit-server-sdk/src/SipClient.ts b/packages/livekit-server-sdk/src/SipClient.ts index 1291fe86..526e7d92 100644 --- a/packages/livekit-server-sdk/src/SipClient.ts +++ b/packages/livekit-server-sdk/src/SipClient.ts @@ -27,6 +27,7 @@ import { ListSIPTrunkRequest, ListSIPTrunkResponse, SIPDispatchRule, + SIPDispatchRuleCallee, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, SIPDispatchRuleInfo, @@ -113,6 +114,14 @@ export interface SipDispatchRuleIndividual { pin?: string; } +export interface SipDispatchRuleCallee { + type: 'callee'; + roomPrefix: string; + pin?: string; + /** Optionally append a random suffix to the room name. */ + randomize?: boolean; +} + export interface CreateSipDispatchRuleOptions { name?: string; metadata?: string; @@ -450,7 +459,7 @@ export class SipClient extends ServiceBase { * @returns Created SIP dispatch rule */ async createSipDispatchRule( - rule: SipDispatchRuleDirect | SipDispatchRuleIndividual, + rule: SipDispatchRuleDirect | SipDispatchRuleIndividual | SipDispatchRuleCallee, opts?: CreateSipDispatchRuleOptions, ): Promise { if (opts === undefined) { @@ -477,6 +486,17 @@ export class SipClient extends ServiceBase { }), }, }); + } else if (rule.type == 'callee') { + ruleProto = new SIPDispatchRule({ + rule: { + case: 'dispatchRuleCallee', + value: new SIPDispatchRuleCallee({ + roomPrefix: rule.roomPrefix, + pin: rule.pin || '', + randomize: rule.randomize || false, + }), + }, + }); } const req = new CreateSIPDispatchRuleRequest({ diff --git a/packages/livekit-server-sdk/src/index.ts b/packages/livekit-server-sdk/src/index.ts index c13abf71..ef17e951 100644 --- a/packages/livekit-server-sdk/src/index.ts +++ b/packages/livekit-server-sdk/src/index.ts @@ -53,6 +53,7 @@ export { SIPDispatchRuleInfo, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, + SIPDispatchRuleCallee, SIPParticipantInfo, SIPOutboundTrunkInfo, SIPInboundTrunkInfo,