From 1e372ed2d015d9ac36a589f231b668d0f7a62bd6 Mon Sep 17 00:00:00 2001 From: Umar Nizamani Date: Thu, 28 Nov 2024 07:19:20 +0100 Subject: [PATCH] Add missing createSIPParticipant params (#337) * add missing create sip participant params * Fixed prettier issue * Add changeset * Default ringingTimeout and maxCallDuration to be undefined * Fix formatting issues --- .changeset/early-forks-sin.md | 5 +++++ packages/livekit-server-sdk/src/SipClient.ts | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .changeset/early-forks-sin.md diff --git a/.changeset/early-forks-sin.md b/.changeset/early-forks-sin.md new file mode 100644 index 00000000..20a5daf0 --- /dev/null +++ b/.changeset/early-forks-sin.md @@ -0,0 +1,5 @@ +--- +'livekit-server-sdk': minor +--- + +SIP: Add missing params in CreateSIPParticipant diff --git a/packages/livekit-server-sdk/src/SipClient.ts b/packages/livekit-server-sdk/src/SipClient.ts index 074f3210..50428231 100644 --- a/packages/livekit-server-sdk/src/SipClient.ts +++ b/packages/livekit-server-sdk/src/SipClient.ts @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2024 LiveKit, Inc. // // SPDX-License-Identifier: Apache-2.0 +import { Duration } from '@bufbuild/protobuf'; import { CreateSIPDispatchRuleRequest, CreateSIPInboundTrunkRequest, @@ -94,6 +95,9 @@ export interface CreateSipParticipantOptions { playRingtone?: boolean; // Deprecated, use playDialtone instead playDialtone?: boolean; hidePhoneNumber?: boolean; + ringingTimeout?: number; // Duration in seconds + maxCallDuration?: number; // Duration in seconds + enableKrisp?: boolean; } export interface TransferSipParticipantOptions { @@ -419,6 +423,9 @@ export class SipClient extends ServiceBase { let playRingtone: boolean = false; let playDialtone: boolean = false; let hidePhoneNumber: boolean = false; + let ringingTimeout: number | undefined = undefined; + let maxCallDuration: number | undefined = undefined; + let enableKrisp: boolean | undefined = undefined; if (opts !== undefined) { participantIdentity = opts.participantIdentity || ''; @@ -428,6 +435,9 @@ export class SipClient extends ServiceBase { playRingtone = opts.playRingtone || false; playDialtone = opts.playDialtone || playRingtone; // Enable PlayDialtone if either PlayDialtone or playRingtone is set hidePhoneNumber = opts.hidePhoneNumber || false; + ringingTimeout = opts.ringingTimeout || undefined; + maxCallDuration = opts.maxCallDuration || undefined; + enableKrisp = opts.enableKrisp || undefined; } const req = new CreateSIPParticipantRequest({ @@ -441,6 +451,13 @@ export class SipClient extends ServiceBase { playRingtone: playDialtone, playDialtone: playDialtone, hidePhoneNumber: hidePhoneNumber, + ringingTimeout: ringingTimeout + ? new Duration({ seconds: BigInt(ringingTimeout) }) + : undefined, + maxCallDuration: maxCallDuration + ? new Duration({ seconds: BigInt(maxCallDuration) }) + : undefined, + enableKrisp: enableKrisp, }).toJson(); const data = await this.rpc.request(