Skip to content
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/add-participant-kind-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/rtc-node': patch
---

Expose `kindDetails` on `Participant` and re-export the `ParticipantKindDetail` enum
10 changes: 10 additions & 0 deletions .changeset/agent-dispatch-connector-protocol-bump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'livekit-server-sdk': patch
---

Bump `@livekit/protocol` to `1.45.6` and surface new fields on the agent dispatch and connector clients:

- `AgentDispatchClient.createDispatch`: new `restartPolicy` option (cloud only)
- `ConnectorClient.dialWhatsAppCall` / `acceptWhatsAppCall`: new `ringingTimeout` option (and `waitUntilAnswered` on accept)
- `ConnectorClient.disconnectWhatsAppCall`: new optional `disconnectReason` parameter
- Re-export `JobRestartPolicy` and `DisconnectWhatsAppCallRequest_DisconnectReason`
2 changes: 1 addition & 1 deletion examples/agent-dispatch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"dotenv": "^16.4.5",
"livekit-server-sdk": "workspace:*",
"@livekit/protocol": "^1.43.4"
"@livekit/protocol": "^1.45.6"
},
"devDependencies": {
"@types/node": "^20.10.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/livekit-rtc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@datastructures-js/deque": "1.0.8",
"@livekit/mutex": "^1.0.0",
"@livekit/typed-emitter": "^3.0.0",
"@livekit/rtc-ffi-bindings": "0.12.52-patch.0",
"@livekit/rtc-ffi-bindings": "0.12.53",
"pino": "^9.0.0",
"pino-pretty": "^13.0.0"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/livekit-rtc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export type { E2EEOptions, KeyProviderOptions } from './e2ee.js';
export { dispose } from './ffi_client.js';
export { LocalParticipant, Participant, RemoteParticipant } from './participant.js';
export { EncryptionState, EncryptionType } from '@livekit/rtc-ffi-bindings';
export { DisconnectReason, ParticipantKind } from '@livekit/rtc-ffi-bindings';
export {
DisconnectReason,
ParticipantKind,
ParticipantKindDetail,
} from '@livekit/rtc-ffi-bindings';
export {
ConnectionQuality,
ConnectionState,
Expand Down
5 changes: 5 additions & 0 deletions packages/livekit-rtc/src/participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
type OwnedParticipant,
type ParticipantInfo,
ParticipantKind,
type ParticipantKindDetail,
} from '@livekit/rtc-ffi-bindings';
import {
ChatMessage as ChatMessageModel,
Expand Down Expand Up @@ -128,6 +129,10 @@ export abstract class Participant {
return this.info.kind ?? ParticipantKind.STANDARD;
}

get kindDetails(): ParticipantKindDetail[] {
return this.info.kindDetails ?? [];
}

get disconnectReason(): DisconnectReason | undefined {
if (this.info.disconnectReason === DisconnectReason.UNKNOWN_REASON) {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/livekit-server-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@bufbuild/protobuf": "^1.10.1",
"@livekit/protocol": "^1.43.1",
"@livekit/protocol": "^1.45.6",
"camelcase-keys": "^9.0.0",
"jose": "^5.1.2"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/livekit-server-sdk/src/AgentDispatchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AgentDispatch,
CreateAgentDispatchRequest,
DeleteAgentDispatchRequest,
type JobRestartPolicy,
ListAgentDispatchRequest,
ListAgentDispatchResponse,
} from '@livekit/protocol';
Expand All @@ -16,6 +17,8 @@ interface CreateDispatchOptions {
// any custom data to send along with the job.
// note: this is different from room and participant metadata
metadata?: string;
// controls whether the job should be restarted when it fails (cloud only)
restartPolicy?: JobRestartPolicy;
}

const svc = 'AgentDispatchService';
Expand Down Expand Up @@ -57,6 +60,7 @@ export class AgentDispatchClient extends ServiceBase {
room: roomName,
agentName,
metadata: options?.metadata,
restartPolicy: options?.restartPolicy,
}).toJson();
const data = await this.rpc.request(
svc,
Expand Down
21 changes: 20 additions & 1 deletion packages/livekit-server-sdk/src/ConnectorClient.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// SPDX-FileCopyrightText: 2025 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
import { Duration } from '@bufbuild/protobuf';
import type {
ConnectTwilioCallRequest_TwilioCallDirection,
DisconnectWhatsAppCallRequest_DisconnectReason,
RoomAgentDispatch,
SessionDescription,
} from '@livekit/protocol';
Expand Down Expand Up @@ -50,6 +52,8 @@ export interface DialWhatsAppCallOptions {
participantAttributes?: { [key: string]: string };
/** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
destinationCountry?: string;
/** Optional - Max time in seconds for the callee to answer the call */
ringingTimeout?: number;
}

export interface AcceptWhatsAppCallOptions {
Expand Down Expand Up @@ -79,6 +83,10 @@ export interface AcceptWhatsAppCallOptions {
participantAttributes?: { [key: string]: string };
/** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
destinationCountry?: string;
/** Optional - Max time in seconds for the callee to answer the call */
ringingTimeout?: number;
/** Optional - Wait for the call to be answered before returning */
waitUntilAnswered?: boolean;
}

// Twilio types
Expand Down Expand Up @@ -148,6 +156,9 @@ export class ConnectorClient extends ServiceBase {
participantMetadata,
participantAttributes: options.participantAttributes,
destinationCountry,
ringingTimeout: options.ringingTimeout
? new Duration({ seconds: BigInt(options.ringingTimeout) })
: undefined,
}).toJson();

const data = await this.rpc.request(
Expand Down Expand Up @@ -189,6 +200,10 @@ export class ConnectorClient extends ServiceBase {
participantMetadata,
participantAttributes: options.participantAttributes,
destinationCountry,
ringingTimeout: options.ringingTimeout
? new Duration({ seconds: BigInt(options.ringingTimeout) })
: undefined,
waitUntilAnswered: options.waitUntilAnswered,
}).toJson();

const data = await this.rpc.request(
Expand Down Expand Up @@ -228,15 +243,19 @@ export class ConnectorClient extends ServiceBase {
* Disconnect an active WhatsApp call
*
* @param whatsappCallId - Call ID sent by Meta
* @param whatsappApiKey - The API key of the business that is disconnecting the call
* @param whatsappApiKey - The API key of the business that is disconnecting the call.
* Required when `disconnectReason` is BUSINESS_INITIATED, optional for USER_INITIATED.
* @param disconnectReason - Optional reason for disconnecting the call. Defaults to BUSINESS_INITIATED.
*/
async disconnectWhatsAppCall(
whatsappCallId: string,
whatsappApiKey: string,
disconnectReason?: DisconnectWhatsAppCallRequest_DisconnectReason,
): Promise<DisconnectWhatsAppCallResponse> {
const req = new DisconnectWhatsAppCallRequest({
whatsappCallId,
whatsappApiKey,
disconnectReason,
}).toJson();

const data = await this.rpc.request(
Expand Down
2 changes: 2 additions & 0 deletions packages/livekit-server-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
DataPacket_Kind,
DialWhatsAppCallResponse,
DirectFileOutput,
DisconnectWhatsAppCallRequest_DisconnectReason,
DisconnectWhatsAppCallResponse,
EgressInfo,
EgressStatus,
Expand All @@ -36,6 +37,7 @@ export {
IngressVideoEncodingOptions,
IngressVideoEncodingPreset,
IngressVideoOptions,
JobRestartPolicy,
ParticipantEgressRequest,
ParticipantInfo,
ParticipantInfo_State,
Expand Down
64 changes: 32 additions & 32 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading