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
package/dist/crypto/uuid.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare function getRandomBytes(size?: number): Promise<Uint8Array>;
|
|
2
|
+
|
|
3
|
+
export { getRandomBytes };
|
package/dist/grants.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { TrackSource, RoomConfiguration } from '@livekit/protocol';
|
|
2
|
+
import { JWTPayload } from 'jose';
|
|
3
|
+
|
|
4
|
+
declare function trackSourceToString(source: TrackSource): "camera" | "microphone" | "screen_share" | "screen_share_audio";
|
|
5
|
+
declare function claimsToJwtPayload(grant: ClaimGrants): JWTPayload & {
|
|
6
6
|
video?: Record<string, unknown>;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
interface VideoGrant {
|
|
9
9
|
/** permission to create a room */
|
|
10
10
|
roomCreate?: boolean;
|
|
11
11
|
/** permission to join a room as a participant, room must be set */
|
|
@@ -51,22 +51,22 @@ export interface VideoGrant {
|
|
|
51
51
|
/** destination room which this participant can forward to */
|
|
52
52
|
destinationRoom?: string;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
interface SIPGrant {
|
|
55
55
|
/** manage sip resources */
|
|
56
56
|
admin?: boolean;
|
|
57
57
|
/** make outbound calls */
|
|
58
58
|
call?: boolean;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
interface InferenceGrant {
|
|
61
61
|
/** perform inference */
|
|
62
62
|
perform?: boolean;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
interface ObservabilityGrant {
|
|
65
65
|
/** write grants to publish observability data */
|
|
66
66
|
write?: boolean;
|
|
67
67
|
}
|
|
68
68
|
/** @internal */
|
|
69
|
-
|
|
69
|
+
interface ClaimGrants extends JWTPayload {
|
|
70
70
|
name?: string;
|
|
71
71
|
video?: VideoGrant;
|
|
72
72
|
sip?: SIPGrant;
|
|
@@ -79,4 +79,5 @@ export interface ClaimGrants extends JWTPayload {
|
|
|
79
79
|
roomPreset?: string;
|
|
80
80
|
roomConfig?: RoomConfiguration;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
export { type ClaimGrants, type InferenceGrant, type ObservabilityGrant, type SIPGrant, type VideoGrant, claimsToJwtPayload, trackSourceToString };
|
package/dist/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"),
|
package/dist/index.cjs.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":";;;;;;;;;;;;;;;;;;;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,
|
|
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,11 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
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
|
+
export { AccessToken, AccessTokenOptions, TokenVerifier } from './AccessToken.js';
|
|
3
|
+
export { AgentDispatchClient } from './AgentDispatchClient.js';
|
|
4
|
+
export { AcceptWhatsAppCallOptions, ConnectTwilioCallOptions, ConnectorClient, DialWhatsAppCallOptions } from './ConnectorClient.js';
|
|
5
|
+
export { BaseOptions, EgressClient, EncodedOutputs, ListEgressOptions, ParticipantEgressOptions, RoomCompositeOptions, TrackCompositeOptions, WebOptions } from './EgressClient.js';
|
|
6
|
+
export { ClaimGrants, InferenceGrant, ObservabilityGrant, SIPGrant, VideoGrant, claimsToJwtPayload, trackSourceToString } from './grants.js';
|
|
7
|
+
export { CreateIngressOptions, IngressClient, ListIngressOptions, UpdateIngressOptions } from './IngressClient.js';
|
|
8
|
+
export { CreateOptions, RoomServiceClient, SendDataOptions, UpdateParticipantOptions } from './RoomServiceClient.js';
|
|
9
|
+
export { CreateSipDispatchRuleOptions, CreateSipInboundTrunkOptions, CreateSipOutboundTrunkOptions, CreateSipParticipantOptions, CreateSipTrunkOptions, ListSipDispatchRuleOptions, ListSipTrunkOptions, SipClient, SipDispatchRuleDirect, SipDispatchRuleIndividual, SipDispatchRuleUpdateOptions, SipInboundTrunkUpdateOptions, SipOutboundTrunkUpdateOptions, TransferSipParticipantOptions } from './SipClient.js';
|
|
9
10
|
export { TwirpError } from './TwirpRPC.js';
|
|
10
|
-
export
|
|
11
|
-
|
|
11
|
+
export { WebhookEvent, WebhookEventNames, WebhookReceiver, authorizeHeader } from './WebhookReceiver.js';
|
|
12
|
+
import './ClientOptions.js';
|
|
13
|
+
import './ServiceBase.js';
|
|
14
|
+
import 'jose';
|
|
15
|
+
import '@bufbuild/protobuf';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "2.15.1",
|
|
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": "
|
|
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.
|
|
34
|
+
"@livekit/protocol": "^1.43.1",
|
|
34
35
|
"camelcase-keys": "^9.0.0",
|
|
35
36
|
"jose": "^5.1.2"
|
|
36
37
|
},
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"node": ">=18"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
|
-
"build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
|
|
55
|
+
"build": "tsup --onSuccess \"tsc -p tsconfig.json --declaration --emitDeclarationOnly --skipLibCheck\"",
|
|
55
56
|
"build:watch": "tsc --watch",
|
|
56
57
|
"build-docs": "typedoc",
|
|
57
58
|
"changeset": "changeset",
|
package/src/AccessToken.test.ts
CHANGED
|
@@ -59,9 +59,7 @@ describe('identity is required for only join grants', () => {
|
|
|
59
59
|
const t = new AccessToken(testApiKey, testSecret);
|
|
60
60
|
t.addGrant({ roomJoin: true });
|
|
61
61
|
|
|
62
|
-
await expect(
|
|
63
|
-
await t.toJwt();
|
|
64
|
-
}).rejects.toThrow();
|
|
62
|
+
await expect(t.toJwt()).rejects.toThrow();
|
|
65
63
|
});
|
|
66
64
|
});
|
|
67
65
|
|
package/src/AccessToken.ts
CHANGED
|
@@ -203,7 +203,7 @@ export class AccessToken {
|
|
|
203
203
|
.setProtectedHeader({ alg: 'HS256' })
|
|
204
204
|
.setIssuer(this.apiKey)
|
|
205
205
|
.setExpirationTime(this.ttl)
|
|
206
|
-
.setNotBefore(
|
|
206
|
+
.setNotBefore(new Date());
|
|
207
207
|
if (this.identity) {
|
|
208
208
|
jwt.setSubject(this.identity);
|
|
209
209
|
} else if (this.grants.video?.roomJoin) {
|
|
@@ -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/SipClient.ts
CHANGED
|
@@ -210,6 +210,8 @@ export interface SipOutboundTrunkUpdateOptions {
|
|
|
210
210
|
export interface TransferSipParticipantOptions {
|
|
211
211
|
playDialtone?: boolean;
|
|
212
212
|
headers?: { [key: string]: string };
|
|
213
|
+
/** Maximum time for the transfer destination to answer the call, in seconds. */
|
|
214
|
+
ringingTimeout?: number;
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
/**
|
|
@@ -789,6 +791,9 @@ export class SipClient extends ServiceBase {
|
|
|
789
791
|
transferTo: transferTo,
|
|
790
792
|
playDialtone: opts.playDialtone,
|
|
791
793
|
headers: opts.headers,
|
|
794
|
+
ringingTimeout: opts.ringingTimeout
|
|
795
|
+
? new Duration({ seconds: BigInt(opts.ringingTimeout) })
|
|
796
|
+
: undefined,
|
|
792
797
|
}).toJson();
|
|
793
798
|
|
|
794
799
|
await this.rpc.request(
|