livekit-server-sdk 2.15.0 → 2.15.2
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.d.ts +11 -8
- 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 +4 -2
- package/dist/SipClient.cjs.map +1 -1
- package/dist/SipClient.d.cts +4 -0
- package/dist/SipClient.d.ts +25 -18
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +4 -2
- 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.d.ts +14 -11
- package/package.json +2 -2
- package/src/AccessToken.test.ts +1 -3
- package/src/AccessToken.ts +1 -1
- package/src/SipClient.ts +10 -0
package/dist/AccessToken.cjs
CHANGED
|
@@ -153,7 +153,7 @@ class AccessToken {
|
|
|
153
153
|
async toJwt() {
|
|
154
154
|
var _a;
|
|
155
155
|
const secret = new TextEncoder().encode(this.apiSecret);
|
|
156
|
-
const jwt = new jose.SignJWT((0, import_grants.claimsToJwtPayload)(this.grants)).setProtectedHeader({ alg: "HS256" }).setIssuer(this.apiKey).setExpirationTime(this.ttl).setNotBefore(
|
|
156
|
+
const jwt = new jose.SignJWT((0, import_grants.claimsToJwtPayload)(this.grants)).setProtectedHeader({ alg: "HS256" }).setIssuer(this.apiKey).setExpirationTime(this.ttl).setNotBefore(/* @__PURE__ */ new Date());
|
|
157
157
|
if (this.identity) {
|
|
158
158
|
jwt.setSubject(this.identity);
|
|
159
159
|
} else if ((_a = this.grants.video) == null ? void 0 : _a.roomJoin) {
|
package/dist/AccessToken.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AccessToken.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport * as jose from 'jose';\nimport type {\n ClaimGrants,\n InferenceGrant,\n ObservabilityGrant,\n SIPGrant,\n VideoGrant,\n} from './grants.js';\nimport { claimsToJwtPayload } from './grants.js';\n\n// 6 hours\nconst defaultTTL = `6h`;\n\nconst defaultClockToleranceSeconds = 10;\n\nexport interface AccessTokenOptions {\n /**\n * amount of time before expiration\n * expressed in seconds or a string describing a time span zeit/ms.\n * eg: '2 days', '10h', or seconds as numeric value\n */\n ttl?: number | string;\n\n /**\n * display name for the participant, available as `Participant.name`\n */\n name?: string;\n\n /**\n * identity of the user, required for room join tokens\n */\n identity?: string;\n\n /**\n * custom participant metadata\n */\n metadata?: string;\n\n /**\n * custom participant attributes\n */\n attributes?: Record<string, string>;\n}\n\nexport class AccessToken {\n private apiKey: string;\n\n private apiSecret: string;\n\n private grants: ClaimGrants;\n\n identity?: string;\n\n ttl: number | string;\n\n /**\n * Creates a new AccessToken\n * @param apiKey - API Key, can be set in env LIVEKIT_API_KEY\n * @param apiSecret - Secret, can be set in env LIVEKIT_API_SECRET\n */\n constructor(apiKey?: string, apiSecret?: string, options?: AccessTokenOptions) {\n if (!apiKey) {\n apiKey = process.env.LIVEKIT_API_KEY;\n }\n if (!apiSecret) {\n apiSecret = process.env.LIVEKIT_API_SECRET;\n }\n if (!apiKey || !apiSecret) {\n throw Error('api-key and api-secret must be set');\n }\n // @ts-expect-error we're not including dom lib for the server sdk so document is not defined\n else if (typeof document !== 'undefined') {\n // check against document rather than window because deno provides window\n console.error(\n 'You should not include your API secret in your web client bundle.\\n\\n' +\n 'Your web client should request a token from your backend server which should then use ' +\n 'the API secret to generate a token. See https://docs.livekit.io/client/connect/',\n );\n }\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n this.grants = {};\n this.identity = options?.identity;\n this.ttl = options?.ttl || defaultTTL;\n if (typeof this.ttl === 'number') {\n this.ttl = `${this.ttl}s`;\n }\n if (options?.metadata) {\n this.metadata = options.metadata;\n }\n if (options?.attributes) {\n this.attributes = options.attributes;\n }\n if (options?.name) {\n this.name = options.name;\n }\n }\n\n /**\n * Adds a video grant to this token.\n * @param grant -\n */\n addGrant(grant: VideoGrant) {\n this.grants.video = { ...(this.grants.video ?? {}), ...grant };\n }\n\n /**\n * Adds an inference grant to this token.\n * @param grant -\n */\n addInferenceGrant(grant: InferenceGrant) {\n this.grants.inference = { ...(this.grants.inference ?? {}), ...grant };\n }\n\n /**\n * Adds a SIP grant to this token.\n * @param grant -\n */\n addSIPGrant(grant: SIPGrant) {\n this.grants.sip = { ...(this.grants.sip ?? {}), ...grant };\n }\n\n /**\n * Adds an observability grant to this token.\n * @param grant -\n */\n addObservabilityGrant(grant: ObservabilityGrant) {\n this.grants.observability = { ...(this.grants.observability ?? {}), ...grant };\n }\n\n get name(): string | undefined {\n return this.grants.name;\n }\n\n set name(name: string) {\n this.grants.name = name;\n }\n\n get metadata(): string | undefined {\n return this.grants.metadata;\n }\n\n /**\n * Set metadata to be passed to the Participant, used only when joining the room\n */\n set metadata(md: string) {\n this.grants.metadata = md;\n }\n\n get attributes(): Record<string, string> | undefined {\n return this.grants.attributes;\n }\n\n set attributes(attrs: Record<string, string>) {\n this.grants.attributes = attrs;\n }\n\n get kind(): string | undefined {\n return this.grants.kind;\n }\n\n set kind(kind: string) {\n this.grants.kind = kind;\n }\n\n get sha256(): string | undefined {\n return this.grants.sha256;\n }\n\n set sha256(sha: string | undefined) {\n this.grants.sha256 = sha;\n }\n\n get roomPreset(): string | undefined {\n return this.grants.roomPreset;\n }\n\n set roomPreset(preset: string | undefined) {\n this.grants.roomPreset = preset;\n }\n\n get roomConfig(): RoomConfiguration | undefined {\n return this.grants.roomConfig;\n }\n\n set roomConfig(config: RoomConfiguration | undefined) {\n this.grants.roomConfig = config;\n }\n\n /**\n * @returns JWT encoded token\n */\n async toJwt(): Promise<string> {\n // TODO: check for video grant validity\n\n const secret = new TextEncoder().encode(this.apiSecret);\n\n const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants))\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.apiKey)\n .setExpirationTime(this.ttl)\n .setNotBefore(
|
|
1
|
+
{"version":3,"sources":["../src/AccessToken.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport * as jose from 'jose';\nimport type {\n ClaimGrants,\n InferenceGrant,\n ObservabilityGrant,\n SIPGrant,\n VideoGrant,\n} from './grants.js';\nimport { claimsToJwtPayload } from './grants.js';\n\n// 6 hours\nconst defaultTTL = `6h`;\n\nconst defaultClockToleranceSeconds = 10;\n\nexport interface AccessTokenOptions {\n /**\n * amount of time before expiration\n * expressed in seconds or a string describing a time span zeit/ms.\n * eg: '2 days', '10h', or seconds as numeric value\n */\n ttl?: number | string;\n\n /**\n * display name for the participant, available as `Participant.name`\n */\n name?: string;\n\n /**\n * identity of the user, required for room join tokens\n */\n identity?: string;\n\n /**\n * custom participant metadata\n */\n metadata?: string;\n\n /**\n * custom participant attributes\n */\n attributes?: Record<string, string>;\n}\n\nexport class AccessToken {\n private apiKey: string;\n\n private apiSecret: string;\n\n private grants: ClaimGrants;\n\n identity?: string;\n\n ttl: number | string;\n\n /**\n * Creates a new AccessToken\n * @param apiKey - API Key, can be set in env LIVEKIT_API_KEY\n * @param apiSecret - Secret, can be set in env LIVEKIT_API_SECRET\n */\n constructor(apiKey?: string, apiSecret?: string, options?: AccessTokenOptions) {\n if (!apiKey) {\n apiKey = process.env.LIVEKIT_API_KEY;\n }\n if (!apiSecret) {\n apiSecret = process.env.LIVEKIT_API_SECRET;\n }\n if (!apiKey || !apiSecret) {\n throw Error('api-key and api-secret must be set');\n }\n // @ts-expect-error we're not including dom lib for the server sdk so document is not defined\n else if (typeof document !== 'undefined') {\n // check against document rather than window because deno provides window\n console.error(\n 'You should not include your API secret in your web client bundle.\\n\\n' +\n 'Your web client should request a token from your backend server which should then use ' +\n 'the API secret to generate a token. See https://docs.livekit.io/client/connect/',\n );\n }\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n this.grants = {};\n this.identity = options?.identity;\n this.ttl = options?.ttl || defaultTTL;\n if (typeof this.ttl === 'number') {\n this.ttl = `${this.ttl}s`;\n }\n if (options?.metadata) {\n this.metadata = options.metadata;\n }\n if (options?.attributes) {\n this.attributes = options.attributes;\n }\n if (options?.name) {\n this.name = options.name;\n }\n }\n\n /**\n * Adds a video grant to this token.\n * @param grant -\n */\n addGrant(grant: VideoGrant) {\n this.grants.video = { ...(this.grants.video ?? {}), ...grant };\n }\n\n /**\n * Adds an inference grant to this token.\n * @param grant -\n */\n addInferenceGrant(grant: InferenceGrant) {\n this.grants.inference = { ...(this.grants.inference ?? {}), ...grant };\n }\n\n /**\n * Adds a SIP grant to this token.\n * @param grant -\n */\n addSIPGrant(grant: SIPGrant) {\n this.grants.sip = { ...(this.grants.sip ?? {}), ...grant };\n }\n\n /**\n * Adds an observability grant to this token.\n * @param grant -\n */\n addObservabilityGrant(grant: ObservabilityGrant) {\n this.grants.observability = { ...(this.grants.observability ?? {}), ...grant };\n }\n\n get name(): string | undefined {\n return this.grants.name;\n }\n\n set name(name: string) {\n this.grants.name = name;\n }\n\n get metadata(): string | undefined {\n return this.grants.metadata;\n }\n\n /**\n * Set metadata to be passed to the Participant, used only when joining the room\n */\n set metadata(md: string) {\n this.grants.metadata = md;\n }\n\n get attributes(): Record<string, string> | undefined {\n return this.grants.attributes;\n }\n\n set attributes(attrs: Record<string, string>) {\n this.grants.attributes = attrs;\n }\n\n get kind(): string | undefined {\n return this.grants.kind;\n }\n\n set kind(kind: string) {\n this.grants.kind = kind;\n }\n\n get sha256(): string | undefined {\n return this.grants.sha256;\n }\n\n set sha256(sha: string | undefined) {\n this.grants.sha256 = sha;\n }\n\n get roomPreset(): string | undefined {\n return this.grants.roomPreset;\n }\n\n set roomPreset(preset: string | undefined) {\n this.grants.roomPreset = preset;\n }\n\n get roomConfig(): RoomConfiguration | undefined {\n return this.grants.roomConfig;\n }\n\n set roomConfig(config: RoomConfiguration | undefined) {\n this.grants.roomConfig = config;\n }\n\n /**\n * @returns JWT encoded token\n */\n async toJwt(): Promise<string> {\n // TODO: check for video grant validity\n\n const secret = new TextEncoder().encode(this.apiSecret);\n\n const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants))\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.apiKey)\n .setExpirationTime(this.ttl)\n .setNotBefore(new Date());\n if (this.identity) {\n jwt.setSubject(this.identity);\n } else if (this.grants.video?.roomJoin) {\n throw Error('identity is required for join but not set');\n }\n return jwt.sign(secret);\n }\n}\n\nexport class TokenVerifier {\n private apiKey: string;\n\n private apiSecret: string;\n\n constructor(apiKey: string, apiSecret: string) {\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n }\n\n async verify(\n token: string,\n clockTolerance: string | number = defaultClockToleranceSeconds,\n ): Promise<ClaimGrants> {\n const secret = new TextEncoder().encode(this.apiSecret);\n const { payload } = await jose.jwtVerify(token, secret, {\n issuer: this.apiKey,\n clockTolerance,\n });\n if (!payload) {\n throw Error('invalid token');\n }\n\n return payload as ClaimGrants;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,WAAsB;AAQtB,oBAAmC;AAGnC,MAAM,aAAa;AAEnB,MAAM,+BAA+B;AA+B9B,MAAM,Y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,KAAK,MAAM,EACrB,kBAAkB,KAAK,GAAG,EAC1B,aAAa,oBAAI,KAAK,CAAC;AAC1B,QAAI,KAAK,UAAU;AACjB,UAAI,WAAW,KAAK,QAAQ;AAAA,IAC9B,YAAW,UAAK,OAAO,UAAZ,mBAAmB,UAAU;AACtC,YAAM,MAAM,2CAA2C;AAAA,IACzD;AACA,WAAO,IAAI,KAAK,MAAM;AAAA,EACxB;AACF;AAEO,MAAM,cAAc;AAAA,EAKzB,YAAY,QAAgB,WAAmB;AAC7C,SAAK,SAAS;AACd,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,MAAM,OACJ,OACA,iBAAkC,8BACZ;AACtB,UAAM,SAAS,IAAI,YAAY,EAAE,OAAO,KAAK,SAAS;AACtD,UAAM,EAAE,QAAQ,IAAI,MAAM,KAAK,UAAU,OAAO,QAAQ;AAAA,MACtD,QAAQ,KAAK;AAAA,MACb;AAAA,IACF,CAAC;AACD,QAAI,CAAC,SAAS;AACZ,YAAM,MAAM,eAAe;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/AccessToken.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { RoomConfiguration } from '@livekit/protocol';
|
|
2
|
+
import { VideoGrant, InferenceGrant, SIPGrant, ObservabilityGrant, ClaimGrants } from './grants.js';
|
|
3
|
+
import 'jose';
|
|
4
|
+
|
|
5
|
+
interface AccessTokenOptions {
|
|
4
6
|
/**
|
|
5
7
|
* amount of time before expiration
|
|
6
8
|
* expressed in seconds or a string describing a time span zeit/ms.
|
|
@@ -24,7 +26,7 @@ export interface AccessTokenOptions {
|
|
|
24
26
|
*/
|
|
25
27
|
attributes?: Record<string, string>;
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
declare class AccessToken {
|
|
28
30
|
private apiKey;
|
|
29
31
|
private apiSecret;
|
|
30
32
|
private grants;
|
|
@@ -78,10 +80,11 @@ export declare class AccessToken {
|
|
|
78
80
|
*/
|
|
79
81
|
toJwt(): Promise<string>;
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
declare class TokenVerifier {
|
|
82
84
|
private apiKey;
|
|
83
85
|
private apiSecret;
|
|
84
86
|
constructor(apiKey: string, apiSecret: string);
|
|
85
87
|
verify(token: string, clockTolerance?: string | number): Promise<ClaimGrants>;
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
|
|
90
|
+
export { AccessToken, type AccessTokenOptions, TokenVerifier };
|
package/dist/AccessToken.js
CHANGED
|
@@ -119,7 +119,7 @@ class AccessToken {
|
|
|
119
119
|
async toJwt() {
|
|
120
120
|
var _a;
|
|
121
121
|
const secret = new TextEncoder().encode(this.apiSecret);
|
|
122
|
-
const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants)).setProtectedHeader({ alg: "HS256" }).setIssuer(this.apiKey).setExpirationTime(this.ttl).setNotBefore(
|
|
122
|
+
const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants)).setProtectedHeader({ alg: "HS256" }).setIssuer(this.apiKey).setExpirationTime(this.ttl).setNotBefore(/* @__PURE__ */ new Date());
|
|
123
123
|
if (this.identity) {
|
|
124
124
|
jwt.setSubject(this.identity);
|
|
125
125
|
} else if ((_a = this.grants.video) == null ? void 0 : _a.roomJoin) {
|
package/dist/AccessToken.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AccessToken.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport * as jose from 'jose';\nimport type {\n ClaimGrants,\n InferenceGrant,\n ObservabilityGrant,\n SIPGrant,\n VideoGrant,\n} from './grants.js';\nimport { claimsToJwtPayload } from './grants.js';\n\n// 6 hours\nconst defaultTTL = `6h`;\n\nconst defaultClockToleranceSeconds = 10;\n\nexport interface AccessTokenOptions {\n /**\n * amount of time before expiration\n * expressed in seconds or a string describing a time span zeit/ms.\n * eg: '2 days', '10h', or seconds as numeric value\n */\n ttl?: number | string;\n\n /**\n * display name for the participant, available as `Participant.name`\n */\n name?: string;\n\n /**\n * identity of the user, required for room join tokens\n */\n identity?: string;\n\n /**\n * custom participant metadata\n */\n metadata?: string;\n\n /**\n * custom participant attributes\n */\n attributes?: Record<string, string>;\n}\n\nexport class AccessToken {\n private apiKey: string;\n\n private apiSecret: string;\n\n private grants: ClaimGrants;\n\n identity?: string;\n\n ttl: number | string;\n\n /**\n * Creates a new AccessToken\n * @param apiKey - API Key, can be set in env LIVEKIT_API_KEY\n * @param apiSecret - Secret, can be set in env LIVEKIT_API_SECRET\n */\n constructor(apiKey?: string, apiSecret?: string, options?: AccessTokenOptions) {\n if (!apiKey) {\n apiKey = process.env.LIVEKIT_API_KEY;\n }\n if (!apiSecret) {\n apiSecret = process.env.LIVEKIT_API_SECRET;\n }\n if (!apiKey || !apiSecret) {\n throw Error('api-key and api-secret must be set');\n }\n // @ts-expect-error we're not including dom lib for the server sdk so document is not defined\n else if (typeof document !== 'undefined') {\n // check against document rather than window because deno provides window\n console.error(\n 'You should not include your API secret in your web client bundle.\\n\\n' +\n 'Your web client should request a token from your backend server which should then use ' +\n 'the API secret to generate a token. See https://docs.livekit.io/client/connect/',\n );\n }\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n this.grants = {};\n this.identity = options?.identity;\n this.ttl = options?.ttl || defaultTTL;\n if (typeof this.ttl === 'number') {\n this.ttl = `${this.ttl}s`;\n }\n if (options?.metadata) {\n this.metadata = options.metadata;\n }\n if (options?.attributes) {\n this.attributes = options.attributes;\n }\n if (options?.name) {\n this.name = options.name;\n }\n }\n\n /**\n * Adds a video grant to this token.\n * @param grant -\n */\n addGrant(grant: VideoGrant) {\n this.grants.video = { ...(this.grants.video ?? {}), ...grant };\n }\n\n /**\n * Adds an inference grant to this token.\n * @param grant -\n */\n addInferenceGrant(grant: InferenceGrant) {\n this.grants.inference = { ...(this.grants.inference ?? {}), ...grant };\n }\n\n /**\n * Adds a SIP grant to this token.\n * @param grant -\n */\n addSIPGrant(grant: SIPGrant) {\n this.grants.sip = { ...(this.grants.sip ?? {}), ...grant };\n }\n\n /**\n * Adds an observability grant to this token.\n * @param grant -\n */\n addObservabilityGrant(grant: ObservabilityGrant) {\n this.grants.observability = { ...(this.grants.observability ?? {}), ...grant };\n }\n\n get name(): string | undefined {\n return this.grants.name;\n }\n\n set name(name: string) {\n this.grants.name = name;\n }\n\n get metadata(): string | undefined {\n return this.grants.metadata;\n }\n\n /**\n * Set metadata to be passed to the Participant, used only when joining the room\n */\n set metadata(md: string) {\n this.grants.metadata = md;\n }\n\n get attributes(): Record<string, string> | undefined {\n return this.grants.attributes;\n }\n\n set attributes(attrs: Record<string, string>) {\n this.grants.attributes = attrs;\n }\n\n get kind(): string | undefined {\n return this.grants.kind;\n }\n\n set kind(kind: string) {\n this.grants.kind = kind;\n }\n\n get sha256(): string | undefined {\n return this.grants.sha256;\n }\n\n set sha256(sha: string | undefined) {\n this.grants.sha256 = sha;\n }\n\n get roomPreset(): string | undefined {\n return this.grants.roomPreset;\n }\n\n set roomPreset(preset: string | undefined) {\n this.grants.roomPreset = preset;\n }\n\n get roomConfig(): RoomConfiguration | undefined {\n return this.grants.roomConfig;\n }\n\n set roomConfig(config: RoomConfiguration | undefined) {\n this.grants.roomConfig = config;\n }\n\n /**\n * @returns JWT encoded token\n */\n async toJwt(): Promise<string> {\n // TODO: check for video grant validity\n\n const secret = new TextEncoder().encode(this.apiSecret);\n\n const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants))\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.apiKey)\n .setExpirationTime(this.ttl)\n .setNotBefore(
|
|
1
|
+
{"version":3,"sources":["../src/AccessToken.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport * as jose from 'jose';\nimport type {\n ClaimGrants,\n InferenceGrant,\n ObservabilityGrant,\n SIPGrant,\n VideoGrant,\n} from './grants.js';\nimport { claimsToJwtPayload } from './grants.js';\n\n// 6 hours\nconst defaultTTL = `6h`;\n\nconst defaultClockToleranceSeconds = 10;\n\nexport interface AccessTokenOptions {\n /**\n * amount of time before expiration\n * expressed in seconds or a string describing a time span zeit/ms.\n * eg: '2 days', '10h', or seconds as numeric value\n */\n ttl?: number | string;\n\n /**\n * display name for the participant, available as `Participant.name`\n */\n name?: string;\n\n /**\n * identity of the user, required for room join tokens\n */\n identity?: string;\n\n /**\n * custom participant metadata\n */\n metadata?: string;\n\n /**\n * custom participant attributes\n */\n attributes?: Record<string, string>;\n}\n\nexport class AccessToken {\n private apiKey: string;\n\n private apiSecret: string;\n\n private grants: ClaimGrants;\n\n identity?: string;\n\n ttl: number | string;\n\n /**\n * Creates a new AccessToken\n * @param apiKey - API Key, can be set in env LIVEKIT_API_KEY\n * @param apiSecret - Secret, can be set in env LIVEKIT_API_SECRET\n */\n constructor(apiKey?: string, apiSecret?: string, options?: AccessTokenOptions) {\n if (!apiKey) {\n apiKey = process.env.LIVEKIT_API_KEY;\n }\n if (!apiSecret) {\n apiSecret = process.env.LIVEKIT_API_SECRET;\n }\n if (!apiKey || !apiSecret) {\n throw Error('api-key and api-secret must be set');\n }\n // @ts-expect-error we're not including dom lib for the server sdk so document is not defined\n else if (typeof document !== 'undefined') {\n // check against document rather than window because deno provides window\n console.error(\n 'You should not include your API secret in your web client bundle.\\n\\n' +\n 'Your web client should request a token from your backend server which should then use ' +\n 'the API secret to generate a token. See https://docs.livekit.io/client/connect/',\n );\n }\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n this.grants = {};\n this.identity = options?.identity;\n this.ttl = options?.ttl || defaultTTL;\n if (typeof this.ttl === 'number') {\n this.ttl = `${this.ttl}s`;\n }\n if (options?.metadata) {\n this.metadata = options.metadata;\n }\n if (options?.attributes) {\n this.attributes = options.attributes;\n }\n if (options?.name) {\n this.name = options.name;\n }\n }\n\n /**\n * Adds a video grant to this token.\n * @param grant -\n */\n addGrant(grant: VideoGrant) {\n this.grants.video = { ...(this.grants.video ?? {}), ...grant };\n }\n\n /**\n * Adds an inference grant to this token.\n * @param grant -\n */\n addInferenceGrant(grant: InferenceGrant) {\n this.grants.inference = { ...(this.grants.inference ?? {}), ...grant };\n }\n\n /**\n * Adds a SIP grant to this token.\n * @param grant -\n */\n addSIPGrant(grant: SIPGrant) {\n this.grants.sip = { ...(this.grants.sip ?? {}), ...grant };\n }\n\n /**\n * Adds an observability grant to this token.\n * @param grant -\n */\n addObservabilityGrant(grant: ObservabilityGrant) {\n this.grants.observability = { ...(this.grants.observability ?? {}), ...grant };\n }\n\n get name(): string | undefined {\n return this.grants.name;\n }\n\n set name(name: string) {\n this.grants.name = name;\n }\n\n get metadata(): string | undefined {\n return this.grants.metadata;\n }\n\n /**\n * Set metadata to be passed to the Participant, used only when joining the room\n */\n set metadata(md: string) {\n this.grants.metadata = md;\n }\n\n get attributes(): Record<string, string> | undefined {\n return this.grants.attributes;\n }\n\n set attributes(attrs: Record<string, string>) {\n this.grants.attributes = attrs;\n }\n\n get kind(): string | undefined {\n return this.grants.kind;\n }\n\n set kind(kind: string) {\n this.grants.kind = kind;\n }\n\n get sha256(): string | undefined {\n return this.grants.sha256;\n }\n\n set sha256(sha: string | undefined) {\n this.grants.sha256 = sha;\n }\n\n get roomPreset(): string | undefined {\n return this.grants.roomPreset;\n }\n\n set roomPreset(preset: string | undefined) {\n this.grants.roomPreset = preset;\n }\n\n get roomConfig(): RoomConfiguration | undefined {\n return this.grants.roomConfig;\n }\n\n set roomConfig(config: RoomConfiguration | undefined) {\n this.grants.roomConfig = config;\n }\n\n /**\n * @returns JWT encoded token\n */\n async toJwt(): Promise<string> {\n // TODO: check for video grant validity\n\n const secret = new TextEncoder().encode(this.apiSecret);\n\n const jwt = new jose.SignJWT(claimsToJwtPayload(this.grants))\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.apiKey)\n .setExpirationTime(this.ttl)\n .setNotBefore(new Date());\n if (this.identity) {\n jwt.setSubject(this.identity);\n } else if (this.grants.video?.roomJoin) {\n throw Error('identity is required for join but not set');\n }\n return jwt.sign(secret);\n }\n}\n\nexport class TokenVerifier {\n private apiKey: string;\n\n private apiSecret: string;\n\n constructor(apiKey: string, apiSecret: string) {\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n }\n\n async verify(\n token: string,\n clockTolerance: string | number = defaultClockToleranceSeconds,\n ): Promise<ClaimGrants> {\n const secret = new TextEncoder().encode(this.apiSecret);\n const { payload } = await jose.jwtVerify(token, secret, {\n issuer: this.apiKey,\n clockTolerance,\n });\n if (!payload) {\n throw Error('invalid token');\n }\n\n return payload as ClaimGrants;\n }\n}\n"],"mappings":"AAIA,YAAY,UAAU;AAQtB,SAAS,0BAA0B;AAGnC,MAAM,aAAa;AAEnB,MAAM,+BAA+B;AA+B9B,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBvB,YAAY,QAAiB,WAAoB,SAA8B;AAC7E,QAAI,CAAC,QAAQ;AACX,eAAS,QAAQ,IAAI;AAAA,IACvB;AACA,QAAI,CAAC,WAAW;AACd,kBAAY,QAAQ,IAAI;AAAA,IAC1B;AACA,QAAI,CAAC,UAAU,CAAC,WAAW;AACzB,YAAM,MAAM,oCAAoC;AAAA,IAClD,WAES,OAAO,aAAa,aAAa;AAExC,cAAQ;AAAA,QACN;AAAA,MAGF;AAAA,IACF;AACA,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,SAAK,SAAS,CAAC;AACf,SAAK,WAAW,mCAAS;AACzB,SAAK,OAAM,mCAAS,QAAO;AAC3B,QAAI,OAAO,KAAK,QAAQ,UAAU;AAChC,WAAK,MAAM,GAAG,KAAK,GAAG;AAAA,IACxB;AACA,QAAI,mCAAS,UAAU;AACrB,WAAK,WAAW,QAAQ;AA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,SAAS;AACZ,YAAM,MAAM,eAAe;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { AgentDispatch } from '@livekit/protocol';
|
|
2
|
-
import
|
|
2
|
+
import { ClientOptions } from './ClientOptions.js';
|
|
3
3
|
import { ServiceBase } from './ServiceBase.js';
|
|
4
|
+
import './grants.js';
|
|
5
|
+
import 'jose';
|
|
6
|
+
|
|
4
7
|
interface CreateDispatchOptions {
|
|
5
8
|
metadata?: string;
|
|
6
9
|
}
|
|
7
10
|
/**
|
|
8
11
|
* Client to access Agent APIs
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
declare class AgentDispatchClient extends ServiceBase {
|
|
11
14
|
private readonly rpc;
|
|
12
15
|
/**
|
|
13
16
|
* @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
|
|
@@ -45,5 +48,5 @@ export declare class AgentDispatchClient extends ServiceBase {
|
|
|
45
48
|
*/
|
|
46
49
|
listDispatch(roomName: string): Promise<AgentDispatch[]>;
|
|
47
50
|
}
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
export { AgentDispatchClient };
|
package/dist/ClientOptions.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options common to all clients
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type ClientOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Optional timeout, in seconds, for all server requests
|
|
7
7
|
*/
|
|
8
8
|
requestTimeout?: number;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
export type { ClientOptions };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { ClientOptions } from './ClientOptions.js';
|
|
1
|
+
import { RoomAgentDispatch, SessionDescription, ConnectTwilioCallRequest_TwilioCallDirection, DialWhatsAppCallResponse, AcceptWhatsAppCallResponse, ConnectWhatsAppCallResponse, DisconnectWhatsAppCallResponse, ConnectTwilioCallResponse } 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 DialWhatsAppCallOptions {
|
|
6
8
|
/** Required - The identifier of the WhatsApp phone number that is initiating the call */
|
|
7
9
|
whatsappPhoneNumberId: string;
|
|
8
10
|
/** Required - The number of the user that is supposed to receive the call */
|
|
@@ -30,7 +32,7 @@ export interface DialWhatsAppCallOptions {
|
|
|
30
32
|
/** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
|
|
31
33
|
destinationCountry?: string;
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
interface AcceptWhatsAppCallOptions {
|
|
34
36
|
/** Required - The identifier of the WhatsApp phone number that is connecting the call */
|
|
35
37
|
whatsappPhoneNumberId: string;
|
|
36
38
|
/** Required - The API key of the business that is connecting the call */
|
|
@@ -60,7 +62,7 @@ export interface AcceptWhatsAppCallOptions {
|
|
|
60
62
|
/** Optional - Country where the call terminates as ISO 3166-1 alpha-2 */
|
|
61
63
|
destinationCountry?: string;
|
|
62
64
|
}
|
|
63
|
-
|
|
65
|
+
interface ConnectTwilioCallOptions {
|
|
64
66
|
/** The direction of the call */
|
|
65
67
|
twilioCallDirection: ConnectTwilioCallRequest_TwilioCallDirection;
|
|
66
68
|
/** What LiveKit room should this call be connected to */
|
|
@@ -83,7 +85,7 @@ export interface ConnectTwilioCallOptions {
|
|
|
83
85
|
/**
|
|
84
86
|
* Client to access Connector APIs for WhatsApp and Twilio integrations
|
|
85
87
|
*/
|
|
86
|
-
|
|
88
|
+
declare class ConnectorClient extends ServiceBase {
|
|
87
89
|
private readonly rpc;
|
|
88
90
|
/**
|
|
89
91
|
* @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'
|
|
@@ -128,4 +130,5 @@ export declare class ConnectorClient extends ServiceBase {
|
|
|
128
130
|
*/
|
|
129
131
|
connectTwilioCall(options: ConnectTwilioCallOptions): Promise<ConnectTwilioCallResponse>;
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
|
|
134
|
+
export { type AcceptWhatsAppCallOptions, type ConnectTwilioCallOptions, ConnectorClient, type DialWhatsAppCallOptions };
|
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
|
@@ -109,7 +109,8 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
109
109
|
headersToAttributes: opts.headersToAttributes,
|
|
110
110
|
includeHeaders: opts.includeHeaders,
|
|
111
111
|
krispEnabled: opts.krispEnabled,
|
|
112
|
-
mediaEncryption: opts.mediaEncryption
|
|
112
|
+
mediaEncryption: opts.mediaEncryption,
|
|
113
|
+
ringingTimeout: opts.ringingTimeout ? new import_protobuf.Duration({ seconds: BigInt(opts.ringingTimeout) }) : void 0
|
|
113
114
|
})
|
|
114
115
|
}).toJson();
|
|
115
116
|
const data = await this.rpc.request(
|
|
@@ -506,7 +507,8 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
506
507
|
roomName,
|
|
507
508
|
transferTo,
|
|
508
509
|
playDialtone: opts.playDialtone,
|
|
509
|
-
headers: opts.headers
|
|
510
|
+
headers: opts.headers,
|
|
511
|
+
ringingTimeout: opts.ringingTimeout ? new import_protobuf.Duration({ seconds: BigInt(opts.ringingTimeout) }) : void 0
|
|
510
512
|
}).toJson();
|
|
511
513
|
await this.rpc.request(
|
|
512
514
|
svc,
|
package/dist/SipClient.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SipClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Duration } from '@bufbuild/protobuf';\nimport type {\n ListUpdate,\n Pagination,\n RoomConfiguration,\n SIPHeaderOptions,\n} from '@livekit/protocol';\nimport {\n CreateSIPDispatchRuleRequest,\n CreateSIPInboundTrunkRequest,\n CreateSIPOutboundTrunkRequest,\n CreateSIPParticipantRequest,\n CreateSIPTrunkRequest,\n DeleteSIPDispatchRuleRequest,\n DeleteSIPTrunkRequest,\n ListSIPDispatchRuleRequest,\n ListSIPDispatchRuleResponse,\n ListSIPInboundTrunkRequest,\n ListSIPInboundTrunkResponse,\n ListSIPOutboundTrunkRequest,\n ListSIPOutboundTrunkResponse,\n ListSIPTrunkRequest,\n ListSIPTrunkResponse,\n SIPDispatchRule,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPDispatchRuleInfo,\n SIPInboundTrunkInfo,\n SIPMediaEncryption,\n SIPOutboundConfig,\n SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n UpdateSIPDispatchRuleRequest,\n UpdateSIPInboundTrunkRequest,\n UpdateSIPOutboundTrunkRequest,\n} from '@livekit/protocol';\nimport type { ClientOptions } from './ClientOptions.js';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'SIP';\n\n/**\n * @deprecated use CreateSipInboundTrunkOptions or CreateSipOutboundTrunkOptions\n */\nexport interface CreateSipTrunkOptions {\n name?: string;\n metadata?: string;\n inbound_addresses?: string[];\n inbound_numbers?: string[];\n inbound_username?: string;\n inbound_password?: string;\n outbound_address?: string;\n outbound_username?: string;\n outbound_password?: string;\n}\nexport interface CreateSipInboundTrunkOptions {\n metadata?: string;\n /** @deprecated - use `allowedAddresses` instead */\n allowed_addresses?: string[];\n allowedAddresses?: string[];\n /** @deprecated - use `allowedNumbers` instead */\n allowed_numbers?: string[];\n allowedNumbers?: string[];\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n krispEnabled?: boolean;\n mediaEncryption?: SIPMediaEncryption;\n}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\n destinationCountry?: string;\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface SipDispatchRuleDirect {\n type: 'direct';\n roomName: string;\n pin?: string;\n}\n\nexport interface SipDispatchRuleIndividual {\n type: 'individual';\n roomPrefix: string;\n pin?: string;\n}\n\nexport interface CreateSipDispatchRuleOptions {\n name?: string;\n metadata?: string;\n trunkIds?: string[];\n hidePhoneNumber?: boolean;\n attributes?: { [key: string]: string };\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n\nexport interface CreateSipParticipantOptions {\n /** Optional SIP From number to use. If empty, trunk number is used. */\n fromNumber?: string;\n /** Optional identity of the SIP participant */\n participantIdentity?: string;\n /** Optional name of the participant */\n participantName?: string;\n /** Optional display name for the SIP participant */\n displayName?: string;\n /** Optional metadata to attach to the participant */\n participantMetadata?: string;\n /** Optional attributes to attach to the participant */\n participantAttributes?: { [key: string]: string };\n /** Optionally send following DTMF digits (extension codes) when making a call.\n * Character 'w' can be used to add a 0.5 sec delay. */\n dtmf?: string;\n /** @deprecated use `playDialtone` instead */\n playRingtone?: boolean;\n /** If `true`, the SIP Participant plays a dial tone to the room until the phone is picked up. */\n playDialtone?: boolean;\n /** These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. */\n headers?: { [key: string]: string };\n /** Map SIP response headers from INVITE to sip.h.* participant attributes automatically. */\n includeHeaders?: SIPHeaderOptions;\n hidePhoneNumber?: boolean;\n /** Maximum time for the call to ring in seconds. */\n ringingTimeout?: number;\n /** Maximum call duration in seconds. */\n maxCallDuration?: number;\n /** If `true`, Krisp noise cancellation will be enabled for the caller. */\n krispEnabled?: boolean;\n /** If `true`, this will wait until the call is answered before returning. */\n waitUntilAnswered?: boolean;\n /** Optional request timeout in seconds. default 60 seconds if waitUntilAnswered is true, otherwise 10 seconds */\n timeout?: number;\n}\n\nexport interface ListSipDispatchRuleOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Rule IDs to list. If this option is set, the response will contains rules in the same order. If any of the rules is missing, a nil item in that position will be sent in the response. */\n dispatchRuleIds?: string[];\n /** Only list rules that contain one of the Trunk IDs, including wildcard rules. */\n trunkIds?: string[];\n}\n\nexport interface ListSipTrunkOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Trunk IDs to list. If this option is set, the response will contains trunks in the same order. If any of the trunks is missing, a nil item in that position will be sent in the response. */\n trunkIds?: string[];\n /** Only list trunks that contain one of the numbers, including wildcard trunks. */\n numbers?: string[];\n}\n\nexport interface SipDispatchRuleUpdateOptions {\n trunkIds?: ListUpdate;\n rule?: SIPDispatchRule;\n name?: string;\n metadata?: string;\n attributes?: { [key: string]: string };\n}\n\nexport interface SipInboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n name?: string;\n metadata?: string;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface SipOutboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n destinationCountry?: string;\n name?: string;\n metadata?: string;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface TransferSipParticipantOptions {\n playDialtone?: boolean;\n headers?: { [key: string]: string };\n}\n\n/**\n * Client to access Egress APIs\n */\nexport class SipClient 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 * @param number - phone number of the trunk\n * @param opts - CreateSipTrunkOptions\n * @deprecated use `createSipInboundTrunk` or `createSipOutboundTrunk`\n */\n async createSipTrunk(number: string, opts?: CreateSipTrunkOptions): Promise<SIPTrunkInfo> {\n let inboundAddresses: string[] | undefined;\n let inboundNumbers: string[] | undefined;\n let inboundUsername: string = '';\n let inboundPassword: string = '';\n let outboundAddress: string = '';\n let outboundUsername: string = '';\n let outboundPassword: string = '';\n let name: string = '';\n let metadata: string = '';\n\n if (opts !== undefined) {\n inboundAddresses = opts.inbound_addresses;\n inboundNumbers = opts.inbound_numbers;\n inboundUsername = opts.inbound_username || '';\n inboundPassword = opts.inbound_password || '';\n outboundAddress = opts.outbound_address || '';\n outboundUsername = opts.outbound_username || '';\n outboundPassword = opts.outbound_password || '';\n name = opts.name || '';\n metadata = opts.metadata || '';\n }\n\n const req = new CreateSIPTrunkRequest({\n name: name,\n metadata: metadata,\n inboundAddresses: inboundAddresses,\n inboundNumbers: inboundNumbers,\n inboundUsername: inboundUsername,\n inboundPassword: inboundPassword,\n outboundNumber: number,\n outboundAddress: outboundAddress,\n outboundUsername: outboundUsername,\n outboundPassword: outboundPassword,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP inbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP inbound trunk\n */\n async createSipInboundTrunk(\n name: string,\n numbers: string[],\n opts?: CreateSipInboundTrunkOptions,\n ): Promise<SIPInboundTrunkInfo> {\n if (opts === undefined) {\n opts = {};\n }\n const req = new CreateSIPInboundTrunkRequest({\n trunk: new SIPInboundTrunkInfo({\n name: name,\n numbers: numbers,\n metadata: opts?.metadata,\n allowedAddresses: opts.allowedAddresses ?? opts.allowed_addresses,\n allowedNumbers: opts.allowedNumbers ?? opts.allowed_numbers,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n krispEnabled: opts.krispEnabled,\n mediaEncryption: opts.mediaEncryption,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP outbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param address - hostname and port of the SIP server to dial\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP outbound trunk\n */\n async createSipOutboundTrunk(\n name: string,\n address: string,\n numbers: string[],\n opts?: CreateSipOutboundTrunkOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n if (opts === undefined) {\n opts = {\n transport: SIPTransport.SIP_TRANSPORT_AUTO,\n };\n }\n\n const req = new CreateSIPOutboundTrunkRequest({\n trunk: new SIPOutboundTrunkInfo({\n name: name,\n address: address,\n numbers: numbers,\n metadata: opts.metadata,\n transport: opts.transport,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n destinationCountry: opts.destinationCountry,\n mediaEncryption: opts.mediaEncryption,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * @deprecated use `listSipInboundTrunk` or `listSipOutboundTrunk`\n */\n async listSipTrunk(): Promise<Array<SIPTrunkInfo>> {\n const req: Partial<ListSIPTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPTrunk',\n new ListSIPTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP inbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP inbound trunks\n */\n async listSipInboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPInboundTrunkInfo>> {\n const req = new ListSIPInboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP outbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP outbound trunks\n */\n async listSipOutboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPOutboundTrunkInfo>> {\n const req = new ListSIPOutboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP trunk.\n *\n * @param sipTrunkId - ID of the SIP trunk to delete\n * @returns Deleted trunk information\n */\n async deleteSipTrunk(sipTrunkId: string): Promise<SIPTrunkInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPTrunk',\n new DeleteSIPTrunkRequest({ sipTrunkId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP dispatch rule.\n *\n * @param rule - SIP dispatch rule to create\n * @param opts - CreateSipDispatchRuleOptions\n * @returns Created SIP dispatch rule\n */\n async createSipDispatchRule(\n rule: SipDispatchRuleDirect | SipDispatchRuleIndividual,\n opts?: CreateSipDispatchRuleOptions,\n ): Promise<SIPDispatchRuleInfo> {\n if (opts === undefined) {\n opts = {};\n }\n let ruleProto: SIPDispatchRule | undefined = undefined;\n if (rule.type == 'direct') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleDirect',\n value: new SIPDispatchRuleDirect({\n roomName: rule.roomName,\n pin: rule.pin || '',\n }),\n },\n });\n } else if (rule.type == 'individual') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleIndividual',\n value: new SIPDispatchRuleIndividual({\n roomPrefix: rule.roomPrefix,\n pin: rule.pin || '',\n }),\n },\n });\n }\n\n const req = new CreateSIPDispatchRuleRequest({\n rule: ruleProto,\n trunkIds: opts.trunkIds,\n hidePhoneNumber: opts.hidePhoneNumber,\n name: opts.name,\n metadata: opts.metadata,\n attributes: opts.attributes,\n roomPreset: opts.roomPreset,\n roomConfig: opts.roomConfig,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP dispatch rule by replacing it entirely.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param rule - new SIP dispatch rule\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRule(\n sipDispatchRuleId: string,\n rule: SIPDispatchRuleInfo,\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'replace',\n value: rule,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP dispatch rule.\n * Only provided fields will be updated.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param fields - Fields of the dispatch rule to update\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRuleFields(\n sipDispatchRuleId: string,\n fields: SipDispatchRuleUpdateOptions = {},\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP inbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param trunk - SIP inbound trunk to update with\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunk(\n sipTrunkId: string,\n trunk: SIPInboundTrunkInfo,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP inbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param fields - Fields of the inbound trunk to update\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunkFields(\n sipTrunkId: string,\n fields: SipInboundTrunkUpdateOptions,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP outbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param trunk - SIP outbound trunk to update with\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunk(\n sipTrunkId: string,\n trunk: SIPOutboundTrunkInfo,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP outbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param fields - Fields of the outbound trunk to update\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunkFields(\n sipTrunkId: string,\n fields: SipOutboundTrunkUpdateOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List SIP dispatch rules with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP dispatch rules\n */\n async listSipDispatchRule(\n list: ListSipDispatchRuleOptions = {},\n ): Promise<Array<SIPDispatchRuleInfo>> {\n const req = new ListSIPDispatchRuleRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP dispatch rule.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to delete\n * @returns Deleted rule information\n */\n async deleteSipDispatchRule(sipDispatchRuleId: string): Promise<SIPDispatchRuleInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPDispatchRule',\n new DeleteSIPDispatchRuleRequest({ sipDispatchRuleId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP participant.\n *\n * @param sipTrunkId - sip trunk to use for the call\n * @param number - number to dial\n * @param roomName - room to attach the call to\n * @param opts - CreateSipParticipantOptions\n * @param outboundTrunkConfig - Optional outbound trunk configuration for sip participant.\n * @returns Created SIP participant\n */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n outboundTrunkConfig?: SIPOutboundConfig,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n if (opts.timeout === undefined) {\n opts.timeout = opts.waitUntilAnswered ? 60 : 10;\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n trunk: outboundTrunkConfig,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\n displayName: opts.displayName,\n participantMetadata: opts.participantMetadata,\n participantAttributes: opts.participantAttributes,\n dtmf: opts.dtmf,\n playDialtone: opts.playDialtone ?? opts.playRingtone,\n headers: opts.headers,\n hidePhoneNumber: opts.hidePhoneNumber,\n includeHeaders: opts.includeHeaders,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n maxCallDuration: opts.maxCallDuration\n ? new Duration({ seconds: BigInt(opts.maxCallDuration) })\n : undefined,\n krispEnabled: opts.krispEnabled,\n waitUntilAnswered: opts.waitUntilAnswered,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPParticipant',\n req,\n await this.authHeader({}, { call: true }),\n opts.timeout,\n );\n return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Transfer a SIP participant to a different room.\n *\n * @param roomName - room the SIP participant to transfer is connectd to\n * @param participantIdentity - identity of the SIP participant to transfer\n * @param transferTo - SIP URL to transfer the participant to\n * @param opts - TransferSipParticipantOptions\n */\n async transferSipParticipant(\n roomName: string,\n participantIdentity: string,\n transferTo: string,\n opts?: TransferSipParticipantOptions,\n ): Promise<void> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new TransferSIPParticipantRequest({\n participantIdentity: participantIdentity,\n roomName: roomName,\n transferTo: transferTo,\n playDialtone: opts.playDialtone,\n headers: opts.headers,\n }).toJson();\n\n await this.rpc.request(\n svc,\n 'TransferSIPParticipant',\n req,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,MACA,MAAM,KAAK,WAAW,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,MACxC,KAAK;AAAA,IACP;AACA,WAAO,mCAAmB,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,uBACJ,UACA,qBACA,YACA,MACe;AACf,QAAI,SAAS,QAAW;AACtB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,MAAM,IAAI,8CAA8B;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc,KAAK;AAAA,MACnB,SAAS,KAAK;AAAA,IAChB,CAAC,EAAE,OAAO;AAEV,UAAM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,IAC3E;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/SipClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Duration } from '@bufbuild/protobuf';\nimport type {\n ListUpdate,\n Pagination,\n RoomConfiguration,\n SIPHeaderOptions,\n} from '@livekit/protocol';\nimport {\n CreateSIPDispatchRuleRequest,\n CreateSIPInboundTrunkRequest,\n CreateSIPOutboundTrunkRequest,\n CreateSIPParticipantRequest,\n CreateSIPTrunkRequest,\n DeleteSIPDispatchRuleRequest,\n DeleteSIPTrunkRequest,\n ListSIPDispatchRuleRequest,\n ListSIPDispatchRuleResponse,\n ListSIPInboundTrunkRequest,\n ListSIPInboundTrunkResponse,\n ListSIPOutboundTrunkRequest,\n ListSIPOutboundTrunkResponse,\n ListSIPTrunkRequest,\n ListSIPTrunkResponse,\n SIPDispatchRule,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPDispatchRuleInfo,\n SIPInboundTrunkInfo,\n SIPMediaEncryption,\n SIPOutboundConfig,\n SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n UpdateSIPDispatchRuleRequest,\n UpdateSIPInboundTrunkRequest,\n UpdateSIPOutboundTrunkRequest,\n} from '@livekit/protocol';\nimport type { ClientOptions } from './ClientOptions.js';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'SIP';\n\n/**\n * @deprecated use CreateSipInboundTrunkOptions or CreateSipOutboundTrunkOptions\n */\nexport interface CreateSipTrunkOptions {\n name?: string;\n metadata?: string;\n inbound_addresses?: string[];\n inbound_numbers?: string[];\n inbound_username?: string;\n inbound_password?: string;\n outbound_address?: string;\n outbound_username?: string;\n outbound_password?: string;\n}\nexport interface CreateSipInboundTrunkOptions {\n metadata?: string;\n /** @deprecated - use `allowedAddresses` instead */\n allowed_addresses?: string[];\n allowedAddresses?: string[];\n /** @deprecated - use `allowedNumbers` instead */\n allowed_numbers?: string[];\n allowedNumbers?: string[];\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n krispEnabled?: boolean;\n mediaEncryption?: SIPMediaEncryption;\n /** Maximum time for a call to ring in seconds. */\n ringingTimeout?: number;\n}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\n destinationCountry?: string;\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface SipDispatchRuleDirect {\n type: 'direct';\n roomName: string;\n pin?: string;\n}\n\nexport interface SipDispatchRuleIndividual {\n type: 'individual';\n roomPrefix: string;\n pin?: string;\n}\n\nexport interface CreateSipDispatchRuleOptions {\n name?: string;\n metadata?: string;\n trunkIds?: string[];\n hidePhoneNumber?: boolean;\n attributes?: { [key: string]: string };\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n\nexport interface CreateSipParticipantOptions {\n /** Optional SIP From number to use. If empty, trunk number is used. */\n fromNumber?: string;\n /** Optional identity of the SIP participant */\n participantIdentity?: string;\n /** Optional name of the participant */\n participantName?: string;\n /** Optional display name for the SIP participant */\n displayName?: string;\n /** Optional metadata to attach to the participant */\n participantMetadata?: string;\n /** Optional attributes to attach to the participant */\n participantAttributes?: { [key: string]: string };\n /** Optionally send following DTMF digits (extension codes) when making a call.\n * Character 'w' can be used to add a 0.5 sec delay. */\n dtmf?: string;\n /** @deprecated use `playDialtone` instead */\n playRingtone?: boolean;\n /** If `true`, the SIP Participant plays a dial tone to the room until the phone is picked up. */\n playDialtone?: boolean;\n /** These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. */\n headers?: { [key: string]: string };\n /** Map SIP response headers from INVITE to sip.h.* participant attributes automatically. */\n includeHeaders?: SIPHeaderOptions;\n hidePhoneNumber?: boolean;\n /** Maximum time for the call to ring in seconds. */\n ringingTimeout?: number;\n /** Maximum call duration in seconds. */\n maxCallDuration?: number;\n /** If `true`, Krisp noise cancellation will be enabled for the caller. */\n krispEnabled?: boolean;\n /** If `true`, this will wait until the call is answered before returning. */\n waitUntilAnswered?: boolean;\n /** Optional request timeout in seconds. default 60 seconds if waitUntilAnswered is true, otherwise 10 seconds */\n timeout?: number;\n}\n\nexport interface ListSipDispatchRuleOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Rule IDs to list. If this option is set, the response will contains rules in the same order. If any of the rules is missing, a nil item in that position will be sent in the response. */\n dispatchRuleIds?: string[];\n /** Only list rules that contain one of the Trunk IDs, including wildcard rules. */\n trunkIds?: string[];\n}\n\nexport interface ListSipTrunkOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Trunk IDs to list. If this option is set, the response will contains trunks in the same order. If any of the trunks is missing, a nil item in that position will be sent in the response. */\n trunkIds?: string[];\n /** Only list trunks that contain one of the numbers, including wildcard trunks. */\n numbers?: string[];\n}\n\nexport interface SipDispatchRuleUpdateOptions {\n trunkIds?: ListUpdate;\n rule?: SIPDispatchRule;\n name?: string;\n metadata?: string;\n attributes?: { [key: string]: string };\n}\n\nexport interface SipInboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n name?: string;\n metadata?: string;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface SipOutboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n destinationCountry?: string;\n name?: string;\n metadata?: string;\n mediaEncryption?: SIPMediaEncryption;\n}\n\nexport interface TransferSipParticipantOptions {\n playDialtone?: boolean;\n headers?: { [key: string]: string };\n /** Maximum time for the transfer destination to answer the call, in seconds. */\n ringingTimeout?: number;\n}\n\n/**\n * Client to access Egress APIs\n */\nexport class SipClient 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 * @param number - phone number of the trunk\n * @param opts - CreateSipTrunkOptions\n * @deprecated use `createSipInboundTrunk` or `createSipOutboundTrunk`\n */\n async createSipTrunk(number: string, opts?: CreateSipTrunkOptions): Promise<SIPTrunkInfo> {\n let inboundAddresses: string[] | undefined;\n let inboundNumbers: string[] | undefined;\n let inboundUsername: string = '';\n let inboundPassword: string = '';\n let outboundAddress: string = '';\n let outboundUsername: string = '';\n let outboundPassword: string = '';\n let name: string = '';\n let metadata: string = '';\n\n if (opts !== undefined) {\n inboundAddresses = opts.inbound_addresses;\n inboundNumbers = opts.inbound_numbers;\n inboundUsername = opts.inbound_username || '';\n inboundPassword = opts.inbound_password || '';\n outboundAddress = opts.outbound_address || '';\n outboundUsername = opts.outbound_username || '';\n outboundPassword = opts.outbound_password || '';\n name = opts.name || '';\n metadata = opts.metadata || '';\n }\n\n const req = new CreateSIPTrunkRequest({\n name: name,\n metadata: metadata,\n inboundAddresses: inboundAddresses,\n inboundNumbers: inboundNumbers,\n inboundUsername: inboundUsername,\n inboundPassword: inboundPassword,\n outboundNumber: number,\n outboundAddress: outboundAddress,\n outboundUsername: outboundUsername,\n outboundPassword: outboundPassword,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP inbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP inbound trunk\n */\n async createSipInboundTrunk(\n name: string,\n numbers: string[],\n opts?: CreateSipInboundTrunkOptions,\n ): Promise<SIPInboundTrunkInfo> {\n if (opts === undefined) {\n opts = {};\n }\n const req = new CreateSIPInboundTrunkRequest({\n trunk: new SIPInboundTrunkInfo({\n name: name,\n numbers: numbers,\n metadata: opts?.metadata,\n allowedAddresses: opts.allowedAddresses ?? opts.allowed_addresses,\n allowedNumbers: opts.allowedNumbers ?? opts.allowed_numbers,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n krispEnabled: opts.krispEnabled,\n mediaEncryption: opts.mediaEncryption,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP outbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param address - hostname and port of the SIP server to dial\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP outbound trunk\n */\n async createSipOutboundTrunk(\n name: string,\n address: string,\n numbers: string[],\n opts?: CreateSipOutboundTrunkOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n if (opts === undefined) {\n opts = {\n transport: SIPTransport.SIP_TRANSPORT_AUTO,\n };\n }\n\n const req = new CreateSIPOutboundTrunkRequest({\n trunk: new SIPOutboundTrunkInfo({\n name: name,\n address: address,\n numbers: numbers,\n metadata: opts.metadata,\n transport: opts.transport,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n destinationCountry: opts.destinationCountry,\n mediaEncryption: opts.mediaEncryption,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * @deprecated use `listSipInboundTrunk` or `listSipOutboundTrunk`\n */\n async listSipTrunk(): Promise<Array<SIPTrunkInfo>> {\n const req: Partial<ListSIPTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPTrunk',\n new ListSIPTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP inbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP inbound trunks\n */\n async listSipInboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPInboundTrunkInfo>> {\n const req = new ListSIPInboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP outbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP outbound trunks\n */\n async listSipOutboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPOutboundTrunkInfo>> {\n const req = new ListSIPOutboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP trunk.\n *\n * @param sipTrunkId - ID of the SIP trunk to delete\n * @returns Deleted trunk information\n */\n async deleteSipTrunk(sipTrunkId: string): Promise<SIPTrunkInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPTrunk',\n new DeleteSIPTrunkRequest({ sipTrunkId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP dispatch rule.\n *\n * @param rule - SIP dispatch rule to create\n * @param opts - CreateSipDispatchRuleOptions\n * @returns Created SIP dispatch rule\n */\n async createSipDispatchRule(\n rule: SipDispatchRuleDirect | SipDispatchRuleIndividual,\n opts?: CreateSipDispatchRuleOptions,\n ): Promise<SIPDispatchRuleInfo> {\n if (opts === undefined) {\n opts = {};\n }\n let ruleProto: SIPDispatchRule | undefined = undefined;\n if (rule.type == 'direct') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleDirect',\n value: new SIPDispatchRuleDirect({\n roomName: rule.roomName,\n pin: rule.pin || '',\n }),\n },\n });\n } else if (rule.type == 'individual') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleIndividual',\n value: new SIPDispatchRuleIndividual({\n roomPrefix: rule.roomPrefix,\n pin: rule.pin || '',\n }),\n },\n });\n }\n\n const req = new CreateSIPDispatchRuleRequest({\n rule: ruleProto,\n trunkIds: opts.trunkIds,\n hidePhoneNumber: opts.hidePhoneNumber,\n name: opts.name,\n metadata: opts.metadata,\n attributes: opts.attributes,\n roomPreset: opts.roomPreset,\n roomConfig: opts.roomConfig,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP dispatch rule by replacing it entirely.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param rule - new SIP dispatch rule\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRule(\n sipDispatchRuleId: string,\n rule: SIPDispatchRuleInfo,\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'replace',\n value: rule,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP dispatch rule.\n * Only provided fields will be updated.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param fields - Fields of the dispatch rule to update\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRuleFields(\n sipDispatchRuleId: string,\n fields: SipDispatchRuleUpdateOptions = {},\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP inbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param trunk - SIP inbound trunk to update with\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunk(\n sipTrunkId: string,\n trunk: SIPInboundTrunkInfo,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP inbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param fields - Fields of the inbound trunk to update\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunkFields(\n sipTrunkId: string,\n fields: SipInboundTrunkUpdateOptions,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP outbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param trunk - SIP outbound trunk to update with\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunk(\n sipTrunkId: string,\n trunk: SIPOutboundTrunkInfo,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP outbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param fields - Fields of the outbound trunk to update\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunkFields(\n sipTrunkId: string,\n fields: SipOutboundTrunkUpdateOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List SIP dispatch rules with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP dispatch rules\n */\n async listSipDispatchRule(\n list: ListSipDispatchRuleOptions = {},\n ): Promise<Array<SIPDispatchRuleInfo>> {\n const req = new ListSIPDispatchRuleRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP dispatch rule.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to delete\n * @returns Deleted rule information\n */\n async deleteSipDispatchRule(sipDispatchRuleId: string): Promise<SIPDispatchRuleInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPDispatchRule',\n new DeleteSIPDispatchRuleRequest({ sipDispatchRuleId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP participant.\n *\n * @param sipTrunkId - sip trunk to use for the call\n * @param number - number to dial\n * @param roomName - room to attach the call to\n * @param opts - CreateSipParticipantOptions\n * @param outboundTrunkConfig - Optional outbound trunk configuration for sip participant.\n * @returns Created SIP participant\n */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n outboundTrunkConfig?: SIPOutboundConfig,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n if (opts.timeout === undefined) {\n opts.timeout = opts.waitUntilAnswered ? 60 : 10;\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n trunk: outboundTrunkConfig,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\n displayName: opts.displayName,\n participantMetadata: opts.participantMetadata,\n participantAttributes: opts.participantAttributes,\n dtmf: opts.dtmf,\n playDialtone: opts.playDialtone ?? opts.playRingtone,\n headers: opts.headers,\n hidePhoneNumber: opts.hidePhoneNumber,\n includeHeaders: opts.includeHeaders,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n maxCallDuration: opts.maxCallDuration\n ? new Duration({ seconds: BigInt(opts.maxCallDuration) })\n : undefined,\n krispEnabled: opts.krispEnabled,\n waitUntilAnswered: opts.waitUntilAnswered,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPParticipant',\n req,\n await this.authHeader({}, { call: true }),\n opts.timeout,\n );\n return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Transfer a SIP participant to a different room.\n *\n * @param roomName - room the SIP participant to transfer is connectd to\n * @param participantIdentity - identity of the SIP participant to transfer\n * @param transferTo - SIP URL to transfer the participant to\n * @param opts - TransferSipParticipantOptions\n */\n async transferSipParticipant(\n roomName: string,\n participantIdentity: string,\n transferTo: string,\n opts?: TransferSipParticipantOptions,\n ): Promise<void> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new TransferSIPParticipantRequest({\n participantIdentity: participantIdentity,\n roomName: roomName,\n transferTo: transferTo,\n playDialtone: opts.playDialtone,\n headers: opts.headers,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n }).toJson();\n\n await this.rpc.request(\n svc,\n 'TransferSIPParticipant',\n req,\n await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AAOzB,sBA+BO;AAEP,yBAA4B;AAE5B,sBAAyC;AAEzC,MAAM,MAAM;AA8KL,MAAM,kBAAkB,+BAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzC,YAAY,MAAc,QAAiB,QAAiB,SAAyB;AACnF,UAAM,QAAQ,MAAM;AACpB,UAAM,cAAa,mCAAS,kBACxB,EAAE,gBAAgB,QAAQ,eAAe,IACzC;AACJ,SAAK,MAAM,IAAI,yBAAS,MAAM,gCAAgB,UAAU;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe,QAAgB,MAAqD;AACxF,Q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