livekit-server-sdk 2.8.0 → 2.9.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.
- package/README.md +1 -1
- package/dist/AccessToken.cjs +169 -0
- package/dist/AccessToken.cjs.map +1 -0
- package/dist/AccessToken.js +130 -137
- package/dist/AccessToken.js.map +1 -1
- package/dist/AccessToken.test.cjs +147 -0
- package/dist/AccessToken.test.cjs.map +1 -0
- package/dist/AccessToken.test.js +129 -0
- package/dist/AccessToken.test.js.map +1 -0
- package/dist/AgentDispatchClient.cjs +133 -0
- package/dist/AgentDispatchClient.cjs.map +1 -0
- package/dist/AgentDispatchClient.d.ts +1 -1
- package/dist/AgentDispatchClient.d.ts.map +1 -1
- package/dist/AgentDispatchClient.js +102 -79
- package/dist/AgentDispatchClient.js.map +1 -1
- package/dist/EgressClient.cjs +381 -0
- package/dist/EgressClient.cjs.map +1 -0
- package/dist/EgressClient.js +349 -288
- package/dist/EgressClient.js.map +1 -1
- package/dist/IngressClient.cjs +164 -0
- package/dist/IngressClient.cjs.map +1 -0
- package/dist/IngressClient.js +131 -106
- package/dist/IngressClient.js.map +1 -1
- package/dist/RoomServiceClient.cjs +240 -0
- package/dist/RoomServiceClient.cjs.map +1 -0
- package/dist/RoomServiceClient.js +219 -151
- package/dist/RoomServiceClient.js.map +1 -1
- package/dist/ServiceBase.cjs +49 -0
- package/dist/ServiceBase.cjs.map +1 -0
- package/dist/ServiceBase.js +25 -28
- package/dist/ServiceBase.js.map +1 -1
- package/dist/SipClient.cjs +379 -0
- package/dist/SipClient.cjs.map +1 -0
- package/dist/SipClient.d.ts +15 -0
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +360 -260
- package/dist/SipClient.js.map +1 -1
- package/dist/TwirpRPC.cjs +71 -0
- package/dist/TwirpRPC.cjs.map +1 -0
- package/dist/TwirpRPC.d.ts.map +1 -1
- package/dist/TwirpRPC.js +32 -29
- package/dist/TwirpRPC.js.map +1 -1
- package/dist/WebhookReceiver.cjs +78 -0
- package/dist/WebhookReceiver.cjs.map +1 -0
- package/dist/WebhookReceiver.js +48 -45
- package/dist/WebhookReceiver.js.map +1 -1
- package/dist/WebhookReceiver.test.cjs +38 -0
- package/dist/WebhookReceiver.test.cjs.map +1 -0
- package/dist/WebhookReceiver.test.js +37 -0
- package/dist/WebhookReceiver.test.js.map +1 -0
- package/dist/grants.cjs +53 -0
- package/dist/grants.cjs.map +1 -0
- package/dist/grants.js +25 -23
- package/dist/grants.js.map +1 -1
- package/dist/grants.test.cjs +27 -0
- package/dist/grants.test.cjs.map +1 -0
- package/dist/grants.test.js +26 -0
- package/dist/grants.test.js.map +1 -0
- package/dist/index.cjs +136 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +104 -12
- package/dist/index.js.map +1 -1
- package/package.json +12 -3
- package/src/AgentDispatchClient.ts +2 -2
- package/src/SipClient.ts +33 -0
- package/src/TwirpRPC.ts +1 -1
package/dist/grants.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { TrackSource } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { TrackSource } from "@livekit/protocol";
|
|
2
|
+
function trackSourceToString(source) {
|
|
3
|
+
switch (source) {
|
|
4
|
+
case TrackSource.CAMERA:
|
|
5
|
+
return "camera";
|
|
6
|
+
case TrackSource.MICROPHONE:
|
|
7
|
+
return "microphone";
|
|
8
|
+
case TrackSource.SCREEN_SHARE:
|
|
9
|
+
return "screen_share";
|
|
10
|
+
case TrackSource.SCREEN_SHARE_AUDIO:
|
|
11
|
+
return "screen_share_audio";
|
|
12
|
+
default:
|
|
13
|
+
throw new TypeError(`Cannot convert TrackSource ${source} to string`);
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return claim;
|
|
16
|
+
function claimsToJwtPayload(grant) {
|
|
17
|
+
var _a;
|
|
18
|
+
const claim = { ...grant };
|
|
19
|
+
if (Array.isArray((_a = claim.video) == null ? void 0 : _a.canPublishSources)) {
|
|
20
|
+
claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);
|
|
21
|
+
}
|
|
22
|
+
return claim;
|
|
25
23
|
}
|
|
24
|
+
export {
|
|
25
|
+
claimsToJwtPayload,
|
|
26
|
+
trackSourceToString
|
|
27
|
+
};
|
|
26
28
|
//# sourceMappingURL=grants.js.map
|
package/dist/grants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/grants.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport { TrackSource } from '@livekit/protocol';\nimport type { JWTPayload } from 'jose';\n\nexport function trackSourceToString(source: TrackSource) {\n switch (source) {\n case TrackSource.CAMERA:\n return 'camera';\n case TrackSource.MICROPHONE:\n return 'microphone';\n case TrackSource.SCREEN_SHARE:\n return 'screen_share';\n case TrackSource.SCREEN_SHARE_AUDIO:\n return 'screen_share_audio';\n default:\n throw new TypeError(`Cannot convert TrackSource ${source} to string`);\n }\n}\n\nexport function claimsToJwtPayload(\n grant: ClaimGrants,\n): JWTPayload & { video?: Record<string, unknown> } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const claim: Record<string, any> = { ...grant };\n // eslint-disable-next-line no-restricted-syntax\n if (Array.isArray(claim.video?.canPublishSources)) {\n claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);\n }\n return claim;\n}\n\nexport interface VideoGrant {\n /** permission to create a room */\n roomCreate?: boolean;\n\n /** permission to join a room as a participant, room must be set */\n roomJoin?: boolean;\n\n /** permission to list rooms */\n roomList?: boolean;\n\n /** permission to start a recording */\n roomRecord?: boolean;\n\n /** permission to control a specific room, room must be set */\n roomAdmin?: boolean;\n\n /** name of the room, must be set for admin or join permissions */\n room?: string;\n\n /** permissions to control ingress, not specific to any room or ingress */\n ingressAdmin?: boolean;\n\n /**\n * allow participant to publish. If neither canPublish or canSubscribe is set,\n * both publish and subscribe are enabled\n */\n canPublish?: boolean;\n\n /**\n * TrackSource types that the participant is allowed to publish\n * When set, it supersedes CanPublish. Only sources explicitly set here can be published\n */\n canPublishSources?: TrackSource[];\n\n /** allow participant to subscribe to other tracks */\n canSubscribe?: boolean;\n\n /**\n * allow participants to publish data, defaults to true if not set\n */\n canPublishData?: boolean;\n\n /**\n * by default, a participant is not allowed to update its own metadata\n */\n canUpdateOwnMetadata?: boolean;\n\n /** participant isn't visible to others */\n hidden?: boolean;\n\n /** participant is recording the room, when set, allows room to indicate it's being recorded */\n recorder?: boolean;\n\n /** participant allowed to connect to LiveKit as Agent Framework worker */\n agent?: boolean;\n\n /** allow participant to subscribe to metrics */\n canSubscribeMetrics?: boolean;\n}\n\nexport interface SIPGrant {\n /** manage sip resources */\n admin?: boolean;\n\n /** make outbound calls */\n call?: boolean;\n}\n\n/** @internal */\nexport interface ClaimGrants extends JWTPayload {\n name?: string;\n video?: VideoGrant;\n sip?: SIPGrant;\n kind?: string;\n metadata?: string;\n attributes?: Record<string, string>;\n sha256?: string;\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n"],"mappings":"AAIA,SAAS,mBAAmB;AAGrB,SAAS,oBAAoB,QAAqB;AACvD,UAAQ,QAAQ;AAAA,IACd,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT;AACE,YAAM,IAAI,UAAU,8BAA8B,MAAM,YAAY;AAAA,EACxE;AACF;AAEO,SAAS,mBACd,OACkD;AAxBpD;AA0BE,QAAM,QAA6B,EAAE,GAAG,MAAM;AAE9C,MAAI,MAAM,SAAQ,WAAM,UAAN,mBAAa,iBAAiB,GAAG;AACjD,UAAM,MAAM,oBAAoB,MAAM,MAAM,kBAAkB,IAAI,mBAAmB;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_protocol = require("@livekit/protocol");
|
|
3
|
+
var import_vitest = require("vitest");
|
|
4
|
+
var import_grants = require("./grants");
|
|
5
|
+
(0, import_vitest.describe)("ClaimGrants are parsed correctly", () => {
|
|
6
|
+
(0, import_vitest.it)("parses TrackSource correctly to strings", () => {
|
|
7
|
+
var _a;
|
|
8
|
+
const grant = {
|
|
9
|
+
canPublishSources: [
|
|
10
|
+
import_protocol.TrackSource.CAMERA,
|
|
11
|
+
import_protocol.TrackSource.MICROPHONE,
|
|
12
|
+
import_protocol.TrackSource.SCREEN_SHARE,
|
|
13
|
+
import_protocol.TrackSource.SCREEN_SHARE_AUDIO
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
const claim = { video: grant };
|
|
17
|
+
const jwtPayload = (0, import_grants.claimsToJwtPayload)(claim);
|
|
18
|
+
(0, import_vitest.expect)(jwtPayload.video).toBeTypeOf("object");
|
|
19
|
+
(0, import_vitest.expect)((_a = jwtPayload.video) == null ? void 0 : _a.canPublishSources).toEqual([
|
|
20
|
+
"camera",
|
|
21
|
+
"microphone",
|
|
22
|
+
"screen_share",
|
|
23
|
+
"screen_share_audio"
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=grants.test.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grants.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { TrackSource } from '@livekit/protocol';\nimport { describe, expect, it } from 'vitest';\nimport type { ClaimGrants, VideoGrant } from './grants';\nimport { claimsToJwtPayload } from './grants';\n\ndescribe('ClaimGrants are parsed correctly', () => {\n it('parses TrackSource correctly to strings', () => {\n const grant: VideoGrant = {\n canPublishSources: [\n TrackSource.CAMERA,\n TrackSource.MICROPHONE,\n TrackSource.SCREEN_SHARE,\n TrackSource.SCREEN_SHARE_AUDIO,\n ],\n };\n\n const claim: ClaimGrants = { video: grant };\n\n const jwtPayload = claimsToJwtPayload(claim);\n expect(jwtPayload.video).toBeTypeOf('object');\n expect(jwtPayload.video?.canPublishSources).toEqual([\n 'camera',\n 'microphone',\n 'screen_share',\n 'screen_share_audio',\n ]);\n });\n});\n"],"mappings":";AAGA,sBAA4B;AAC5B,oBAAqC;AAErC,oBAAmC;AAAA,IAEnC,wBAAS,oCAAoC,MAAM;AACjD,wBAAG,2CAA2C,MAAM;AATtD;AAUI,UAAM,QAAoB;AAAA,MACxB,mBAAmB;AAAA,QACjB,4BAAY;AAAA,QACZ,4BAAY;AAAA,QACZ,4BAAY;AAAA,QACZ,4BAAY;AAAA,MACd;AAAA,IACF;AAEA,UAAM,QAAqB,EAAE,OAAO,MAAM;AAE1C,UAAM,iBAAa,kCAAmB,KAAK;AAC3C,8BAAO,WAAW,KAAK,EAAE,WAAW,QAAQ;AAC5C,+BAAO,gBAAW,UAAX,mBAAkB,iBAAiB,EAAE,QAAQ;AAAA,MAClD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TrackSource } from "@livekit/protocol";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { claimsToJwtPayload } from "./grants";
|
|
4
|
+
describe("ClaimGrants are parsed correctly", () => {
|
|
5
|
+
it("parses TrackSource correctly to strings", () => {
|
|
6
|
+
var _a;
|
|
7
|
+
const grant = {
|
|
8
|
+
canPublishSources: [
|
|
9
|
+
TrackSource.CAMERA,
|
|
10
|
+
TrackSource.MICROPHONE,
|
|
11
|
+
TrackSource.SCREEN_SHARE,
|
|
12
|
+
TrackSource.SCREEN_SHARE_AUDIO
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
const claim = { video: grant };
|
|
16
|
+
const jwtPayload = claimsToJwtPayload(claim);
|
|
17
|
+
expect(jwtPayload.video).toBeTypeOf("object");
|
|
18
|
+
expect((_a = jwtPayload.video) == null ? void 0 : _a.canPublishSources).toEqual([
|
|
19
|
+
"camera",
|
|
20
|
+
"microphone",
|
|
21
|
+
"screen_share",
|
|
22
|
+
"screen_share_audio"
|
|
23
|
+
]);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=grants.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grants.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { TrackSource } from '@livekit/protocol';\nimport { describe, expect, it } from 'vitest';\nimport type { ClaimGrants, VideoGrant } from './grants';\nimport { claimsToJwtPayload } from './grants';\n\ndescribe('ClaimGrants are parsed correctly', () => {\n it('parses TrackSource correctly to strings', () => {\n const grant: VideoGrant = {\n canPublishSources: [\n TrackSource.CAMERA,\n TrackSource.MICROPHONE,\n TrackSource.SCREEN_SHARE,\n TrackSource.SCREEN_SHARE_AUDIO,\n ],\n };\n\n const claim: ClaimGrants = { video: grant };\n\n const jwtPayload = claimsToJwtPayload(claim);\n expect(jwtPayload.video).toBeTypeOf('object');\n expect(jwtPayload.video?.canPublishSources).toEqual([\n 'camera',\n 'microphone',\n 'screen_share',\n 'screen_share_audio',\n ]);\n });\n});\n"],"mappings":"AAGA,SAAS,mBAAmB;AAC5B,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,0BAA0B;AAEnC,SAAS,oCAAoC,MAAM;AACjD,KAAG,2CAA2C,MAAM;AATtD;AAUI,UAAM,QAAoB;AAAA,MACxB,mBAAmB;AAAA,QACjB,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF;AAEA,UAAM,QAAqB,EAAE,OAAO,MAAM;AAE1C,UAAM,aAAa,mBAAmB,KAAK;AAC3C,WAAO,WAAW,KAAK,EAAE,WAAW,QAAQ;AAC5C,YAAO,gBAAW,UAAX,mBAAkB,iBAAiB,EAAE,QAAQ;AAAA,MAClD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
AliOSSUpload: () => import_protocol.AliOSSUpload,
|
|
23
|
+
AutoParticipantEgress: () => import_protocol.AutoParticipantEgress,
|
|
24
|
+
AutoTrackEgress: () => import_protocol.AutoTrackEgress,
|
|
25
|
+
AzureBlobUpload: () => import_protocol.AzureBlobUpload,
|
|
26
|
+
DataPacket_Kind: () => import_protocol.DataPacket_Kind,
|
|
27
|
+
DirectFileOutput: () => import_protocol.DirectFileOutput,
|
|
28
|
+
EgressInfo: () => import_protocol.EgressInfo,
|
|
29
|
+
EgressStatus: () => import_protocol.EgressStatus,
|
|
30
|
+
EncodedFileOutput: () => import_protocol.EncodedFileOutput,
|
|
31
|
+
EncodedFileType: () => import_protocol.EncodedFileType,
|
|
32
|
+
EncodingOptions: () => import_protocol.EncodingOptions,
|
|
33
|
+
EncodingOptionsPreset: () => import_protocol.EncodingOptionsPreset,
|
|
34
|
+
GCPUpload: () => import_protocol.GCPUpload,
|
|
35
|
+
ImageCodec: () => import_protocol.ImageCodec,
|
|
36
|
+
ImageFileSuffix: () => import_protocol.ImageFileSuffix,
|
|
37
|
+
ImageOutput: () => import_protocol.ImageOutput,
|
|
38
|
+
IngressAudioEncodingOptions: () => import_protocol.IngressAudioEncodingOptions,
|
|
39
|
+
IngressAudioEncodingPreset: () => import_protocol.IngressAudioEncodingPreset,
|
|
40
|
+
IngressAudioOptions: () => import_protocol.IngressAudioOptions,
|
|
41
|
+
IngressInfo: () => import_protocol.IngressInfo,
|
|
42
|
+
IngressInput: () => import_protocol.IngressInput,
|
|
43
|
+
IngressState: () => import_protocol.IngressState,
|
|
44
|
+
IngressVideoEncodingOptions: () => import_protocol.IngressVideoEncodingOptions,
|
|
45
|
+
IngressVideoEncodingPreset: () => import_protocol.IngressVideoEncodingPreset,
|
|
46
|
+
IngressVideoOptions: () => import_protocol.IngressVideoOptions,
|
|
47
|
+
ParticipantEgressRequest: () => import_protocol.ParticipantEgressRequest,
|
|
48
|
+
ParticipantInfo: () => import_protocol.ParticipantInfo,
|
|
49
|
+
ParticipantInfo_State: () => import_protocol.ParticipantInfo_State,
|
|
50
|
+
ParticipantPermission: () => import_protocol.ParticipantPermission,
|
|
51
|
+
Room: () => import_protocol.Room,
|
|
52
|
+
RoomCompositeEgressRequest: () => import_protocol.RoomCompositeEgressRequest,
|
|
53
|
+
RoomEgress: () => import_protocol.RoomEgress,
|
|
54
|
+
S3Upload: () => import_protocol.S3Upload,
|
|
55
|
+
SIPDispatchRuleInfo: () => import_protocol.SIPDispatchRuleInfo,
|
|
56
|
+
SIPParticipantInfo: () => import_protocol.SIPParticipantInfo,
|
|
57
|
+
SIPTrunkInfo: () => import_protocol.SIPTrunkInfo,
|
|
58
|
+
SegmentedFileOutput: () => import_protocol.SegmentedFileOutput,
|
|
59
|
+
SegmentedFileProtocol: () => import_protocol.SegmentedFileProtocol,
|
|
60
|
+
StreamOutput: () => import_protocol.StreamOutput,
|
|
61
|
+
StreamProtocol: () => import_protocol.StreamProtocol,
|
|
62
|
+
TrackCompositeEgressRequest: () => import_protocol.TrackCompositeEgressRequest,
|
|
63
|
+
TrackEgressRequest: () => import_protocol.TrackEgressRequest,
|
|
64
|
+
TrackInfo: () => import_protocol.TrackInfo,
|
|
65
|
+
TrackSource: () => import_protocol.TrackSource,
|
|
66
|
+
TrackType: () => import_protocol.TrackType,
|
|
67
|
+
WebEgressRequest: () => import_protocol.WebEgressRequest
|
|
68
|
+
});
|
|
69
|
+
module.exports = __toCommonJS(src_exports);
|
|
70
|
+
var import_protocol = require("@livekit/protocol");
|
|
71
|
+
__reExport(src_exports, require("./AccessToken.cjs"), module.exports);
|
|
72
|
+
__reExport(src_exports, require("./AgentDispatchClient.cjs"), module.exports);
|
|
73
|
+
__reExport(src_exports, require("./EgressClient.cjs"), module.exports);
|
|
74
|
+
__reExport(src_exports, require("./grants.cjs"), module.exports);
|
|
75
|
+
__reExport(src_exports, require("./IngressClient.cjs"), module.exports);
|
|
76
|
+
__reExport(src_exports, require("./RoomServiceClient.cjs"), module.exports);
|
|
77
|
+
__reExport(src_exports, require("./SipClient.cjs"), module.exports);
|
|
78
|
+
__reExport(src_exports, require("./WebhookReceiver.cjs"), module.exports);
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
AliOSSUpload,
|
|
82
|
+
AutoParticipantEgress,
|
|
83
|
+
AutoTrackEgress,
|
|
84
|
+
AzureBlobUpload,
|
|
85
|
+
DataPacket_Kind,
|
|
86
|
+
DirectFileOutput,
|
|
87
|
+
EgressInfo,
|
|
88
|
+
EgressStatus,
|
|
89
|
+
EncodedFileOutput,
|
|
90
|
+
EncodedFileType,
|
|
91
|
+
EncodingOptions,
|
|
92
|
+
EncodingOptionsPreset,
|
|
93
|
+
GCPUpload,
|
|
94
|
+
ImageCodec,
|
|
95
|
+
ImageFileSuffix,
|
|
96
|
+
ImageOutput,
|
|
97
|
+
IngressAudioEncodingOptions,
|
|
98
|
+
IngressAudioEncodingPreset,
|
|
99
|
+
IngressAudioOptions,
|
|
100
|
+
IngressInfo,
|
|
101
|
+
IngressInput,
|
|
102
|
+
IngressState,
|
|
103
|
+
IngressVideoEncodingOptions,
|
|
104
|
+
IngressVideoEncodingPreset,
|
|
105
|
+
IngressVideoOptions,
|
|
106
|
+
ParticipantEgressRequest,
|
|
107
|
+
ParticipantInfo,
|
|
108
|
+
ParticipantInfo_State,
|
|
109
|
+
ParticipantPermission,
|
|
110
|
+
Room,
|
|
111
|
+
RoomCompositeEgressRequest,
|
|
112
|
+
RoomEgress,
|
|
113
|
+
S3Upload,
|
|
114
|
+
SIPDispatchRuleInfo,
|
|
115
|
+
SIPParticipantInfo,
|
|
116
|
+
SIPTrunkInfo,
|
|
117
|
+
SegmentedFileOutput,
|
|
118
|
+
SegmentedFileProtocol,
|
|
119
|
+
StreamOutput,
|
|
120
|
+
StreamProtocol,
|
|
121
|
+
TrackCompositeEgressRequest,
|
|
122
|
+
TrackEgressRequest,
|
|
123
|
+
TrackInfo,
|
|
124
|
+
TrackSource,
|
|
125
|
+
TrackType,
|
|
126
|
+
WebEgressRequest,
|
|
127
|
+
...require("./AccessToken.cjs"),
|
|
128
|
+
...require("./AgentDispatchClient.cjs"),
|
|
129
|
+
...require("./EgressClient.cjs"),
|
|
130
|
+
...require("./grants.cjs"),
|
|
131
|
+
...require("./IngressClient.cjs"),
|
|
132
|
+
...require("./RoomServiceClient.cjs"),
|
|
133
|
+
...require("./SipClient.cjs"),
|
|
134
|
+
...require("./WebhookReceiver.cjs")
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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 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 RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\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 * 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;AAIA,sBA+CO;AACP,wBAAc,6BApDd;AAqDA,wBAAc,qCArDd;AAsDA,wBAAc,8BAtDd;AAuDA,wBAAc,wBAvDd;AAwDA,wBAAc,+BAxDd;AAyDA,wBAAc,mCAzDd;AA0DA,wBAAc,2BA1Dd;AA2DA,wBAAc,iCA3Dd;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import {
|
|
2
|
+
AliOSSUpload,
|
|
3
|
+
AutoParticipantEgress,
|
|
4
|
+
AutoTrackEgress,
|
|
5
|
+
AzureBlobUpload,
|
|
6
|
+
DataPacket_Kind,
|
|
7
|
+
DirectFileOutput,
|
|
8
|
+
EgressInfo,
|
|
9
|
+
EgressStatus,
|
|
10
|
+
EncodedFileOutput,
|
|
11
|
+
EncodedFileType,
|
|
12
|
+
EncodingOptions,
|
|
13
|
+
EncodingOptionsPreset,
|
|
14
|
+
GCPUpload,
|
|
15
|
+
ImageCodec,
|
|
16
|
+
ImageFileSuffix,
|
|
17
|
+
ImageOutput,
|
|
18
|
+
IngressAudioEncodingOptions,
|
|
19
|
+
IngressAudioEncodingPreset,
|
|
20
|
+
IngressAudioOptions,
|
|
21
|
+
IngressInfo,
|
|
22
|
+
IngressInput,
|
|
23
|
+
IngressState,
|
|
24
|
+
IngressVideoEncodingOptions,
|
|
25
|
+
IngressVideoEncodingPreset,
|
|
26
|
+
IngressVideoOptions,
|
|
27
|
+
ParticipantEgressRequest,
|
|
28
|
+
ParticipantInfo,
|
|
29
|
+
ParticipantInfo_State,
|
|
30
|
+
ParticipantPermission,
|
|
31
|
+
Room,
|
|
32
|
+
RoomCompositeEgressRequest,
|
|
33
|
+
RoomEgress,
|
|
34
|
+
S3Upload,
|
|
35
|
+
SIPDispatchRuleInfo,
|
|
36
|
+
SIPParticipantInfo,
|
|
37
|
+
SIPTrunkInfo,
|
|
38
|
+
SegmentedFileOutput,
|
|
39
|
+
SegmentedFileProtocol,
|
|
40
|
+
StreamOutput,
|
|
41
|
+
StreamProtocol,
|
|
42
|
+
TrackCompositeEgressRequest,
|
|
43
|
+
TrackEgressRequest,
|
|
44
|
+
TrackInfo,
|
|
45
|
+
TrackSource,
|
|
46
|
+
TrackType,
|
|
47
|
+
WebEgressRequest
|
|
48
|
+
} from "@livekit/protocol";
|
|
49
|
+
export * from "./AccessToken.js";
|
|
50
|
+
export * from "./AgentDispatchClient.js";
|
|
51
|
+
export * from "./EgressClient.js";
|
|
52
|
+
export * from "./grants.js";
|
|
53
|
+
export * from "./IngressClient.js";
|
|
54
|
+
export * from "./RoomServiceClient.js";
|
|
55
|
+
export * from "./SipClient.js";
|
|
56
|
+
export * from "./WebhookReceiver.js";
|
|
57
|
+
export {
|
|
58
|
+
AliOSSUpload,
|
|
59
|
+
AutoParticipantEgress,
|
|
60
|
+
AutoTrackEgress,
|
|
61
|
+
AzureBlobUpload,
|
|
62
|
+
DataPacket_Kind,
|
|
63
|
+
DirectFileOutput,
|
|
64
|
+
EgressInfo,
|
|
65
|
+
EgressStatus,
|
|
66
|
+
EncodedFileOutput,
|
|
67
|
+
EncodedFileType,
|
|
68
|
+
EncodingOptions,
|
|
69
|
+
EncodingOptionsPreset,
|
|
70
|
+
GCPUpload,
|
|
71
|
+
ImageCodec,
|
|
72
|
+
ImageFileSuffix,
|
|
73
|
+
ImageOutput,
|
|
74
|
+
IngressAudioEncodingOptions,
|
|
75
|
+
IngressAudioEncodingPreset,
|
|
76
|
+
IngressAudioOptions,
|
|
77
|
+
IngressInfo,
|
|
78
|
+
IngressInput,
|
|
79
|
+
IngressState,
|
|
80
|
+
IngressVideoEncodingOptions,
|
|
81
|
+
IngressVideoEncodingPreset,
|
|
82
|
+
IngressVideoOptions,
|
|
83
|
+
ParticipantEgressRequest,
|
|
84
|
+
ParticipantInfo,
|
|
85
|
+
ParticipantInfo_State,
|
|
86
|
+
ParticipantPermission,
|
|
87
|
+
Room,
|
|
88
|
+
RoomCompositeEgressRequest,
|
|
89
|
+
RoomEgress,
|
|
90
|
+
S3Upload,
|
|
91
|
+
SIPDispatchRuleInfo,
|
|
92
|
+
SIPParticipantInfo,
|
|
93
|
+
SIPTrunkInfo,
|
|
94
|
+
SegmentedFileOutput,
|
|
95
|
+
SegmentedFileProtocol,
|
|
96
|
+
StreamOutput,
|
|
97
|
+
StreamProtocol,
|
|
98
|
+
TrackCompositeEgressRequest,
|
|
99
|
+
TrackEgressRequest,
|
|
100
|
+
TrackInfo,
|
|
101
|
+
TrackSource,
|
|
102
|
+
TrackType,
|
|
103
|
+
WebEgressRequest
|
|
104
|
+
};
|
|
13
105
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 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 RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\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 * 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,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "livekit-server-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Server-side SDK for LiveKit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"require": "dist/index.cjs",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"repository": "git@github.com:livekit/server-sdk-js.git",
|
|
8
9
|
"author": "David Zhao <david@davidzhao.com>",
|
|
9
10
|
"license": "Apache-2.0",
|
|
10
11
|
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
11
19
|
"files": [
|
|
12
20
|
"dist",
|
|
13
21
|
"src"
|
|
14
22
|
],
|
|
15
23
|
"dependencies": {
|
|
16
|
-
"@livekit/protocol": "^1.
|
|
24
|
+
"@livekit/protocol": "^1.28.1",
|
|
17
25
|
"camelcase-keys": "^9.0.0",
|
|
18
26
|
"jose": "^5.1.2"
|
|
19
27
|
},
|
|
@@ -25,6 +33,7 @@
|
|
|
25
33
|
"@types/node": "^20.10.1",
|
|
26
34
|
"happy-dom": "^15.0.0",
|
|
27
35
|
"prettier": "^3.0.0",
|
|
36
|
+
"tsup": "^8.3.5",
|
|
28
37
|
"typedoc": "^0.26.0",
|
|
29
38
|
"typescript": "5.6.x",
|
|
30
39
|
"vite": "^5.2.9",
|
|
@@ -34,7 +43,7 @@
|
|
|
34
43
|
"node": ">=19"
|
|
35
44
|
},
|
|
36
45
|
"scripts": {
|
|
37
|
-
"build": "tsc --
|
|
46
|
+
"build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
|
|
38
47
|
"build:watch": "tsc --watch",
|
|
39
48
|
"build-docs": "typedoc",
|
|
40
49
|
"changeset": "changeset",
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ListAgentDispatchRequest,
|
|
9
9
|
ListAgentDispatchResponse,
|
|
10
10
|
} from '@livekit/protocol';
|
|
11
|
-
import ServiceBase from './ServiceBase';
|
|
12
|
-
import { type Rpc, TwirpRpc, livekitPackage } from './TwirpRPC';
|
|
11
|
+
import ServiceBase from './ServiceBase.js';
|
|
12
|
+
import { type Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';
|
|
13
13
|
|
|
14
14
|
interface CreateDispatchOptions {
|
|
15
15
|
// any custom data to send along with the job.
|
package/src/SipClient.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { Duration } from '@bufbuild/protobuf';
|
|
4
5
|
import {
|
|
5
6
|
CreateSIPDispatchRuleRequest,
|
|
6
7
|
CreateSIPInboundTrunkRequest,
|
|
@@ -54,12 +55,16 @@ export interface CreateSipInboundTrunkOptions {
|
|
|
54
55
|
allowed_numbers?: string[];
|
|
55
56
|
auth_username?: string;
|
|
56
57
|
auth_password?: string;
|
|
58
|
+
headers?: { [key: string]: string };
|
|
59
|
+
headersToAttributes?: { [key: string]: string };
|
|
57
60
|
}
|
|
58
61
|
export interface CreateSipOutboundTrunkOptions {
|
|
59
62
|
metadata?: string;
|
|
60
63
|
transport: SIPTransport;
|
|
61
64
|
auth_username?: string;
|
|
62
65
|
auth_password?: string;
|
|
66
|
+
headers?: { [key: string]: string };
|
|
67
|
+
headersToAttributes?: { [key: string]: string };
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
export interface SipDispatchRuleDirect {
|
|
@@ -90,6 +95,9 @@ export interface CreateSipParticipantOptions {
|
|
|
90
95
|
playRingtone?: boolean; // Deprecated, use playDialtone instead
|
|
91
96
|
playDialtone?: boolean;
|
|
92
97
|
hidePhoneNumber?: boolean;
|
|
98
|
+
ringingTimeout?: number; // Duration in seconds
|
|
99
|
+
maxCallDuration?: number; // Duration in seconds
|
|
100
|
+
enableKrisp?: boolean;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
export interface TransferSipParticipantOptions {
|
|
@@ -177,6 +185,8 @@ export class SipClient extends ServiceBase {
|
|
|
177
185
|
let authUsername: string = '';
|
|
178
186
|
let authPassword: string = '';
|
|
179
187
|
let metadata: string = '';
|
|
188
|
+
let headers: { [key: string]: string } = {};
|
|
189
|
+
let headersToAttributes: { [key: string]: string } = {};
|
|
180
190
|
|
|
181
191
|
if (opts !== undefined) {
|
|
182
192
|
allowedAddresses = opts.allowed_addresses;
|
|
@@ -184,6 +194,8 @@ export class SipClient extends ServiceBase {
|
|
|
184
194
|
authUsername = opts.auth_username || '';
|
|
185
195
|
authPassword = opts.auth_password || '';
|
|
186
196
|
metadata = opts.metadata || '';
|
|
197
|
+
headers = opts.headers || {};
|
|
198
|
+
headersToAttributes = opts.headersToAttributes || {};
|
|
187
199
|
}
|
|
188
200
|
|
|
189
201
|
const req = new CreateSIPInboundTrunkRequest({
|
|
@@ -195,6 +207,8 @@ export class SipClient extends ServiceBase {
|
|
|
195
207
|
allowedNumbers: allowedNumbers,
|
|
196
208
|
authUsername: authUsername,
|
|
197
209
|
authPassword: authPassword,
|
|
210
|
+
headers: headers,
|
|
211
|
+
headersToAttributes: headersToAttributes,
|
|
198
212
|
}),
|
|
199
213
|
}).toJson();
|
|
200
214
|
|
|
@@ -223,12 +237,16 @@ export class SipClient extends ServiceBase {
|
|
|
223
237
|
let authPassword: string = '';
|
|
224
238
|
let transport: SIPTransport = SIPTransport.SIP_TRANSPORT_AUTO;
|
|
225
239
|
let metadata: string = '';
|
|
240
|
+
let headers: { [key: string]: string } = {};
|
|
241
|
+
let headersToAttributes: { [key: string]: string } = {};
|
|
226
242
|
|
|
227
243
|
if (opts !== undefined) {
|
|
228
244
|
authUsername = opts.auth_username || '';
|
|
229
245
|
authPassword = opts.auth_password || '';
|
|
230
246
|
transport = opts.transport || SIPTransport.SIP_TRANSPORT_AUTO;
|
|
231
247
|
metadata = opts.metadata || '';
|
|
248
|
+
headers = opts.headers || {};
|
|
249
|
+
headersToAttributes = opts.headersToAttributes || {};
|
|
232
250
|
}
|
|
233
251
|
|
|
234
252
|
const req = new CreateSIPOutboundTrunkRequest({
|
|
@@ -240,6 +258,8 @@ export class SipClient extends ServiceBase {
|
|
|
240
258
|
transport: transport,
|
|
241
259
|
authUsername: authUsername,
|
|
242
260
|
authPassword: authPassword,
|
|
261
|
+
headers: headers,
|
|
262
|
+
headersToAttributes: headersToAttributes,
|
|
243
263
|
}),
|
|
244
264
|
}).toJson();
|
|
245
265
|
|
|
@@ -403,6 +423,9 @@ export class SipClient extends ServiceBase {
|
|
|
403
423
|
let playRingtone: boolean = false;
|
|
404
424
|
let playDialtone: boolean = false;
|
|
405
425
|
let hidePhoneNumber: boolean = false;
|
|
426
|
+
let ringingTimeout: number | undefined = undefined;
|
|
427
|
+
let maxCallDuration: number | undefined = undefined;
|
|
428
|
+
let enableKrisp: boolean | undefined = undefined;
|
|
406
429
|
|
|
407
430
|
if (opts !== undefined) {
|
|
408
431
|
participantIdentity = opts.participantIdentity || '';
|
|
@@ -412,6 +435,9 @@ export class SipClient extends ServiceBase {
|
|
|
412
435
|
playRingtone = opts.playRingtone || false;
|
|
413
436
|
playDialtone = opts.playDialtone || playRingtone; // Enable PlayDialtone if either PlayDialtone or playRingtone is set
|
|
414
437
|
hidePhoneNumber = opts.hidePhoneNumber || false;
|
|
438
|
+
ringingTimeout = opts.ringingTimeout || undefined;
|
|
439
|
+
maxCallDuration = opts.maxCallDuration || undefined;
|
|
440
|
+
enableKrisp = opts.enableKrisp || undefined;
|
|
415
441
|
}
|
|
416
442
|
|
|
417
443
|
const req = new CreateSIPParticipantRequest({
|
|
@@ -425,6 +451,13 @@ export class SipClient extends ServiceBase {
|
|
|
425
451
|
playRingtone: playDialtone,
|
|
426
452
|
playDialtone: playDialtone,
|
|
427
453
|
hidePhoneNumber: hidePhoneNumber,
|
|
454
|
+
ringingTimeout: ringingTimeout
|
|
455
|
+
? new Duration({ seconds: BigInt(ringingTimeout) })
|
|
456
|
+
: undefined,
|
|
457
|
+
maxCallDuration: maxCallDuration
|
|
458
|
+
? new Duration({ seconds: BigInt(maxCallDuration) })
|
|
459
|
+
: undefined,
|
|
460
|
+
enableKrisp: enableKrisp,
|
|
428
461
|
}).toJson();
|
|
429
462
|
|
|
430
463
|
const data = await this.rpc.request(
|
package/src/TwirpRPC.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import type { JsonValue } from '@bufbuild/protobuf';
|
|
5
|
-
import camelcaseKeys from 'camelcase-keys';
|
|
6
5
|
|
|
7
6
|
// twirp RPC adapter for client implementation
|
|
8
7
|
|
|
@@ -51,6 +50,7 @@ export class TwirpRpc {
|
|
|
51
50
|
throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
|
|
52
51
|
}
|
|
53
52
|
const parsedResp = await response.json();
|
|
53
|
+
const camelcaseKeys = await import('camelcase-keys').then((mod) => mod.default);
|
|
54
54
|
return camelcaseKeys(parsedResp, { deep: true });
|
|
55
55
|
}
|
|
56
56
|
}
|