Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing createSIPParticipant params #337

Merged
merged 5 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/early-forks-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': minor
---

SIP: Add missing params in CreateSIPParticipant
17 changes: 17 additions & 0 deletions packages/livekit-server-sdk/src/SipClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
import { Duration } from '@bufbuild/protobuf';
import {
CreateSIPDispatchRuleRequest,
CreateSIPInboundTrunkRequest,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 || '';
Expand All @@ -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({
Expand All @@ -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(
Expand Down