livekit-server-sdk 2.14.2 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ConnectorClient_exports = {};
20
+ __export(ConnectorClient_exports, {
21
+ ConnectorClient: () => ConnectorClient
22
+ });
23
+ module.exports = __toCommonJS(ConnectorClient_exports);
24
+ var import_protocol = require("@livekit/protocol");
25
+ var import_ServiceBase = require("./ServiceBase.cjs");
26
+ var import_TwirpRPC = require("./TwirpRPC.cjs");
27
+ const svc = "Connector";
28
+ class ConnectorClient extends import_ServiceBase.ServiceBase {
29
+ /**
30
+ * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
31
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
32
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
33
+ * @param options - client options
34
+ */
35
+ constructor(host, apiKey, secret, options) {
36
+ super(apiKey, secret);
37
+ const rpcOptions = (options == null ? void 0 : options.requestTimeout) ? { requestTimeout: options.requestTimeout } : void 0;
38
+ this.rpc = new import_TwirpRPC.TwirpRpc(host, import_TwirpRPC.livekitPackage, rpcOptions);
39
+ }
40
+ /**
41
+ * Initiate an outbound WhatsApp call
42
+ *
43
+ * @param options - WhatsApp call options
44
+ * @returns Promise containing the WhatsApp call ID and room name
45
+ */
46
+ async dialWhatsAppCall(options) {
47
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || "";
48
+ const roomName = options.roomName || "";
49
+ const participantIdentity = options.participantIdentity || "";
50
+ const participantName = options.participantName || "";
51
+ const participantMetadata = options.participantMetadata || "";
52
+ const destinationCountry = options.destinationCountry || "";
53
+ const req = new import_protocol.DialWhatsAppCallRequest({
54
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
55
+ whatsappToPhoneNumber: options.whatsappToPhoneNumber,
56
+ whatsappApiKey: options.whatsappApiKey,
57
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
58
+ whatsappBizOpaqueCallbackData,
59
+ roomName,
60
+ agents: options.agents,
61
+ participantIdentity,
62
+ participantName,
63
+ participantMetadata,
64
+ participantAttributes: options.participantAttributes,
65
+ destinationCountry
66
+ }).toJson();
67
+ const data = await this.rpc.request(
68
+ svc,
69
+ "DialWhatsAppCall",
70
+ req,
71
+ await this.authHeader({ roomCreate: true })
72
+ );
73
+ return import_protocol.DialWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
74
+ }
75
+ /**
76
+ * Accept an inbound WhatsApp call
77
+ *
78
+ * @param options - WhatsApp call accept options
79
+ * @returns Promise containing the room name
80
+ */
81
+ async acceptWhatsAppCall(options) {
82
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || "";
83
+ const roomName = options.roomName || "";
84
+ const participantIdentity = options.participantIdentity || "";
85
+ const participantName = options.participantName || "";
86
+ const participantMetadata = options.participantMetadata || "";
87
+ const destinationCountry = options.destinationCountry || "";
88
+ const req = new import_protocol.AcceptWhatsAppCallRequest({
89
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
90
+ whatsappApiKey: options.whatsappApiKey,
91
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
92
+ whatsappCallId: options.whatsappCallId,
93
+ whatsappBizOpaqueCallbackData,
94
+ sdp: options.sdp,
95
+ roomName,
96
+ agents: options.agents,
97
+ participantIdentity,
98
+ participantName,
99
+ participantMetadata,
100
+ participantAttributes: options.participantAttributes,
101
+ destinationCountry
102
+ }).toJson();
103
+ const data = await this.rpc.request(
104
+ svc,
105
+ "AcceptWhatsAppCall",
106
+ req,
107
+ await this.authHeader({ roomCreate: true })
108
+ );
109
+ return import_protocol.AcceptWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
110
+ }
111
+ /**
112
+ * Connect an established WhatsApp call (used for business-initiated calls)
113
+ *
114
+ * @param whatsappCallId - Call ID sent by Meta
115
+ * @param sdp - Session description from Meta
116
+ */
117
+ async connectWhatsAppCall(whatsappCallId, sdp) {
118
+ const req = new import_protocol.ConnectWhatsAppCallRequest({
119
+ whatsappCallId,
120
+ sdp
121
+ }).toJson();
122
+ const data = await this.rpc.request(
123
+ svc,
124
+ "ConnectWhatsAppCall",
125
+ req,
126
+ await this.authHeader({ roomCreate: true })
127
+ );
128
+ return import_protocol.ConnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
129
+ }
130
+ /**
131
+ * Disconnect an active WhatsApp call
132
+ *
133
+ * @param whatsappCallId - Call ID sent by Meta
134
+ * @param whatsappApiKey - The API key of the business that is disconnecting the call
135
+ */
136
+ async disconnectWhatsAppCall(whatsappCallId, whatsappApiKey) {
137
+ const req = new import_protocol.DisconnectWhatsAppCallRequest({
138
+ whatsappCallId,
139
+ whatsappApiKey
140
+ }).toJson();
141
+ const data = await this.rpc.request(
142
+ svc,
143
+ "DisconnectWhatsAppCall",
144
+ req,
145
+ await this.authHeader({ roomCreate: true })
146
+ );
147
+ return import_protocol.DisconnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
148
+ }
149
+ /**
150
+ * Connect a Twilio call to a LiveKit room
151
+ *
152
+ * @param options - Twilio call connection options
153
+ * @returns Promise containing the WebSocket connect URL for Twilio media stream
154
+ */
155
+ async connectTwilioCall(options) {
156
+ const participantIdentity = options.participantIdentity || "";
157
+ const participantName = options.participantName || "";
158
+ const participantMetadata = options.participantMetadata || "";
159
+ const destinationCountry = options.destinationCountry || "";
160
+ const req = new import_protocol.ConnectTwilioCallRequest({
161
+ twilioCallDirection: options.twilioCallDirection,
162
+ roomName: options.roomName,
163
+ agents: options.agents,
164
+ participantIdentity,
165
+ participantName,
166
+ participantMetadata,
167
+ participantAttributes: options.participantAttributes,
168
+ destinationCountry
169
+ }).toJson();
170
+ const data = await this.rpc.request(
171
+ svc,
172
+ "ConnectTwilioCall",
173
+ req,
174
+ await this.authHeader({ roomCreate: true })
175
+ );
176
+ return import_protocol.ConnectTwilioCallResponse.fromJson(data, { ignoreUnknownFields: true });
177
+ }
178
+ }
179
+ // Annotate the CommonJS export names for ESM import in node:
180
+ 0 && (module.exports = {
181
+ ConnectorClient
182
+ });
183
+ //# sourceMappingURL=ConnectorClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ConnectorClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type {\n ConnectTwilioCallRequest_TwilioCallDirection,\n RoomAgentDispatch,\n SessionDescription,\n} from '@livekit/protocol';\nimport {\n AcceptWhatsAppCallRequest,\n AcceptWhatsAppCallResponse,\n ConnectTwilioCallRequest,\n ConnectTwilioCallResponse,\n ConnectWhatsAppCallRequest,\n ConnectWhatsAppCallResponse,\n DialWhatsAppCallRequest,\n DialWhatsAppCallResponse,\n DisconnectWhatsAppCallRequest,\n DisconnectWhatsAppCallResponse,\n} from '@livekit/protocol';\nimport type { ClientOptions } from './ClientOptions.js';\nimport { ServiceBase } from './ServiceBase.js';\nimport { type Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'Connector';\n\n// WhatsApp types\nexport interface DialWhatsAppCallOptions {\n /** Required - The identifier of the WhatsApp phone number that is initiating the call */\n whatsappPhoneNumberId: string;\n /** Required - The number of the user that is supposed to receive the call */\n whatsappToPhoneNumber: string;\n /** Required - The API key of the business that is initiating the call */\n whatsappApiKey: string;\n /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */\n whatsappCloudApiVersion: string;\n /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */\n whatsappBizOpaqueCallbackData?: string;\n /** Optional - What LiveKit room should this participant be connected to */\n roomName?: string;\n /** Optional - Agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional - Identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional - Name of the participant in LiveKit room */\n participantName?: string;\n /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\nexport interface AcceptWhatsAppCallOptions {\n /** Required - The identifier of the WhatsApp phone number that is connecting the call */\n whatsappPhoneNumberId: string;\n /** Required - The API key of the business that is connecting the call */\n whatsappApiKey: string;\n /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */\n whatsappCloudApiVersion: string;\n /** Required - Call ID sent by Meta */\n whatsappCallId: string;\n /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */\n whatsappBizOpaqueCallbackData?: string;\n /** Required - The call accept webhook comes with SDP from Meta */\n sdp: SessionDescription;\n /** Optional - What LiveKit room should this participant be connected to */\n roomName?: string;\n /** Optional - Agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional - Identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional - Name of the participant in LiveKit room */\n participantName?: string;\n /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\n// Twilio types\nexport interface ConnectTwilioCallOptions {\n /** The direction of the call */\n twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;\n /** What LiveKit room should this call be connected to */\n roomName: string;\n /** Optional agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional name of the participant in LiveKit room */\n participantName?: string;\n /** Optional user-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional user-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\n/**\n * Client to access Connector APIs for WhatsApp and Twilio integrations\n */\nexport class ConnectorClient extends ServiceBase {\n private readonly rpc: Rpc;\n\n /**\n * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'\n * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY\n * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET\n * @param options - client options\n */\n constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions) {\n super(apiKey, secret);\n const rpcOptions = options?.requestTimeout\n ? { requestTimeout: options.requestTimeout }\n : undefined;\n this.rpc = new TwirpRpc(host, livekitPackage, rpcOptions);\n }\n\n /**\n * Initiate an outbound WhatsApp call\n *\n * @param options - WhatsApp call options\n * @returns Promise containing the WhatsApp call ID and room name\n */\n async dialWhatsAppCall(options: DialWhatsAppCallOptions): Promise<DialWhatsAppCallResponse> {\n const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';\n const roomName = options.roomName || '';\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new DialWhatsAppCallRequest({\n whatsappPhoneNumberId: options.whatsappPhoneNumberId,\n whatsappToPhoneNumber: options.whatsappToPhoneNumber,\n whatsappApiKey: options.whatsappApiKey,\n whatsappCloudApiVersion: options.whatsappCloudApiVersion,\n whatsappBizOpaqueCallbackData,\n roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'DialWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return DialWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Accept an inbound WhatsApp call\n *\n * @param options - WhatsApp call accept options\n * @returns Promise containing the room name\n */\n async acceptWhatsAppCall(\n options: AcceptWhatsAppCallOptions,\n ): Promise<AcceptWhatsAppCallResponse> {\n const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';\n const roomName = options.roomName || '';\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new AcceptWhatsAppCallRequest({\n whatsappPhoneNumberId: options.whatsappPhoneNumberId,\n whatsappApiKey: options.whatsappApiKey,\n whatsappCloudApiVersion: options.whatsappCloudApiVersion,\n whatsappCallId: options.whatsappCallId,\n whatsappBizOpaqueCallbackData,\n sdp: options.sdp,\n roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'AcceptWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return AcceptWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Connect an established WhatsApp call (used for business-initiated calls)\n *\n * @param whatsappCallId - Call ID sent by Meta\n * @param sdp - Session description from Meta\n */\n async connectWhatsAppCall(\n whatsappCallId: string,\n sdp: SessionDescription,\n ): Promise<ConnectWhatsAppCallResponse> {\n const req = new ConnectWhatsAppCallRequest({\n whatsappCallId,\n sdp,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'ConnectWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return ConnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Disconnect an active WhatsApp call\n *\n * @param whatsappCallId - Call ID sent by Meta\n * @param whatsappApiKey - The API key of the business that is disconnecting the call\n */\n async disconnectWhatsAppCall(\n whatsappCallId: string,\n whatsappApiKey: string,\n ): Promise<DisconnectWhatsAppCallResponse> {\n const req = new DisconnectWhatsAppCallRequest({\n whatsappCallId,\n whatsappApiKey,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'DisconnectWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return DisconnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Connect a Twilio call to a LiveKit room\n *\n * @param options - Twilio call connection options\n * @returns Promise containing the WebSocket connect URL for Twilio media stream\n */\n async connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse> {\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new ConnectTwilioCallRequest({\n twilioCallDirection: options.twilioCallDirection,\n roomName: options.roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'ConnectTwilioCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return ConnectTwilioCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,sBAWO;AAEP,yBAA4B;AAC5B,sBAAmD;AAEnD,MAAM,MAAM;AAkFL,MAAM,wBAAwB,+BAAY;AAAA;AAAA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Y,KAAK,CAAC;AAAA,IAC5C;AACA,WAAO,+CAA+B,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EACpF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,kBAAkB,SAAuE;AAC7F,UAAM,sBAAsB,QAAQ,uBAAuB;AAC3D,UAAM,kBAAkB,QAAQ,mBAAmB;AACnD,UAAM,sBAAsB,QAAQ,uBAAuB;AAC3D,UAAM,qBAAqB,QAAQ,sBAAsB;AAEzD,UAAM,MAAM,IAAI,yCAAyB;AAAA,MACvC,qBAAqB,QAAQ;AAAA,MAC7B,UAAU,QAAQ;AAAA,MAClB,QAAQ,QAAQ;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,uBAAuB,QAAQ;AAAA,MAC/B;AAAA,IACF,CAAC,EAAE,OAAO;AAEV,UAAM,OAAO,MAAM,KAAK,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,EAAE,YAAY,KAAK,CAAC;AAAA,IAC5C;AACA,WAAO,0CAA0B,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EAC/E;AACF;","names":[]}
@@ -0,0 +1,134 @@
1
+ import { RoomAgentDispatch, SessionDescription, ConnectTwilioCallRequest_TwilioCallDirection, DialWhatsAppCallResponse, AcceptWhatsAppCallResponse, ConnectWhatsAppCallResponse, DisconnectWhatsAppCallResponse, ConnectTwilioCallResponse } from '@livekit/protocol';
2
+ import { ClientOptions } from './ClientOptions.cjs';
3
+ import { ServiceBase } from './ServiceBase.cjs';
4
+ import './grants.cjs';
5
+ import 'jose';
6
+
7
+ interface DialWhatsAppCallOptions {
8
+ /** Required - The identifier of the WhatsApp phone number that is initiating the call */
9
+ whatsappPhoneNumberId: string;
10
+ /** Required - The number of the user that is supposed to receive the call */
11
+ whatsappToPhoneNumber: string;
12
+ /** Required - The API key of the business that is initiating the call */
13
+ whatsappApiKey: string;
14
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
15
+ whatsappCloudApiVersion: string;
16
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
17
+ whatsappBizOpaqueCallbackData?: string;
18
+ /** Optional - What LiveKit room should this participant be connected to */
19
+ roomName?: string;
20
+ /** Optional - Agents to dispatch the call to */
21
+ agents?: RoomAgentDispatch[];
22
+ /** Optional - Identity of the participant in LiveKit room */
23
+ participantIdentity?: string;
24
+ /** Optional - Name of the participant in LiveKit room */
25
+ participantName?: string;
26
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
27
+ participantMetadata?: string;
28
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
29
+ participantAttributes?: {
30
+ [key: string]: string;
31
+ };
32
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
33
+ destinationCountry?: string;
34
+ }
35
+ interface AcceptWhatsAppCallOptions {
36
+ /** Required - The identifier of the WhatsApp phone number that is connecting the call */
37
+ whatsappPhoneNumberId: string;
38
+ /** Required - The API key of the business that is connecting the call */
39
+ whatsappApiKey: string;
40
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
41
+ whatsappCloudApiVersion: string;
42
+ /** Required - Call ID sent by Meta */
43
+ whatsappCallId: string;
44
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
45
+ whatsappBizOpaqueCallbackData?: string;
46
+ /** Required - The call accept webhook comes with SDP from Meta */
47
+ sdp: SessionDescription;
48
+ /** Optional - What LiveKit room should this participant be connected to */
49
+ roomName?: string;
50
+ /** Optional - Agents to dispatch the call to */
51
+ agents?: RoomAgentDispatch[];
52
+ /** Optional - Identity of the participant in LiveKit room */
53
+ participantIdentity?: string;
54
+ /** Optional - Name of the participant in LiveKit room */
55
+ participantName?: string;
56
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
57
+ participantMetadata?: string;
58
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
59
+ participantAttributes?: {
60
+ [key: string]: string;
61
+ };
62
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
63
+ destinationCountry?: string;
64
+ }
65
+ interface ConnectTwilioCallOptions {
66
+ /** The direction of the call */
67
+ twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;
68
+ /** What LiveKit room should this call be connected to */
69
+ roomName: string;
70
+ /** Optional agents to dispatch the call to */
71
+ agents?: RoomAgentDispatch[];
72
+ /** Optional identity of the participant in LiveKit room */
73
+ participantIdentity?: string;
74
+ /** Optional name of the participant in LiveKit room */
75
+ participantName?: string;
76
+ /** Optional user-defined metadata. Will be attached to a created Participant in the room. */
77
+ participantMetadata?: string;
78
+ /** Optional user-defined attributes. Will be attached to a created Participant in the room. */
79
+ participantAttributes?: {
80
+ [key: string]: string;
81
+ };
82
+ /** Country where the call terminates as ISO 3166-1 alpha-2 */
83
+ destinationCountry?: string;
84
+ }
85
+ /**
86
+ * Client to access Connector APIs for WhatsApp and Twilio integrations
87
+ */
88
+ declare class ConnectorClient extends ServiceBase {
89
+ private readonly rpc;
90
+ /**
91
+ * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
92
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
93
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
94
+ * @param options - client options
95
+ */
96
+ constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions);
97
+ /**
98
+ * Initiate an outbound WhatsApp call
99
+ *
100
+ * @param options - WhatsApp call options
101
+ * @returns Promise containing the WhatsApp call ID and room name
102
+ */
103
+ dialWhatsAppCall(options: DialWhatsAppCallOptions): Promise<DialWhatsAppCallResponse>;
104
+ /**
105
+ * Accept an inbound WhatsApp call
106
+ *
107
+ * @param options - WhatsApp call accept options
108
+ * @returns Promise containing the room name
109
+ */
110
+ acceptWhatsAppCall(options: AcceptWhatsAppCallOptions): Promise<AcceptWhatsAppCallResponse>;
111
+ /**
112
+ * Connect an established WhatsApp call (used for business-initiated calls)
113
+ *
114
+ * @param whatsappCallId - Call ID sent by Meta
115
+ * @param sdp - Session description from Meta
116
+ */
117
+ connectWhatsAppCall(whatsappCallId: string, sdp: SessionDescription): Promise<ConnectWhatsAppCallResponse>;
118
+ /**
119
+ * Disconnect an active WhatsApp call
120
+ *
121
+ * @param whatsappCallId - Call ID sent by Meta
122
+ * @param whatsappApiKey - The API key of the business that is disconnecting the call
123
+ */
124
+ disconnectWhatsAppCall(whatsappCallId: string, whatsappApiKey: string): Promise<DisconnectWhatsAppCallResponse>;
125
+ /**
126
+ * Connect a Twilio call to a LiveKit room
127
+ *
128
+ * @param options - Twilio call connection options
129
+ * @returns Promise containing the WebSocket connect URL for Twilio media stream
130
+ */
131
+ connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse>;
132
+ }
133
+
134
+ export { type AcceptWhatsAppCallOptions, type ConnectTwilioCallOptions, ConnectorClient, type DialWhatsAppCallOptions };
@@ -0,0 +1,131 @@
1
+ import type { ConnectTwilioCallRequest_TwilioCallDirection, RoomAgentDispatch, SessionDescription } from '@livekit/protocol';
2
+ import { AcceptWhatsAppCallResponse, ConnectTwilioCallResponse, ConnectWhatsAppCallResponse, DialWhatsAppCallResponse, DisconnectWhatsAppCallResponse } from '@livekit/protocol';
3
+ import type { ClientOptions } from './ClientOptions.js';
4
+ import { ServiceBase } from './ServiceBase.js';
5
+ export interface DialWhatsAppCallOptions {
6
+ /** Required - The identifier of the WhatsApp phone number that is initiating the call */
7
+ whatsappPhoneNumberId: string;
8
+ /** Required - The number of the user that is supposed to receive the call */
9
+ whatsappToPhoneNumber: string;
10
+ /** Required - The API key of the business that is initiating the call */
11
+ whatsappApiKey: string;
12
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
13
+ whatsappCloudApiVersion: string;
14
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
15
+ whatsappBizOpaqueCallbackData?: string;
16
+ /** Optional - What LiveKit room should this participant be connected to */
17
+ roomName?: string;
18
+ /** Optional - Agents to dispatch the call to */
19
+ agents?: RoomAgentDispatch[];
20
+ /** Optional - Identity of the participant in LiveKit room */
21
+ participantIdentity?: string;
22
+ /** Optional - Name of the participant in LiveKit room */
23
+ participantName?: string;
24
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
25
+ participantMetadata?: string;
26
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
27
+ participantAttributes?: {
28
+ [key: string]: string;
29
+ };
30
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
31
+ destinationCountry?: string;
32
+ }
33
+ export interface AcceptWhatsAppCallOptions {
34
+ /** Required - The identifier of the WhatsApp phone number that is connecting the call */
35
+ whatsappPhoneNumberId: string;
36
+ /** Required - The API key of the business that is connecting the call */
37
+ whatsappApiKey: string;
38
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
39
+ whatsappCloudApiVersion: string;
40
+ /** Required - Call ID sent by Meta */
41
+ whatsappCallId: string;
42
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
43
+ whatsappBizOpaqueCallbackData?: string;
44
+ /** Required - The call accept webhook comes with SDP from Meta */
45
+ sdp: SessionDescription;
46
+ /** Optional - What LiveKit room should this participant be connected to */
47
+ roomName?: string;
48
+ /** Optional - Agents to dispatch the call to */
49
+ agents?: RoomAgentDispatch[];
50
+ /** Optional - Identity of the participant in LiveKit room */
51
+ participantIdentity?: string;
52
+ /** Optional - Name of the participant in LiveKit room */
53
+ participantName?: string;
54
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
55
+ participantMetadata?: string;
56
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
57
+ participantAttributes?: {
58
+ [key: string]: string;
59
+ };
60
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
61
+ destinationCountry?: string;
62
+ }
63
+ export interface ConnectTwilioCallOptions {
64
+ /** The direction of the call */
65
+ twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;
66
+ /** What LiveKit room should this call be connected to */
67
+ roomName: string;
68
+ /** Optional agents to dispatch the call to */
69
+ agents?: RoomAgentDispatch[];
70
+ /** Optional identity of the participant in LiveKit room */
71
+ participantIdentity?: string;
72
+ /** Optional name of the participant in LiveKit room */
73
+ participantName?: string;
74
+ /** Optional user-defined metadata. Will be attached to a created Participant in the room. */
75
+ participantMetadata?: string;
76
+ /** Optional user-defined attributes. Will be attached to a created Participant in the room. */
77
+ participantAttributes?: {
78
+ [key: string]: string;
79
+ };
80
+ /** Country where the call terminates as ISO 3166-1 alpha-2 */
81
+ destinationCountry?: string;
82
+ }
83
+ /**
84
+ * Client to access Connector APIs for WhatsApp and Twilio integrations
85
+ */
86
+ export declare class ConnectorClient extends ServiceBase {
87
+ private readonly rpc;
88
+ /**
89
+ * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
90
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
91
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
92
+ * @param options - client options
93
+ */
94
+ constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions);
95
+ /**
96
+ * Initiate an outbound WhatsApp call
97
+ *
98
+ * @param options - WhatsApp call options
99
+ * @returns Promise containing the WhatsApp call ID and room name
100
+ */
101
+ dialWhatsAppCall(options: DialWhatsAppCallOptions): Promise<DialWhatsAppCallResponse>;
102
+ /**
103
+ * Accept an inbound WhatsApp call
104
+ *
105
+ * @param options - WhatsApp call accept options
106
+ * @returns Promise containing the room name
107
+ */
108
+ acceptWhatsAppCall(options: AcceptWhatsAppCallOptions): Promise<AcceptWhatsAppCallResponse>;
109
+ /**
110
+ * Connect an established WhatsApp call (used for business-initiated calls)
111
+ *
112
+ * @param whatsappCallId - Call ID sent by Meta
113
+ * @param sdp - Session description from Meta
114
+ */
115
+ connectWhatsAppCall(whatsappCallId: string, sdp: SessionDescription): Promise<ConnectWhatsAppCallResponse>;
116
+ /**
117
+ * Disconnect an active WhatsApp call
118
+ *
119
+ * @param whatsappCallId - Call ID sent by Meta
120
+ * @param whatsappApiKey - The API key of the business that is disconnecting the call
121
+ */
122
+ disconnectWhatsAppCall(whatsappCallId: string, whatsappApiKey: string): Promise<DisconnectWhatsAppCallResponse>;
123
+ /**
124
+ * Connect a Twilio call to a LiveKit room
125
+ *
126
+ * @param options - Twilio call connection options
127
+ * @returns Promise containing the WebSocket connect URL for Twilio media stream
128
+ */
129
+ connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse>;
130
+ }
131
+ //# sourceMappingURL=ConnectorClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectorClient.d.ts","sourceRoot":"","sources":["../src/ConnectorClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4CAA4C,EAC5C,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,0BAA0B,EAE1B,yBAAyB,EAEzB,2BAA2B,EAE3B,wBAAwB,EAExB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/C,MAAM,WAAW,uBAAuB;IACtC,yFAAyF;IACzF,qBAAqB,EAAE,MAAM,CAAC;IAC9B,6EAA6E;IAC7E,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,uBAAuB,EAAE,MAAM,CAAC;IAChC,sGAAsG;IACtG,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC7B,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,MAAM,C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AAC,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,+FAA+F;IAC/F,qBAAqB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClD,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAE1B;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAQnF;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAgC3F;;;;;OAKG;IACG,kBAAkB,CACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,0BAA0B,CAAC;IAiCtC;;;;;OAKG;IACG,mBAAmB,CACvB,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAAC,2BAA2B,CAAC;IAevC;;;;;OAKG;IACG,sBAAsB,CAC1B,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,8BAA8B,CAAC;IAe1C;;;;;OAKG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAyB/F"}
@@ -0,0 +1,170 @@
1
+ import {
2
+ AcceptWhatsAppCallRequest,
3
+ AcceptWhatsAppCallResponse,
4
+ ConnectTwilioCallRequest,
5
+ ConnectTwilioCallResponse,
6
+ ConnectWhatsAppCallRequest,
7
+ ConnectWhatsAppCallResponse,
8
+ DialWhatsAppCallRequest,
9
+ DialWhatsAppCallResponse,
10
+ DisconnectWhatsAppCallRequest,
11
+ DisconnectWhatsAppCallResponse
12
+ } from "@livekit/protocol";
13
+ import { ServiceBase } from "./ServiceBase.js";
14
+ import { TwirpRpc, livekitPackage } from "./TwirpRPC.js";
15
+ const svc = "Connector";
16
+ class ConnectorClient extends ServiceBase {
17
+ /**
18
+ * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
19
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
20
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
21
+ * @param options - client options
22
+ */
23
+ constructor(host, apiKey, secret, options) {
24
+ super(apiKey, secret);
25
+ const rpcOptions = (options == null ? void 0 : options.requestTimeout) ? { requestTimeout: options.requestTimeout } : void 0;
26
+ this.rpc = new TwirpRpc(host, livekitPackage, rpcOptions);
27
+ }
28
+ /**
29
+ * Initiate an outbound WhatsApp call
30
+ *
31
+ * @param options - WhatsApp call options
32
+ * @returns Promise containing the WhatsApp call ID and room name
33
+ */
34
+ async dialWhatsAppCall(options) {
35
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || "";
36
+ const roomName = options.roomName || "";
37
+ const participantIdentity = options.participantIdentity || "";
38
+ const participantName = options.participantName || "";
39
+ const participantMetadata = options.participantMetadata || "";
40
+ const destinationCountry = options.destinationCountry || "";
41
+ const req = new DialWhatsAppCallRequest({
42
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
43
+ whatsappToPhoneNumber: options.whatsappToPhoneNumber,
44
+ whatsappApiKey: options.whatsappApiKey,
45
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
46
+ whatsappBizOpaqueCallbackData,
47
+ roomName,
48
+ agents: options.agents,
49
+ participantIdentity,
50
+ participantName,
51
+ participantMetadata,
52
+ participantAttributes: options.participantAttributes,
53
+ destinationCountry
54
+ }).toJson();
55
+ const data = await this.rpc.request(
56
+ svc,
57
+ "DialWhatsAppCall",
58
+ req,
59
+ await this.authHeader({ roomCreate: true })
60
+ );
61
+ return DialWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
62
+ }
63
+ /**
64
+ * Accept an inbound WhatsApp call
65
+ *
66
+ * @param options - WhatsApp call accept options
67
+ * @returns Promise containing the room name
68
+ */
69
+ async acceptWhatsAppCall(options) {
70
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || "";
71
+ const roomName = options.roomName || "";
72
+ const participantIdentity = options.participantIdentity || "";
73
+ const participantName = options.participantName || "";
74
+ const participantMetadata = options.participantMetadata || "";
75
+ const destinationCountry = options.destinationCountry || "";
76
+ const req = new AcceptWhatsAppCallRequest({
77
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
78
+ whatsappApiKey: options.whatsappApiKey,
79
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
80
+ whatsappCallId: options.whatsappCallId,
81
+ whatsappBizOpaqueCallbackData,
82
+ sdp: options.sdp,
83
+ roomName,
84
+ agents: options.agents,
85
+ participantIdentity,
86
+ participantName,
87
+ participantMetadata,
88
+ participantAttributes: options.participantAttributes,
89
+ destinationCountry
90
+ }).toJson();
91
+ const data = await this.rpc.request(
92
+ svc,
93
+ "AcceptWhatsAppCall",
94
+ req,
95
+ await this.authHeader({ roomCreate: true })
96
+ );
97
+ return AcceptWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
98
+ }
99
+ /**
100
+ * Connect an established WhatsApp call (used for business-initiated calls)
101
+ *
102
+ * @param whatsappCallId - Call ID sent by Meta
103
+ * @param sdp - Session description from Meta
104
+ */
105
+ async connectWhatsAppCall(whatsappCallId, sdp) {
106
+ const req = new ConnectWhatsAppCallRequest({
107
+ whatsappCallId,
108
+ sdp
109
+ }).toJson();
110
+ const data = await this.rpc.request(
111
+ svc,
112
+ "ConnectWhatsAppCall",
113
+ req,
114
+ await this.authHeader({ roomCreate: true })
115
+ );
116
+ return ConnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
117
+ }
118
+ /**
119
+ * Disconnect an active WhatsApp call
120
+ *
121
+ * @param whatsappCallId - Call ID sent by Meta
122
+ * @param whatsappApiKey - The API key of the business that is disconnecting the call
123
+ */
124
+ async disconnectWhatsAppCall(whatsappCallId, whatsappApiKey) {
125
+ const req = new DisconnectWhatsAppCallRequest({
126
+ whatsappCallId,
127
+ whatsappApiKey
128
+ }).toJson();
129
+ const data = await this.rpc.request(
130
+ svc,
131
+ "DisconnectWhatsAppCall",
132
+ req,
133
+ await this.authHeader({ roomCreate: true })
134
+ );
135
+ return DisconnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
136
+ }
137
+ /**
138
+ * Connect a Twilio call to a LiveKit room
139
+ *
140
+ * @param options - Twilio call connection options
141
+ * @returns Promise containing the WebSocket connect URL for Twilio media stream
142
+ */
143
+ async connectTwilioCall(options) {
144
+ const participantIdentity = options.participantIdentity || "";
145
+ const participantName = options.participantName || "";
146
+ const participantMetadata = options.participantMetadata || "";
147
+ const destinationCountry = options.destinationCountry || "";
148
+ const req = new ConnectTwilioCallRequest({
149
+ twilioCallDirection: options.twilioCallDirection,
150
+ roomName: options.roomName,
151
+ agents: options.agents,
152
+ participantIdentity,
153
+ participantName,
154
+ participantMetadata,
155
+ participantAttributes: options.participantAttributes,
156
+ destinationCountry
157
+ }).toJson();
158
+ const data = await this.rpc.request(
159
+ svc,
160
+ "ConnectTwilioCall",
161
+ req,
162
+ await this.authHeader({ roomCreate: true })
163
+ );
164
+ return ConnectTwilioCallResponse.fromJson(data, { ignoreUnknownFields: true });
165
+ }
166
+ }
167
+ export {
168
+ ConnectorClient
169
+ };
170
+ //# sourceMappingURL=ConnectorClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ConnectorClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type {\n ConnectTwilioCallRequest_TwilioCallDirection,\n RoomAgentDispatch,\n SessionDescription,\n} from '@livekit/protocol';\nimport {\n AcceptWhatsAppCallRequest,\n AcceptWhatsAppCallResponse,\n ConnectTwilioCallRequest,\n ConnectTwilioCallResponse,\n ConnectWhatsAppCallRequest,\n ConnectWhatsAppCallResponse,\n DialWhatsAppCallRequest,\n DialWhatsAppCallResponse,\n DisconnectWhatsAppCallRequest,\n DisconnectWhatsAppCallResponse,\n} from '@livekit/protocol';\nimport type { ClientOptions } from './ClientOptions.js';\nimport { ServiceBase } from './ServiceBase.js';\nimport { type Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'Connector';\n\n// WhatsApp types\nexport interface DialWhatsAppCallOptions {\n /** Required - The identifier of the WhatsApp phone number that is initiating the call */\n whatsappPhoneNumberId: string;\n /** Required - The number of the user that is supposed to receive the call */\n whatsappToPhoneNumber: string;\n /** Required - The API key of the business that is initiating the call */\n whatsappApiKey: string;\n /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */\n whatsappCloudApiVersion: string;\n /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */\n whatsappBizOpaqueCallbackData?: string;\n /** Optional - What LiveKit room should this participant be connected to */\n roomName?: string;\n /** Optional - Agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional - Identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional - Name of the participant in LiveKit room */\n participantName?: string;\n /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\nexport interface AcceptWhatsAppCallOptions {\n /** Required - The identifier of the WhatsApp phone number that is connecting the call */\n whatsappPhoneNumberId: string;\n /** Required - The API key of the business that is connecting the call */\n whatsappApiKey: string;\n /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */\n whatsappCloudApiVersion: string;\n /** Required - Call ID sent by Meta */\n whatsappCallId: string;\n /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */\n whatsappBizOpaqueCallbackData?: string;\n /** Required - The call accept webhook comes with SDP from Meta */\n sdp: SessionDescription;\n /** Optional - What LiveKit room should this participant be connected to */\n roomName?: string;\n /** Optional - Agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional - Identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional - Name of the participant in LiveKit room */\n participantName?: string;\n /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\n// Twilio types\nexport interface ConnectTwilioCallOptions {\n /** The direction of the call */\n twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;\n /** What LiveKit room should this call be connected to */\n roomName: string;\n /** Optional agents to dispatch the call to */\n agents?: RoomAgentDispatch[];\n /** Optional identity of the participant in LiveKit room */\n participantIdentity?: string;\n /** Optional name of the participant in LiveKit room */\n participantName?: string;\n /** Optional user-defined metadata. Will be attached to a created Participant in the room. */\n participantMetadata?: string;\n /** Optional user-defined attributes. Will be attached to a created Participant in the room. */\n participantAttributes?: { [key: string]: string };\n /** Country where the call terminates as ISO 3166-1 alpha-2 */\n destinationCountry?: string;\n}\n\n/**\n * Client to access Connector APIs for WhatsApp and Twilio integrations\n */\nexport class ConnectorClient extends ServiceBase {\n private readonly rpc: Rpc;\n\n /**\n * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'\n * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY\n * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET\n * @param options - client options\n */\n constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions) {\n super(apiKey, secret);\n const rpcOptions = options?.requestTimeout\n ? { requestTimeout: options.requestTimeout }\n : undefined;\n this.rpc = new TwirpRpc(host, livekitPackage, rpcOptions);\n }\n\n /**\n * Initiate an outbound WhatsApp call\n *\n * @param options - WhatsApp call options\n * @returns Promise containing the WhatsApp call ID and room name\n */\n async dialWhatsAppCall(options: DialWhatsAppCallOptions): Promise<DialWhatsAppCallResponse> {\n const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';\n const roomName = options.roomName || '';\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new DialWhatsAppCallRequest({\n whatsappPhoneNumberId: options.whatsappPhoneNumberId,\n whatsappToPhoneNumber: options.whatsappToPhoneNumber,\n whatsappApiKey: options.whatsappApiKey,\n whatsappCloudApiVersion: options.whatsappCloudApiVersion,\n whatsappBizOpaqueCallbackData,\n roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'DialWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return DialWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Accept an inbound WhatsApp call\n *\n * @param options - WhatsApp call accept options\n * @returns Promise containing the room name\n */\n async acceptWhatsAppCall(\n options: AcceptWhatsAppCallOptions,\n ): Promise<AcceptWhatsAppCallResponse> {\n const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';\n const roomName = options.roomName || '';\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new AcceptWhatsAppCallRequest({\n whatsappPhoneNumberId: options.whatsappPhoneNumberId,\n whatsappApiKey: options.whatsappApiKey,\n whatsappCloudApiVersion: options.whatsappCloudApiVersion,\n whatsappCallId: options.whatsappCallId,\n whatsappBizOpaqueCallbackData,\n sdp: options.sdp,\n roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'AcceptWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return AcceptWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Connect an established WhatsApp call (used for business-initiated calls)\n *\n * @param whatsappCallId - Call ID sent by Meta\n * @param sdp - Session description from Meta\n */\n async connectWhatsAppCall(\n whatsappCallId: string,\n sdp: SessionDescription,\n ): Promise<ConnectWhatsAppCallResponse> {\n const req = new ConnectWhatsAppCallRequest({\n whatsappCallId,\n sdp,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'ConnectWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return ConnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Disconnect an active WhatsApp call\n *\n * @param whatsappCallId - Call ID sent by Meta\n * @param whatsappApiKey - The API key of the business that is disconnecting the call\n */\n async disconnectWhatsAppCall(\n whatsappCallId: string,\n whatsappApiKey: string,\n ): Promise<DisconnectWhatsAppCallResponse> {\n const req = new DisconnectWhatsAppCallRequest({\n whatsappCallId,\n whatsappApiKey,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'DisconnectWhatsAppCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return DisconnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Connect a Twilio call to a LiveKit room\n *\n * @param options - Twilio call connection options\n * @returns Promise containing the WebSocket connect URL for Twilio media stream\n */\n async connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse> {\n const participantIdentity = options.participantIdentity || '';\n const participantName = options.participantName || '';\n const participantMetadata = options.participantMetadata || '';\n const destinationCountry = options.destinationCountry || '';\n\n const req = new ConnectTwilioCallRequest({\n twilioCallDirection: options.twilioCallDirection,\n roomName: options.roomName,\n agents: options.agents,\n participantIdentity,\n participantName,\n participantMetadata,\n participantAttributes: options.participantAttributes,\n destinationCountry,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'ConnectTwilioCall',\n req,\n await this.authHeader({ roomCreate: true }),\n );\n return ConnectTwilioCallResponse.fromJson(data, { ignoreUnknownFields: true });\n }\n}\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,mBAAmB;AAC5B,SAAmB,UAAU,sBAAsB;AAEnD,MAAM,MAAM;AAkFL,MAAM,wBAAwB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS/C,YAAY,MAAc,QAAiB,QAAiB,SAAyB;AACnF,UAAM,QAAQ,MAAM;AACpB,UAAM,cAAa,mCAAS,kBACxB,EAAE,gBAAgB,QAAQ,eAAe,IACzC;AACJ,SAAK,MAAM,IAAI,SAAS,MAAM,gBAAgB,UAAU;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,SAAqE;AAC1F,UAAM,gCAAgC,QAAQ,iCAAiC;AAC/E,UAAM,WAAW,QAAQ,YAAY;AACrC,UAAM,sBAAsB,QAAQ,uBAAuB;AAC3D,UAAM,kBAAkB,QAAQ,mBAAmB;AACnD,UAAM,sBAAsB,QAAQ,uBAAuB;AAC3D,UAAM,qBAAqB,QAAQ,sBAAsB;AAEzD,UAAM,MAAM,IAAI,wBAAwB;AAAA,MACtC,uBAAuB,QAAQ;AAAA,MAC/B,uBAAuB,QAAQ;AAAA,MAC/B,gBAAgB,QAAQ;AAAA,MACxB,yBAAyB,QAAQ;AAAA,MACjC;AAAA,MACA;AAAA,MACA,QAAQ,QAAQ;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA,uBAA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index.cjs CHANGED
@@ -19,14 +19,20 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ AcceptWhatsAppCallResponse: () => import_protocol.AcceptWhatsAppCallResponse,
22
23
  AgentDispatch: () => import_protocol.AgentDispatch,
23
24
  AliOSSUpload: () => import_protocol.AliOSSUpload,
24
25
  AudioCodec: () => import_protocol.AudioCodec,
25
26
  AutoParticipantEgress: () => import_protocol.AutoParticipantEgress,
26
27
  AutoTrackEgress: () => import_protocol.AutoTrackEgress,
27
28
  AzureBlobUpload: () => import_protocol.AzureBlobUpload,
29
+ ConnectTwilioCallRequest_TwilioCallDirection: () => import_protocol.ConnectTwilioCallRequest_TwilioCallDirection,
30
+ ConnectTwilioCallResponse: () => import_protocol.ConnectTwilioCallResponse,
31
+ ConnectWhatsAppCallResponse: () => import_protocol.ConnectWhatsAppCallResponse,
28
32
  DataPacket_Kind: () => import_protocol.DataPacket_Kind,
33
+ DialWhatsAppCallResponse: () => import_protocol.DialWhatsAppCallResponse,
29
34
  DirectFileOutput: () => import_protocol.DirectFileOutput,
35
+ DisconnectWhatsAppCallResponse: () => import_protocol.DisconnectWhatsAppCallResponse,
30
36
  EgressInfo: () => import_protocol.EgressInfo,
31
37
  EgressStatus: () => import_protocol.EgressStatus,
32
38
  EncodedFileOutput: () => import_protocol.EncodedFileOutput,
@@ -67,6 +73,7 @@ __export(index_exports, {
67
73
  SIPTrunkInfo: () => import_protocol.SIPTrunkInfo,
68
74
  SegmentedFileOutput: () => import_protocol.SegmentedFileOutput,
69
75
  SegmentedFileProtocol: () => import_protocol.SegmentedFileProtocol,
76
+ SessionDescription: () => import_protocol.SessionDescription,
70
77
  StreamOutput: () => import_protocol.StreamOutput,
71
78
  StreamProtocol: () => import_protocol.StreamProtocol,
72
79
  TrackCompositeEgressRequest: () => import_protocol.TrackCompositeEgressRequest,
@@ -83,6 +90,7 @@ module.exports = __toCommonJS(index_exports);
83
90
  var import_protocol = require("@livekit/protocol");
84
91
  __reExport(index_exports, require("./AccessToken.cjs"), module.exports);
85
92
  __reExport(index_exports, require("./AgentDispatchClient.cjs"), module.exports);
93
+ __reExport(index_exports, require("./ConnectorClient.cjs"), module.exports);
86
94
  __reExport(index_exports, require("./EgressClient.cjs"), module.exports);
87
95
  __reExport(index_exports, require("./grants.cjs"), module.exports);
88
96
  __reExport(index_exports, require("./IngressClient.cjs"), module.exports);
@@ -92,14 +100,20 @@ var import_TwirpRPC = require("./TwirpRPC.cjs");
92
100
  __reExport(index_exports, require("./WebhookReceiver.cjs"), module.exports);
93
101
  // Annotate the CommonJS export names for ESM import in node:
94
102
  0 && (module.exports = {
103
+ AcceptWhatsAppCallResponse,
95
104
  AgentDispatch,
96
105
  AliOSSUpload,
97
106
  AudioCodec,
98
107
  AutoParticipantEgress,
99
108
  AutoTrackEgress,
100
109
  AzureBlobUpload,
110
+ ConnectTwilioCallRequest_TwilioCallDirection,
111
+ ConnectTwilioCallResponse,
112
+ ConnectWhatsAppCallResponse,
101
113
  DataPacket_Kind,
114
+ DialWhatsAppCallResponse,
102
115
  DirectFileOutput,
116
+ DisconnectWhatsAppCallResponse,
103
117
  EgressInfo,
104
118
  EgressStatus,
105
119
  EncodedFileOutput,
@@ -140,6 +154,7 @@ __reExport(index_exports, require("./WebhookReceiver.cjs"), module.exports);
140
154
  SIPTrunkInfo,
141
155
  SegmentedFileOutput,
142
156
  SegmentedFileProtocol,
157
+ SessionDescription,
143
158
  StreamOutput,
144
159
  StreamProtocol,
145
160
  TrackCompositeEgressRequest,
@@ -153,6 +168,7 @@ __reExport(index_exports, require("./WebhookReceiver.cjs"), module.exports);
153
168
  WebhookConfig,
154
169
  ...require("./AccessToken.cjs"),
155
170
  ...require("./AgentDispatchClient.cjs"),
171
+ ...require("./ConnectorClient.cjs"),
156
172
  ...require("./EgressClient.cjs"),
157
173
  ...require("./grants.cjs"),
158
174
  ...require("./IngressClient.cjs"),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AgentDispatch,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomConfiguration,\n RoomEgress,\n S3Upload,\n SIPDispatchRule,\n SIPDispatchRuleInfo,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPParticipantInfo,\n SIPOutboundTrunkInfo,\n SIPInboundTrunkInfo,\n SIPTrunkInfo,\n SIPCallStatus,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport { TwirpError } from './TwirpRPC.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBA2DO;AACP,0BAAc,6BAhEd;AAiEA,0BAAc,qCAjEd;AAkEA,0BAAc,8BAlEd;AAmEA,0BAAc,wBAnEd;AAoEA,0BAAc,+BApEd;AAqEA,0BAAc,mCArEd;AAsEA,0BAAc,2BAtEd;AAuEA,sBAA2B;AAC3B,0BAAc,iCAxEd;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AcceptWhatsAppCallResponse,\n AliOSSUpload,\n AgentDispatch,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n ConnectTwilioCallRequest_TwilioCallDirection,\n ConnectTwilioCallResponse,\n ConnectWhatsAppCallResponse,\n DataPacket_Kind,\n DialWhatsAppCallResponse,\n DirectFileOutput,\n DisconnectWhatsAppCallResponse,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomConfiguration,\n RoomEgress,\n S3Upload,\n SessionDescription,\n SIPDispatchRule,\n SIPDispatchRuleInfo,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPParticipantInfo,\n SIPOutboundTrunkInfo,\n SIPInboundTrunkInfo,\n SIPTrunkInfo,\n SIPCallStatus,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './ConnectorClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport { TwirpError } from './TwirpRPC.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAkEO;AACP,0BAAc,6BAvEd;AAwEA,0BAAc,qCAxEd;AAyEA,0BAAc,iCAzEd;AA0EA,0BAAc,8BA1Ed;AA2EA,0BAAc,wBA3Ed;AA4EA,0BAAc,+BA5Ed;AA6EA,0BAAc,mCA7Ed;AA8EA,0BAAc,2BA9Ed;AA+EA,sBAA2B;AAC3B,0BAAc,iCAhFd;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
- export { AgentDispatch, AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomConfiguration, RoomEgress, S3Upload, SIPCallStatus, SIPDispatchRule, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, SIPDispatchRuleInfo, SIPInboundTrunkInfo, SIPOutboundTrunkInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, VideoCodec, WebEgressRequest, WebhookConfig } from '@livekit/protocol';
1
+ export { AcceptWhatsAppCallResponse, AgentDispatch, AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, ConnectTwilioCallRequest_TwilioCallDirection, ConnectTwilioCallResponse, ConnectWhatsAppCallResponse, DataPacket_Kind, DialWhatsAppCallResponse, DirectFileOutput, DisconnectWhatsAppCallResponse, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomConfiguration, RoomEgress, S3Upload, SIPCallStatus, SIPDispatchRule, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, SIPDispatchRuleInfo, SIPInboundTrunkInfo, SIPOutboundTrunkInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, SessionDescription, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, VideoCodec, WebEgressRequest, WebhookConfig } from '@livekit/protocol';
2
2
  export { AccessToken, AccessTokenOptions, TokenVerifier } from './AccessToken.cjs';
3
3
  export { AgentDispatchClient } from './AgentDispatchClient.cjs';
4
+ export { AcceptWhatsAppCallOptions, ConnectTwilioCallOptions, ConnectorClient, DialWhatsAppCallOptions } from './ConnectorClient.cjs';
4
5
  export { BaseOptions, EgressClient, EncodedOutputs, ListEgressOptions, ParticipantEgressOptions, RoomCompositeOptions, TrackCompositeOptions, WebOptions } from './EgressClient.cjs';
5
6
  export { ClaimGrants, InferenceGrant, ObservabilityGrant, SIPGrant, VideoGrant, claimsToJwtPayload, trackSourceToString } from './grants.cjs';
6
7
  export { CreateIngressOptions, IngressClient, ListIngressOptions, UpdateIngressOptions } from './IngressClient.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { AliOSSUpload, AgentDispatch, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomConfiguration, RoomEgress, S3Upload, SIPDispatchRule, SIPDispatchRuleInfo, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, SIPParticipantInfo, SIPOutboundTrunkInfo, SIPInboundTrunkInfo, SIPTrunkInfo, SIPCallStatus, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, WebEgressRequest, VideoCodec, WebhookConfig, } from '@livekit/protocol';
1
+ export { AcceptWhatsAppCallResponse, AliOSSUpload, AgentDispatch, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, ConnectTwilioCallRequest_TwilioCallDirection, ConnectTwilioCallResponse, ConnectWhatsAppCallResponse, DataPacket_Kind, DialWhatsAppCallResponse, DirectFileOutput, DisconnectWhatsAppCallResponse, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomConfiguration, RoomEgress, S3Upload, SessionDescription, SIPDispatchRule, SIPDispatchRuleInfo, SIPDispatchRuleDirect, SIPDispatchRuleIndividual, SIPParticipantInfo, SIPOutboundTrunkInfo, SIPInboundTrunkInfo, SIPTrunkInfo, SIPCallStatus, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, WebEgressRequest, VideoCodec, WebhookConfig, } from '@livekit/protocol';
2
2
  export * from './AccessToken.js';
3
3
  export * from './AgentDispatchClient.js';
4
+ export * from './ConnectorClient.js';
4
5
  export * from './EgressClient.js';
5
6
  export * from './grants.js';
6
7
  export * from './IngressClient.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,4CAA4C,EAC5C,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,8BAA8B,EAC9B,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,12 +1,18 @@
1
1
  import {
2
+ AcceptWhatsAppCallResponse,
2
3
  AliOSSUpload,
3
4
  AgentDispatch,
4
5
  AudioCodec,
5
6
  AutoParticipantEgress,
6
7
  AutoTrackEgress,
7
8
  AzureBlobUpload,
9
+ ConnectTwilioCallRequest_TwilioCallDirection,
10
+ ConnectTwilioCallResponse,
11
+ ConnectWhatsAppCallResponse,
8
12
  DataPacket_Kind,
13
+ DialWhatsAppCallResponse,
9
14
  DirectFileOutput,
15
+ DisconnectWhatsAppCallResponse,
10
16
  EgressInfo,
11
17
  EgressStatus,
12
18
  EncodedFileOutput,
@@ -36,6 +42,7 @@ import {
36
42
  RoomConfiguration,
37
43
  RoomEgress,
38
44
  S3Upload,
45
+ SessionDescription,
39
46
  SIPDispatchRule,
40
47
  SIPDispatchRuleInfo,
41
48
  SIPDispatchRuleDirect,
@@ -60,6 +67,7 @@ import {
60
67
  } from "@livekit/protocol";
61
68
  export * from "./AccessToken.js";
62
69
  export * from "./AgentDispatchClient.js";
70
+ export * from "./ConnectorClient.js";
63
71
  export * from "./EgressClient.js";
64
72
  export * from "./grants.js";
65
73
  export * from "./IngressClient.js";
@@ -68,14 +76,20 @@ export * from "./SipClient.js";
68
76
  import { TwirpError } from "./TwirpRPC.js";
69
77
  export * from "./WebhookReceiver.js";
70
78
  export {
79
+ AcceptWhatsAppCallResponse,
71
80
  AgentDispatch,
72
81
  AliOSSUpload,
73
82
  AudioCodec,
74
83
  AutoParticipantEgress,
75
84
  AutoTrackEgress,
76
85
  AzureBlobUpload,
86
+ ConnectTwilioCallRequest_TwilioCallDirection,
87
+ ConnectTwilioCallResponse,
88
+ ConnectWhatsAppCallResponse,
77
89
  DataPacket_Kind,
90
+ DialWhatsAppCallResponse,
78
91
  DirectFileOutput,
92
+ DisconnectWhatsAppCallResponse,
79
93
  EgressInfo,
80
94
  EgressStatus,
81
95
  EncodedFileOutput,
@@ -116,6 +130,7 @@ export {
116
130
  SIPTrunkInfo,
117
131
  SegmentedFileOutput,
118
132
  SegmentedFileProtocol,
133
+ SessionDescription,
119
134
  StreamOutput,
120
135
  StreamProtocol,
121
136
  TrackCompositeEgressRequest,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AgentDispatch,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomConfiguration,\n RoomEgress,\n S3Upload,\n SIPDispatchRule,\n SIPDispatchRuleInfo,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPParticipantInfo,\n SIPOutboundTrunkInfo,\n SIPInboundTrunkInfo,\n SIPTrunkInfo,\n SIPCallStatus,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport { TwirpError } from './TwirpRPC.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,kBAAkB;AAC3B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AcceptWhatsAppCallResponse,\n AliOSSUpload,\n AgentDispatch,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n ConnectTwilioCallRequest_TwilioCallDirection,\n ConnectTwilioCallResponse,\n ConnectWhatsAppCallResponse,\n DataPacket_Kind,\n DialWhatsAppCallResponse,\n DirectFileOutput,\n DisconnectWhatsAppCallResponse,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomConfiguration,\n RoomEgress,\n S3Upload,\n SessionDescription,\n SIPDispatchRule,\n SIPDispatchRuleInfo,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPParticipantInfo,\n SIPOutboundTrunkInfo,\n SIPInboundTrunkInfo,\n SIPTrunkInfo,\n SIPCallStatus,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './ConnectorClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport { TwirpError } from './TwirpRPC.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,kBAAkB;AAC3B,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "livekit-server-sdk",
3
- "version": "2.14.2",
3
+ "version": "2.15.0",
4
4
  "description": "Server-side SDK for LiveKit",
5
5
  "main": "dist/index.js",
6
6
  "require": "dist/index.cjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/livekit/server-sdk-js.git"
10
+ "url": "https://github.com/livekit/node-sdks.git",
11
+ "directory": "packages/livekit-server-sdk"
11
12
  },
12
13
  "author": "David Zhao <david@davidzhao.com>",
13
14
  "license": "Apache-2.0",
@@ -30,7 +31,7 @@
30
31
  ],
31
32
  "dependencies": {
32
33
  "@bufbuild/protobuf": "^1.10.1",
33
- "@livekit/protocol": "^1.42.0",
34
+ "@livekit/protocol": "^1.43.1",
34
35
  "camelcase-keys": "^9.0.0",
35
36
  "jose": "^5.1.2"
36
37
  },
@@ -0,0 +1,282 @@
1
+ // SPDX-FileCopyrightText: 2025 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import type {
5
+ ConnectTwilioCallRequest_TwilioCallDirection,
6
+ RoomAgentDispatch,
7
+ SessionDescription,
8
+ } from '@livekit/protocol';
9
+ import {
10
+ AcceptWhatsAppCallRequest,
11
+ AcceptWhatsAppCallResponse,
12
+ ConnectTwilioCallRequest,
13
+ ConnectTwilioCallResponse,
14
+ ConnectWhatsAppCallRequest,
15
+ ConnectWhatsAppCallResponse,
16
+ DialWhatsAppCallRequest,
17
+ DialWhatsAppCallResponse,
18
+ DisconnectWhatsAppCallRequest,
19
+ DisconnectWhatsAppCallResponse,
20
+ } from '@livekit/protocol';
21
+ import type { ClientOptions } from './ClientOptions.js';
22
+ import { ServiceBase } from './ServiceBase.js';
23
+ import { type Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';
24
+
25
+ const svc = 'Connector';
26
+
27
+ // WhatsApp types
28
+ export interface DialWhatsAppCallOptions {
29
+ /** Required - The identifier of the WhatsApp phone number that is initiating the call */
30
+ whatsappPhoneNumberId: string;
31
+ /** Required - The number of the user that is supposed to receive the call */
32
+ whatsappToPhoneNumber: string;
33
+ /** Required - The API key of the business that is initiating the call */
34
+ whatsappApiKey: string;
35
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
36
+ whatsappCloudApiVersion: string;
37
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
38
+ whatsappBizOpaqueCallbackData?: string;
39
+ /** Optional - What LiveKit room should this participant be connected to */
40
+ roomName?: string;
41
+ /** Optional - Agents to dispatch the call to */
42
+ agents?: RoomAgentDispatch[];
43
+ /** Optional - Identity of the participant in LiveKit room */
44
+ participantIdentity?: string;
45
+ /** Optional - Name of the participant in LiveKit room */
46
+ participantName?: string;
47
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
48
+ participantMetadata?: string;
49
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
50
+ participantAttributes?: { [key: string]: string };
51
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
52
+ destinationCountry?: string;
53
+ }
54
+
55
+ export interface AcceptWhatsAppCallOptions {
56
+ /** Required - The identifier of the WhatsApp phone number that is connecting the call */
57
+ whatsappPhoneNumberId: string;
58
+ /** Required - The API key of the business that is connecting the call */
59
+ whatsappApiKey: string;
60
+ /** Required - WhatsApp Cloud API version, eg: 23.0, 24.0, etc. */
61
+ whatsappCloudApiVersion: string;
62
+ /** Required - Call ID sent by Meta */
63
+ whatsappCallId: string;
64
+ /** Optional - An arbitrary string you can pass in that is useful for tracking and logging purposes */
65
+ whatsappBizOpaqueCallbackData?: string;
66
+ /** Required - The call accept webhook comes with SDP from Meta */
67
+ sdp: SessionDescription;
68
+ /** Optional - What LiveKit room should this participant be connected to */
69
+ roomName?: string;
70
+ /** Optional - Agents to dispatch the call to */
71
+ agents?: RoomAgentDispatch[];
72
+ /** Optional - Identity of the participant in LiveKit room */
73
+ participantIdentity?: string;
74
+ /** Optional - Name of the participant in LiveKit room */
75
+ participantName?: string;
76
+ /** Optional - User-defined metadata. Will be attached to a created Participant in the room. */
77
+ participantMetadata?: string;
78
+ /** Optional - User-defined attributes. Will be attached to a created Participant in the room. */
79
+ participantAttributes?: { [key: string]: string };
80
+ /** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
81
+ destinationCountry?: string;
82
+ }
83
+
84
+ // Twilio types
85
+ export interface ConnectTwilioCallOptions {
86
+ /** The direction of the call */
87
+ twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;
88
+ /** What LiveKit room should this call be connected to */
89
+ roomName: string;
90
+ /** Optional agents to dispatch the call to */
91
+ agents?: RoomAgentDispatch[];
92
+ /** Optional identity of the participant in LiveKit room */
93
+ participantIdentity?: string;
94
+ /** Optional name of the participant in LiveKit room */
95
+ participantName?: string;
96
+ /** Optional user-defined metadata. Will be attached to a created Participant in the room. */
97
+ participantMetadata?: string;
98
+ /** Optional user-defined attributes. Will be attached to a created Participant in the room. */
99
+ participantAttributes?: { [key: string]: string };
100
+ /** Country where the call terminates as ISO 3166-1 alpha-2 */
101
+ destinationCountry?: string;
102
+ }
103
+
104
+ /**
105
+ * Client to access Connector APIs for WhatsApp and Twilio integrations
106
+ */
107
+ export class ConnectorClient extends ServiceBase {
108
+ private readonly rpc: Rpc;
109
+
110
+ /**
111
+ * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
112
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
113
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
114
+ * @param options - client options
115
+ */
116
+ constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions) {
117
+ super(apiKey, secret);
118
+ const rpcOptions = options?.requestTimeout
119
+ ? { requestTimeout: options.requestTimeout }
120
+ : undefined;
121
+ this.rpc = new TwirpRpc(host, livekitPackage, rpcOptions);
122
+ }
123
+
124
+ /**
125
+ * Initiate an outbound WhatsApp call
126
+ *
127
+ * @param options - WhatsApp call options
128
+ * @returns Promise containing the WhatsApp call ID and room name
129
+ */
130
+ async dialWhatsAppCall(options: DialWhatsAppCallOptions): Promise<DialWhatsAppCallResponse> {
131
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';
132
+ const roomName = options.roomName || '';
133
+ const participantIdentity = options.participantIdentity || '';
134
+ const participantName = options.participantName || '';
135
+ const participantMetadata = options.participantMetadata || '';
136
+ const destinationCountry = options.destinationCountry || '';
137
+
138
+ const req = new DialWhatsAppCallRequest({
139
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
140
+ whatsappToPhoneNumber: options.whatsappToPhoneNumber,
141
+ whatsappApiKey: options.whatsappApiKey,
142
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
143
+ whatsappBizOpaqueCallbackData,
144
+ roomName,
145
+ agents: options.agents,
146
+ participantIdentity,
147
+ participantName,
148
+ participantMetadata,
149
+ participantAttributes: options.participantAttributes,
150
+ destinationCountry,
151
+ }).toJson();
152
+
153
+ const data = await this.rpc.request(
154
+ svc,
155
+ 'DialWhatsAppCall',
156
+ req,
157
+ await this.authHeader({ roomCreate: true }),
158
+ );
159
+ return DialWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
160
+ }
161
+
162
+ /**
163
+ * Accept an inbound WhatsApp call
164
+ *
165
+ * @param options - WhatsApp call accept options
166
+ * @returns Promise containing the room name
167
+ */
168
+ async acceptWhatsAppCall(
169
+ options: AcceptWhatsAppCallOptions,
170
+ ): Promise<AcceptWhatsAppCallResponse> {
171
+ const whatsappBizOpaqueCallbackData = options.whatsappBizOpaqueCallbackData || '';
172
+ const roomName = options.roomName || '';
173
+ const participantIdentity = options.participantIdentity || '';
174
+ const participantName = options.participantName || '';
175
+ const participantMetadata = options.participantMetadata || '';
176
+ const destinationCountry = options.destinationCountry || '';
177
+
178
+ const req = new AcceptWhatsAppCallRequest({
179
+ whatsappPhoneNumberId: options.whatsappPhoneNumberId,
180
+ whatsappApiKey: options.whatsappApiKey,
181
+ whatsappCloudApiVersion: options.whatsappCloudApiVersion,
182
+ whatsappCallId: options.whatsappCallId,
183
+ whatsappBizOpaqueCallbackData,
184
+ sdp: options.sdp,
185
+ roomName,
186
+ agents: options.agents,
187
+ participantIdentity,
188
+ participantName,
189
+ participantMetadata,
190
+ participantAttributes: options.participantAttributes,
191
+ destinationCountry,
192
+ }).toJson();
193
+
194
+ const data = await this.rpc.request(
195
+ svc,
196
+ 'AcceptWhatsAppCall',
197
+ req,
198
+ await this.authHeader({ roomCreate: true }),
199
+ );
200
+ return AcceptWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
201
+ }
202
+
203
+ /**
204
+ * Connect an established WhatsApp call (used for business-initiated calls)
205
+ *
206
+ * @param whatsappCallId - Call ID sent by Meta
207
+ * @param sdp - Session description from Meta
208
+ */
209
+ async connectWhatsAppCall(
210
+ whatsappCallId: string,
211
+ sdp: SessionDescription,
212
+ ): Promise<ConnectWhatsAppCallResponse> {
213
+ const req = new ConnectWhatsAppCallRequest({
214
+ whatsappCallId,
215
+ sdp,
216
+ }).toJson();
217
+
218
+ const data = await this.rpc.request(
219
+ svc,
220
+ 'ConnectWhatsAppCall',
221
+ req,
222
+ await this.authHeader({ roomCreate: true }),
223
+ );
224
+ return ConnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
225
+ }
226
+
227
+ /**
228
+ * Disconnect an active WhatsApp call
229
+ *
230
+ * @param whatsappCallId - Call ID sent by Meta
231
+ * @param whatsappApiKey - The API key of the business that is disconnecting the call
232
+ */
233
+ async disconnectWhatsAppCall(
234
+ whatsappCallId: string,
235
+ whatsappApiKey: string,
236
+ ): Promise<DisconnectWhatsAppCallResponse> {
237
+ const req = new DisconnectWhatsAppCallRequest({
238
+ whatsappCallId,
239
+ whatsappApiKey,
240
+ }).toJson();
241
+
242
+ const data = await this.rpc.request(
243
+ svc,
244
+ 'DisconnectWhatsAppCall',
245
+ req,
246
+ await this.authHeader({ roomCreate: true }),
247
+ );
248
+ return DisconnectWhatsAppCallResponse.fromJson(data, { ignoreUnknownFields: true });
249
+ }
250
+
251
+ /**
252
+ * Connect a Twilio call to a LiveKit room
253
+ *
254
+ * @param options - Twilio call connection options
255
+ * @returns Promise containing the WebSocket connect URL for Twilio media stream
256
+ */
257
+ async connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse> {
258
+ const participantIdentity = options.participantIdentity || '';
259
+ const participantName = options.participantName || '';
260
+ const participantMetadata = options.participantMetadata || '';
261
+ const destinationCountry = options.destinationCountry || '';
262
+
263
+ const req = new ConnectTwilioCallRequest({
264
+ twilioCallDirection: options.twilioCallDirection,
265
+ roomName: options.roomName,
266
+ agents: options.agents,
267
+ participantIdentity,
268
+ participantName,
269
+ participantMetadata,
270
+ participantAttributes: options.participantAttributes,
271
+ destinationCountry,
272
+ }).toJson();
273
+
274
+ const data = await this.rpc.request(
275
+ svc,
276
+ 'ConnectTwilioCall',
277
+ req,
278
+ await this.authHeader({ roomCreate: true }),
279
+ );
280
+ return ConnectTwilioCallResponse.fromJson(data, { ignoreUnknownFields: true });
281
+ }
282
+ }
package/src/index.ts CHANGED
@@ -3,14 +3,20 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
5
  export {
6
+ AcceptWhatsAppCallResponse,
6
7
  AliOSSUpload,
7
8
  AgentDispatch,
8
9
  AudioCodec,
9
10
  AutoParticipantEgress,
10
11
  AutoTrackEgress,
11
12
  AzureBlobUpload,
13
+ ConnectTwilioCallRequest_TwilioCallDirection,
14
+ ConnectTwilioCallResponse,
15
+ ConnectWhatsAppCallResponse,
12
16
  DataPacket_Kind,
17
+ DialWhatsAppCallResponse,
13
18
  DirectFileOutput,
19
+ DisconnectWhatsAppCallResponse,
14
20
  EgressInfo,
15
21
  EgressStatus,
16
22
  EncodedFileOutput,
@@ -40,6 +46,7 @@ export {
40
46
  RoomConfiguration,
41
47
  RoomEgress,
42
48
  S3Upload,
49
+ SessionDescription,
43
50
  SIPDispatchRule,
44
51
  SIPDispatchRuleInfo,
45
52
  SIPDispatchRuleDirect,
@@ -64,6 +71,7 @@ export {
64
71
  } from '@livekit/protocol';
65
72
  export * from './AccessToken.js';
66
73
  export * from './AgentDispatchClient.js';
74
+ export * from './ConnectorClient.js';
67
75
  export * from './EgressClient.js';
68
76
  export * from './grants.js';
69
77
  export * from './IngressClient.js';