livekit-server-sdk 2.14.2 → 2.15.1
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.
- package/dist/AccessToken.cjs +1 -1
- package/dist/AccessToken.cjs.map +1 -1
- package/dist/AccessToken.d.ts +9 -6
- package/dist/AccessToken.js +1 -1
- package/dist/AccessToken.js.map +1 -1
- package/dist/AgentDispatchClient.d.ts +7 -4
- package/dist/ClientOptions.d.ts +3 -2
- package/dist/ConnectorClient.cjs +183 -0
- package/dist/ConnectorClient.cjs.map +1 -0
- package/dist/ConnectorClient.d.cts +134 -0
- package/dist/ConnectorClient.d.ts +134 -0
- package/dist/ConnectorClient.d.ts.map +1 -0
- package/dist/ConnectorClient.js +170 -0
- package/dist/ConnectorClient.js.map +1 -0
- package/dist/EgressClient.d.ts +15 -12
- package/dist/IngressClient.d.ts +11 -8
- package/dist/RoomServiceClient.d.ts +11 -8
- package/dist/ServiceBase.d.ts +7 -3
- package/dist/SipClient.cjs +2 -1
- package/dist/SipClient.cjs.map +1 -1
- package/dist/SipClient.d.cts +2 -0
- package/dist/SipClient.d.ts +23 -18
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +2 -1
- package/dist/SipClient.js.map +1 -1
- package/dist/TwirpRPC.d.ts +8 -7
- package/dist/WebhookReceiver.d.ts +9 -7
- package/dist/crypto/digest.d.ts +3 -2
- package/dist/crypto/uuid.d.ts +3 -2
- package/dist/grants.d.ts +12 -11
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +14 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/AccessToken.test.ts +1 -3
- package/src/AccessToken.ts +1 -1
- package/src/ConnectorClient.ts +282 -0
- package/src/SipClient.ts +5 -0
- package/src/index.ts +8 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { RoomAgentDispatch, SessionDescription, ConnectTwilioCallRequest_TwilioCallDirection, DialWhatsAppCallResponse, AcceptWhatsAppCallResponse, ConnectWhatsAppCallResponse, DisconnectWhatsAppCallResponse, ConnectTwilioCallResponse } from '@livekit/protocol';
|
|
2
|
+
import { ClientOptions } from './ClientOptions.js';
|
|
3
|
+
import { ServiceBase } from './ServiceBase.js';
|
|
4
|
+
import './grants.js';
|
|
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 @@
|
|
|
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,uBA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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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M,MAAM,IAAI,yBAAyB;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,0BAA0B,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EAC/E;AACF;","names":[]}
|
package/dist/EgressClient.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { ClientOptions } from './ClientOptions.js';
|
|
1
|
+
import { WebhookConfig, EncodingOptionsPreset, EncodingOptions, AudioMixing, EncodedFileOutput, StreamOutput, SegmentedFileOutput, ImageOutput, EgressInfo, DirectFileOutput } from '@livekit/protocol';
|
|
2
|
+
import { ClientOptions } from './ClientOptions.js';
|
|
4
3
|
import { ServiceBase } from './ServiceBase.js';
|
|
5
|
-
|
|
4
|
+
import './grants.js';
|
|
5
|
+
import 'jose';
|
|
6
|
+
|
|
7
|
+
interface BaseOptions {
|
|
6
8
|
/**
|
|
7
9
|
* webhooks to call for this request, optional.
|
|
8
10
|
*/
|
|
9
11
|
webhooks?: WebhookConfig[];
|
|
10
12
|
}
|
|
11
|
-
|
|
13
|
+
interface RoomCompositeOptions extends BaseOptions {
|
|
12
14
|
/**
|
|
13
15
|
* egress layout. optional
|
|
14
16
|
*/
|
|
@@ -34,7 +36,7 @@ export interface RoomCompositeOptions extends BaseOptions {
|
|
|
34
36
|
*/
|
|
35
37
|
audioMixing?: AudioMixing;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
interface WebOptions extends BaseOptions {
|
|
38
40
|
/**
|
|
39
41
|
* encoding options or preset. optional
|
|
40
42
|
*/
|
|
@@ -52,7 +54,7 @@ export interface WebOptions extends BaseOptions {
|
|
|
52
54
|
*/
|
|
53
55
|
awaitStartSignal?: boolean;
|
|
54
56
|
}
|
|
55
|
-
|
|
57
|
+
interface ParticipantEgressOptions extends BaseOptions {
|
|
56
58
|
/**
|
|
57
59
|
* true to capture source screenshare and screenshare_audio
|
|
58
60
|
* false to capture camera and microphone
|
|
@@ -63,7 +65,7 @@ export interface ParticipantEgressOptions extends BaseOptions {
|
|
|
63
65
|
*/
|
|
64
66
|
encodingOptions?: EncodingOptionsPreset | EncodingOptions;
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
interface TrackCompositeOptions extends BaseOptions {
|
|
67
69
|
/**
|
|
68
70
|
* audio track ID
|
|
69
71
|
*/
|
|
@@ -80,13 +82,13 @@ export interface TrackCompositeOptions extends BaseOptions {
|
|
|
80
82
|
/**
|
|
81
83
|
* Used to supply multiple outputs with an egress request
|
|
82
84
|
*/
|
|
83
|
-
|
|
85
|
+
interface EncodedOutputs {
|
|
84
86
|
file?: EncodedFileOutput | undefined;
|
|
85
87
|
stream?: StreamOutput | undefined;
|
|
86
88
|
segments?: SegmentedFileOutput | undefined;
|
|
87
89
|
images?: ImageOutput | undefined;
|
|
88
90
|
}
|
|
89
|
-
|
|
91
|
+
interface ListEgressOptions {
|
|
90
92
|
roomName?: string;
|
|
91
93
|
egressId?: string;
|
|
92
94
|
active?: boolean;
|
|
@@ -94,7 +96,7 @@ export interface ListEgressOptions {
|
|
|
94
96
|
/**
|
|
95
97
|
* Client to access Egress APIs
|
|
96
98
|
*/
|
|
97
|
-
|
|
99
|
+
declare class EgressClient extends ServiceBase {
|
|
98
100
|
private readonly rpc;
|
|
99
101
|
/**
|
|
100
102
|
* @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
|
|
@@ -174,4 +176,5 @@ export declare class EgressClient extends ServiceBase {
|
|
|
174
176
|
*/
|
|
175
177
|
stopEgress(egressId: string): Promise<EgressInfo>;
|
|
176
178
|
}
|
|
177
|
-
|
|
179
|
+
|
|
180
|
+
export { type BaseOptions, EgressClient, type EncodedOutputs, type ListEgressOptions, type ParticipantEgressOptions, type RoomCompositeOptions, type TrackCompositeOptions, type WebOptions };
|
package/dist/IngressClient.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { ClientOptions } from './ClientOptions.js';
|
|
1
|
+
import { IngressAudioOptions, IngressVideoOptions, IngressInput, IngressInfo } from '@livekit/protocol';
|
|
2
|
+
import { ClientOptions } from './ClientOptions.js';
|
|
4
3
|
import { ServiceBase } from './ServiceBase.js';
|
|
5
|
-
|
|
4
|
+
import './grants.js';
|
|
5
|
+
import 'jose';
|
|
6
|
+
|
|
7
|
+
interface CreateIngressOptions {
|
|
6
8
|
/**
|
|
7
9
|
* ingress name. optional
|
|
8
10
|
*/
|
|
@@ -46,7 +48,7 @@ export interface CreateIngressOptions {
|
|
|
46
48
|
*/
|
|
47
49
|
video?: IngressVideoOptions;
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
interface UpdateIngressOptions {
|
|
50
52
|
/**
|
|
51
53
|
* ingress name. optional
|
|
52
54
|
*/
|
|
@@ -86,7 +88,7 @@ export interface UpdateIngressOptions {
|
|
|
86
88
|
*/
|
|
87
89
|
video?: IngressVideoOptions;
|
|
88
90
|
}
|
|
89
|
-
|
|
91
|
+
interface ListIngressOptions {
|
|
90
92
|
/**
|
|
91
93
|
* list ingress for one room only
|
|
92
94
|
*/
|
|
@@ -99,7 +101,7 @@ export interface ListIngressOptions {
|
|
|
99
101
|
/**
|
|
100
102
|
* Client to access Ingress APIs
|
|
101
103
|
*/
|
|
102
|
-
|
|
104
|
+
declare class IngressClient extends ServiceBase {
|
|
103
105
|
private readonly rpc;
|
|
104
106
|
/**
|
|
105
107
|
* @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
|
|
@@ -132,4 +134,5 @@ export declare class IngressClient extends ServiceBase {
|
|
|
132
134
|
*/
|
|
133
135
|
deleteIngress(ingressId: string): Promise<IngressInfo>;
|
|
134
136
|
}
|
|
135
|
-
|
|
137
|
+
|
|
138
|
+
export { type CreateIngressOptions, IngressClient, type ListIngressOptions, type UpdateIngressOptions };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { ClientOptions } from './ClientOptions.js';
|
|
1
|
+
import { RoomEgress, RoomAgentDispatch, ParticipantPermission, Room, ParticipantInfo, TrackInfo, DataPacket_Kind } from '@livekit/protocol';
|
|
2
|
+
import { ClientOptions } from './ClientOptions.js';
|
|
4
3
|
import { ServiceBase } from './ServiceBase.js';
|
|
4
|
+
import './grants.js';
|
|
5
|
+
import 'jose';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Options for when creating a room
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
interface CreateOptions {
|
|
9
11
|
/**
|
|
10
12
|
* name of the room. required
|
|
11
13
|
*/
|
|
@@ -55,13 +57,13 @@ export interface CreateOptions {
|
|
|
55
57
|
*/
|
|
56
58
|
nodeId?: string;
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
type SendDataOptions = {
|
|
59
61
|
/** If set, only deliver to listed participant identities */
|
|
60
62
|
destinationIdentities?: string[];
|
|
61
63
|
destinationSids?: string[];
|
|
62
64
|
topic?: string;
|
|
63
65
|
};
|
|
64
|
-
|
|
66
|
+
type UpdateParticipantOptions = {
|
|
65
67
|
/** only attributes you'd want to update should be set, set value to empty string to remove it */
|
|
66
68
|
attributes?: {
|
|
67
69
|
[key: string]: string;
|
|
@@ -74,7 +76,7 @@ export type UpdateParticipantOptions = {
|
|
|
74
76
|
/**
|
|
75
77
|
* Client to access Room APIs
|
|
76
78
|
*/
|
|
77
|
-
|
|
79
|
+
declare class RoomServiceClient extends ServiceBase {
|
|
78
80
|
private readonly rpc;
|
|
79
81
|
/**
|
|
80
82
|
*
|
|
@@ -195,4 +197,5 @@ export declare class RoomServiceClient extends ServiceBase {
|
|
|
195
197
|
*/
|
|
196
198
|
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, destinationSids?: string[]): Promise<void>;
|
|
197
199
|
}
|
|
198
|
-
|
|
200
|
+
|
|
201
|
+
export { type CreateOptions, RoomServiceClient, type SendDataOptions, type UpdateParticipantOptions };
|
package/dist/ServiceBase.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { VideoGrant, SIPGrant } from './grants.js';
|
|
2
|
+
import '@livekit/protocol';
|
|
3
|
+
import 'jose';
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Utilities to handle authentication
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
declare class ServiceBase {
|
|
6
9
|
private readonly apiKey?;
|
|
7
10
|
private readonly secret?;
|
|
8
11
|
private readonly ttl;
|
|
@@ -14,4 +17,5 @@ export declare class ServiceBase {
|
|
|
14
17
|
constructor(apiKey?: string, secret?: string, ttl?: string);
|
|
15
18
|
authHeader(grant: VideoGrant, sip?: SIPGrant): Promise<Record<string, string>>;
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
export { ServiceBase };
|
package/dist/SipClient.cjs
CHANGED
|
@@ -506,7 +506,8 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
506
506
|
roomName,
|
|
507
507
|
transferTo,
|
|
508
508
|
playDialtone: opts.playDialtone,
|
|
509
|
-
headers: opts.headers
|
|
509
|
+
headers: opts.headers,
|
|
510
|
+
ringingTimeout: opts.ringingTimeout ? new import_protobuf.Duration({ seconds: BigInt(opts.ringingTimeout) }) : void 0
|
|
510
511
|
}).toJson();
|
|
511
512
|
await this.rpc.request(
|
|
512
513
|
svc,
|