livekit-server-sdk 2.12.0 → 2.13.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/dist/EgressClient.cjs +4 -1
- package/dist/EgressClient.cjs.map +1 -1
- package/dist/EgressClient.d.cts +6 -2
- package/dist/EgressClient.d.ts +6 -2
- package/dist/EgressClient.d.ts.map +1 -1
- package/dist/EgressClient.js +5 -1
- package/dist/EgressClient.js.map +1 -1
- package/dist/RoomServiceClient.cjs +19 -0
- package/dist/RoomServiceClient.cjs.map +1 -1
- package/dist/RoomServiceClient.d.cts +12 -0
- package/dist/RoomServiceClient.d.ts +12 -0
- package/dist/RoomServiceClient.d.ts.map +1 -1
- package/dist/RoomServiceClient.js +20 -0
- package/dist/RoomServiceClient.js.map +1 -1
- package/dist/SipClient.cjs +196 -14
- package/dist/SipClient.cjs.map +1 -1
- package/dist/SipClient.d.cts +150 -9
- package/dist/SipClient.d.ts +150 -9
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +200 -15
- package/dist/SipClient.js.map +1 -1
- package/dist/TwirpRPC.cjs +14 -6
- package/dist/TwirpRPC.cjs.map +1 -1
- package/dist/TwirpRPC.d.cts +7 -3
- package/dist/TwirpRPC.d.ts +7 -3
- package/dist/TwirpRPC.d.ts.map +1 -1
- package/dist/TwirpRPC.js +14 -6
- package/dist/TwirpRPC.js.map +1 -1
- package/dist/index.d.cts +1 -1
- package/package.json +2 -2
- package/src/EgressClient.ts +10 -0
- package/src/RoomServiceClient.ts +21 -0
- package/src/SipClient.ts +298 -26
- package/src/TwirpRPC.ts +37 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RoomServiceClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { DataPacket_Kind, RoomEgress, TrackInfo } from '@livekit/protocol';\nimport {\n CreateRoomRequest,\n DeleteRoomRequest,\n ForwardParticipantRequest,\n ListParticipantsRequest,\n ListParticipantsResponse,\n ListRoomsRequest,\n ListRoomsResponse,\n MuteRoomTrackRequest,\n MuteRoomTrackResponse,\n ParticipantInfo,\n ParticipantPermission,\n Room,\n RoomParticipantIdentity,\n SendDataRequest,\n UpdateParticipantRequest,\n UpdateRoomMetadataRequest,\n UpdateSubscriptionsRequest,\n} from '@livekit/protocol';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\nimport { getRandomBytes } from './crypto/uuid.js';\n\n/**\n * Options for when creating a room\n */\nexport interface CreateOptions {\n /**\n * name of the room. required\n */\n name: string;\n\n /**\n * number of seconds to keep the room open before any participant joins\n */\n emptyTimeout?: number;\n\n /**\n * number of seconds to keep the room open after the last participant leaves\n * this option is helpful to give a grace period for participants to re-join\n */\n departureTimeout?: number;\n\n /**\n * limit to the number of participants in a room at a time\n */\n maxParticipants?: number;\n\n /**\n * initial room metadata\n */\n metadata?: string;\n\n /**\n * add egress options\n */\n egress?: RoomEgress;\n\n /**\n * minimum playout delay in milliseconds\n */\n minPlayoutDelay?: number;\n\n /**\n * maximum playout delay in milliseconds\n */\n maxPlayoutDelay?: number;\n\n /**\n * improves A/V sync when min_playout_delay set to a value larger than 200ms.\n * It will disables transceiver re-use -- this option is not recommended\n * for rooms with frequent subscription changes\n */\n syncStreams?: boolean;\n\n /**\n * override the node room is allocated to, for debugging\n * does not work with Cloud\n */\n nodeId?: string;\n}\n\nexport type SendDataOptions = {\n /** If set, only deliver to listed participant identities */\n destinationIdentities?: string[];\n destinationSids?: string[];\n topic?: string;\n};\n\nexport type UpdateParticipantOptions = {\n /** only attributes you'd want to update should be set, set value to empty string to remove it */\n attributes?: { [key: string]: string };\n metadata?: string;\n /** permissions are updated atomically - all desired permissions would need to be set */\n permission?: Partial<ParticipantPermission>;\n name?: string;\n};\n\nconst svc = 'RoomService';\n\n/**\n * Client to access Room APIs\n */\nexport class RoomServiceClient extends ServiceBase {\n private readonly rpc: Rpc;\n\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 */\n constructor(host: string, apiKey?: string, secret?: string) {\n super(apiKey, secret);\n this.rpc = new TwirpRpc(host, livekitPackage);\n }\n\n /**\n * Creates a new room. Explicit room creation is not required, since rooms will\n * be automatically created when the first participant joins. This method can be\n * used to customize room settings.\n * @param options -\n */\n async createRoom(options: CreateOptions): Promise<Room> {\n const data = await this.rpc.request(\n svc,\n 'CreateRoom',\n new CreateRoomRequest(options).toJson(),\n await this.authHeader({ roomCreate: true }),\n );\n return Room.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List active rooms\n * @param names - when undefined or empty, list all rooms.\n * otherwise returns rooms with matching names\n * @returns\n */\n async listRooms(names?: string[]): Promise<Room[]> {\n const data = await this.rpc.request(\n svc,\n 'ListRooms',\n new ListRoomsRequest({ names: names ?? [] }).toJson(),\n await this.authHeader({ roomList: true }),\n );\n const res = ListRoomsResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.rooms ?? [];\n }\n\n async deleteRoom(room: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'DeleteRoom',\n new DeleteRoomRequest({ room }).toJson(),\n await this.authHeader({ roomCreate: true }),\n );\n }\n\n /**\n * Update metadata of a room\n * @param room - name of the room\n * @param metadata - the new metadata for the room\n */\n async updateRoomMetadata(room: string, metadata: string) {\n const data = await this.rpc.request(\n svc,\n 'UpdateRoomMetadata',\n new UpdateRoomMetadataRequest({ room, metadata }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n return Room.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List participants in a room\n * @param room - name of the room\n */\n async listParticipants(room: string): Promise<ParticipantInfo[]> {\n const data = await this.rpc.request(\n svc,\n 'ListParticipants',\n new ListParticipantsRequest({ room }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n const res = ListParticipantsResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.participants ?? [];\n }\n\n /**\n * Get information on a specific participant, including the tracks that participant\n * has published\n * @param room - name of the room\n * @param identity - identity of the participant to return\n */\n async getParticipant(room: string, identity: string): Promise<ParticipantInfo> {\n const data = await this.rpc.request(\n svc,\n 'GetParticipant',\n new RoomParticipantIdentity({ room, identity }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n\n return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Removes a participant in the room. This will disconnect the participant\n * and will emit a Disconnected event for that participant.\n * Even after being removed, the participant can still re-join the room.\n * @param room -\n * @param identity -\n */\n async removeParticipant(room: string, identity: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'RemoveParticipant',\n new RoomParticipantIdentity({ room, identity }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n\n /**\n * Forwards a participant's track to another room. This will create a\n * participant to join the destination room that has same information\n * with the source participant except the kind to be `Forwarded`. All\n * changes to the source participant will be reflected to the forwarded\n * participant. When the source participant disconnects or the\n * `RemoveParticipant` method is called in the destination room, the\n * forwarding will be stopped.\n */\n async forwardParticipant(room: string, identity: string, destinationRoom: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'ForwardParticipant',\n new ForwardParticipantRequest({ room, identity, destinationRoom }).toJson(),\n await this.authHeader({ roomAdmin: true, room, destinationRoom }),\n );\n }\n\n /**\n * Mutes a track that the participant has published.\n * @param room -\n * @param identity -\n * @param trackSid - sid of the track to be muted\n * @param muted - true to mute, false to unmute\n */\n async mutePublishedTrack(\n room: string,\n identity: string,\n trackSid: string,\n muted: boolean,\n ): Promise<TrackInfo> {\n const req = new MuteRoomTrackRequest({\n room,\n identity,\n trackSid,\n muted,\n }).toJson();\n const data = await this.rpc.request(\n svc,\n 'MutePublishedTrack',\n req,\n await this.authHeader({ roomAdmin: true, room }),\n );\n const res = MuteRoomTrackResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.track!;\n }\n\n /**\n * Updates a participant's state or permissions\n * @param room - target room\n * @param identity - participant identity\n * @param options - participant fields to update\n */\n async updateParticipant(\n room: string,\n identity: string,\n options: UpdateParticipantOptions,\n ): Promise<ParticipantInfo>;\n /**\n * Updates a participant's state or permissions\n * @param room - target room\n * @param identity - participant identity\n * @param options - participant fields to update\n */\n async updateParticipant(\n room: string,\n identity: string,\n metadata?: string,\n permission?: Partial<ParticipantPermission>,\n name?: string,\n ): Promise<ParticipantInfo>;\n async updateParticipant(\n room: string,\n identity: string,\n metadataOrOptions?: string | UpdateParticipantOptions,\n maybePermission?: Partial<ParticipantPermission>,\n maybeName?: string,\n ): Promise<ParticipantInfo> {\n const hasOptions = typeof metadataOrOptions === 'object';\n const metadata = hasOptions ? metadataOrOptions?.metadata : metadataOrOptions;\n const permission = hasOptions ? metadataOrOptions.permission : maybePermission;\n const name = hasOptions ? metadataOrOptions.name : maybeName;\n const attributes: Record<string, string> | undefined = hasOptions\n ? metadataOrOptions.attributes\n : {};\n\n const req = new UpdateParticipantRequest({\n room,\n identity,\n attributes,\n metadata,\n name,\n });\n if (permission) {\n req.permission = new ParticipantPermission(permission);\n }\n const data = await this.rpc.request(\n svc,\n 'UpdateParticipant',\n req.toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates a participant's subscription to tracks\n * @param room -\n * @param identity -\n * @param trackSids -\n * @param subscribe - true to subscribe, false to unsubscribe\n */\n async updateSubscriptions(\n room: string,\n identity: string,\n trackSids: string[],\n subscribe: boolean,\n ): Promise<void> {\n const req = new UpdateSubscriptionsRequest({\n room,\n identity,\n trackSids,\n subscribe,\n participantTracks: [],\n }).toJson();\n await this.rpc.request(\n svc,\n 'UpdateSubscriptions',\n req,\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n\n /**\n * Sends data message to participants in the room\n * @param room -\n * @param data - opaque payload to send\n * @param kind - delivery reliability\n * @param options - optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)\n */\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n options: SendDataOptions,\n ): Promise<void>;\n /**\n * Sends data message to participants in the room\n * @deprecated use sendData(room, data, kind, options) instead\n * @param room -\n * @param data - opaque payload to send\n * @param kind - delivery reliability\n * @param destinationSids - optional. when empty, message is sent to everyone\n */\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n destinationSids?: string[],\n ): Promise<void>;\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n options: SendDataOptions | string[] = {},\n ): Promise<void> {\n const destinationSids = Array.isArray(options) ? options : options.destinationSids;\n const topic = Array.isArray(options) ? undefined : options.topic;\n const req = new SendDataRequest({\n room,\n data,\n kind,\n destinationSids: destinationSids ?? [],\n topic,\n });\n if (!Array.isArray(options) && options.destinationIdentities) {\n req.destinationIdentities = options.destinationIdentities;\n }\n req.nonce = await getRandomBytes(16);\n await this.rpc.request(\n svc,\n 'SendData',\n req.toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n}\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,OACK;AACP,SAAS,mBAAmB;AAE5B,SAAS,UAAU,sBAAsB;AACzC,SAAS,sBAAsB;AA6E/B,MAAM,MAAM;AAKL,MAAM,0BAA0B,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASjD,YAAY,MAAc,QAAiB,QAAiB;AAC1D,UAAM,QAAQ,MAAM;AACpB,SAAK,MAAM,IAAI,SAAS,MAAM,cAAc;AA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,2BAA2B;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB,CAAC;AAAA,IACtB,CAAC,EAAE,OAAO;AACV,UAAM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,KAAK,CAAC;AAAA,IACjD;AAAA,EACF;AAAA,EA6BA,MAAM,SACJ,MACA,MACA,MACA,UAAsC,CAAC,GACxB;AACf,UAAM,kBAAkB,MAAM,QAAQ,OAAO,IAAI,UAAU,QAAQ;AACnE,UAAM,QAAQ,MAAM,QAAQ,OAAO,IAAI,SAAY,QAAQ;AAC3D,UAAM,MAAM,IAAI,gBAAgB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB,mBAAmB,CAAC;AAAA,MACrC;AAAA,IACF,CAAC;AACD,QAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,QAAQ,uBAAuB;AAC5D,UAAI,wBAAwB,QAAQ;AAAA,IACtC;AACA,QAAI,QAAQ,MAAM,eAAe,EAAE;AACnC,UAAM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA,IAAI,OAAO;AAAA,MACX,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,KAAK,CAAC;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/RoomServiceClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { DataPacket_Kind, RoomEgress, TrackInfo } from '@livekit/protocol';\nimport {\n CreateRoomRequest,\n DeleteRoomRequest,\n ForwardParticipantRequest,\n ListParticipantsRequest,\n ListParticipantsResponse,\n ListRoomsRequest,\n ListRoomsResponse,\n MoveParticipantRequest,\n MuteRoomTrackRequest,\n MuteRoomTrackResponse,\n ParticipantInfo,\n ParticipantPermission,\n Room,\n RoomParticipantIdentity,\n SendDataRequest,\n UpdateParticipantRequest,\n UpdateRoomMetadataRequest,\n UpdateSubscriptionsRequest,\n} from '@livekit/protocol';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\nimport { getRandomBytes } from './crypto/uuid.js';\n\n/**\n * Options for when creating a room\n */\nexport interface CreateOptions {\n /**\n * name of the room. required\n */\n name: string;\n\n /**\n * number of seconds to keep the room open before any participant joins\n */\n emptyTimeout?: number;\n\n /**\n * number of seconds to keep the room open after the last participant leaves\n * this option is helpful to give a grace period for participants to re-join\n */\n departureTimeout?: number;\n\n /**\n * limit to the number of participants in a room at a time\n */\n maxParticipants?: number;\n\n /**\n * initial room metadata\n */\n metadata?: string;\n\n /**\n * add egress options\n */\n egress?: RoomEgress;\n\n /**\n * minimum playout delay in milliseconds\n */\n minPlayoutDelay?: number;\n\n /**\n * maximum playout delay in milliseconds\n */\n maxPlayoutDelay?: number;\n\n /**\n * improves A/V sync when min_playout_delay set to a value larger than 200ms.\n * It will disables transceiver re-use -- this option is not recommended\n * for rooms with frequent subscription changes\n */\n syncStreams?: boolean;\n\n /**\n * override the node room is allocated to, for debugging\n * does not work with Cloud\n */\n nodeId?: string;\n}\n\nexport type SendDataOptions = {\n /** If set, only deliver to listed participant identities */\n destinationIdentities?: string[];\n destinationSids?: string[];\n topic?: string;\n};\n\nexport type UpdateParticipantOptions = {\n /** only attributes you'd want to update should be set, set value to empty string to remove it */\n attributes?: { [key: string]: string };\n metadata?: string;\n /** permissions are updated atomically - all desired permissions would need to be set */\n permission?: Partial<ParticipantPermission>;\n name?: string;\n};\n\nconst svc = 'RoomService';\n\n/**\n * Client to access Room APIs\n */\nexport class RoomServiceClient extends ServiceBase {\n private readonly rpc: Rpc;\n\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 */\n constructor(host: string, apiKey?: string, secret?: string) {\n super(apiKey, secret);\n this.rpc = new TwirpRpc(host, livekitPackage);\n }\n\n /**\n * Creates a new room. Explicit room creation is not required, since rooms will\n * be automatically created when the first participant joins. This method can be\n * used to customize room settings.\n * @param options -\n */\n async createRoom(options: CreateOptions): Promise<Room> {\n const data = await this.rpc.request(\n svc,\n 'CreateRoom',\n new CreateRoomRequest(options).toJson(),\n await this.authHeader({ roomCreate: true }),\n );\n return Room.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List active rooms\n * @param names - when undefined or empty, list all rooms.\n * otherwise returns rooms with matching names\n * @returns\n */\n async listRooms(names?: string[]): Promise<Room[]> {\n const data = await this.rpc.request(\n svc,\n 'ListRooms',\n new ListRoomsRequest({ names: names ?? [] }).toJson(),\n await this.authHeader({ roomList: true }),\n );\n const res = ListRoomsResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.rooms ?? [];\n }\n\n async deleteRoom(room: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'DeleteRoom',\n new DeleteRoomRequest({ room }).toJson(),\n await this.authHeader({ roomCreate: true }),\n );\n }\n\n /**\n * Update metadata of a room\n * @param room - name of the room\n * @param metadata - the new metadata for the room\n */\n async updateRoomMetadata(room: string, metadata: string) {\n const data = await this.rpc.request(\n svc,\n 'UpdateRoomMetadata',\n new UpdateRoomMetadataRequest({ room, metadata }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n return Room.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List participants in a room\n * @param room - name of the room\n */\n async listParticipants(room: string): Promise<ParticipantInfo[]> {\n const data = await this.rpc.request(\n svc,\n 'ListParticipants',\n new ListParticipantsRequest({ room }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n const res = ListParticipantsResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.participants ?? [];\n }\n\n /**\n * Get information on a specific participant, including the tracks that participant\n * has published\n * @param room - name of the room\n * @param identity - identity of the participant to return\n */\n async getParticipant(room: string, identity: string): Promise<ParticipantInfo> {\n const data = await this.rpc.request(\n svc,\n 'GetParticipant',\n new RoomParticipantIdentity({ room, identity }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n\n return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Removes a participant in the room. This will disconnect the participant\n * and will emit a Disconnected event for that participant.\n * Even after being removed, the participant can still re-join the room.\n * @param room -\n * @param identity -\n */\n async removeParticipant(room: string, identity: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'RemoveParticipant',\n new RoomParticipantIdentity({ room, identity }).toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n\n /**\n * Forwards a participant's track to another room. This will create a\n * participant to join the destination room that has same information\n * with the source participant except the kind to be `Forwarded`. All\n * changes to the source participant will be reflected to the forwarded\n * participant. When the source participant disconnects or the\n * `RemoveParticipant` method is called in the destination room, the\n * forwarding will be stopped.\n * @param room -\n * @param identity -\n * @param destinationRoom - the room to forward the participant to\n */\n async forwardParticipant(room: string, identity: string, destinationRoom: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'ForwardParticipant',\n new ForwardParticipantRequest({ room, identity, destinationRoom }).toJson(),\n await this.authHeader({ roomAdmin: true, room, destinationRoom }),\n );\n }\n\n /**\n * Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`.\n * The participant will be removed from the current room and added to the destination room.\n * From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one.\n * @param room -\n * @param identity -\n * @param destinationRoom - the room to move the participant to\n */\n async moveParticipant(room: string, identity: string, destinationRoom: string): Promise<void> {\n await this.rpc.request(\n svc,\n 'MoveParticipant',\n new MoveParticipantRequest({ room, identity, destinationRoom }).toJson(),\n await this.authHeader({ roomAdmin: true, room, destinationRoom }),\n );\n }\n\n /**\n * Mutes a track that the participant has published.\n * @param room -\n * @param identity -\n * @param trackSid - sid of the track to be muted\n * @param muted - true to mute, false to unmute\n */\n async mutePublishedTrack(\n room: string,\n identity: string,\n trackSid: string,\n muted: boolean,\n ): Promise<TrackInfo> {\n const req = new MuteRoomTrackRequest({\n room,\n identity,\n trackSid,\n muted,\n }).toJson();\n const data = await this.rpc.request(\n svc,\n 'MutePublishedTrack',\n req,\n await this.authHeader({ roomAdmin: true, room }),\n );\n const res = MuteRoomTrackResponse.fromJson(data, { ignoreUnknownFields: true });\n return res.track!;\n }\n\n /**\n * Updates a participant's state or permissions\n * @param room - target room\n * @param identity - participant identity\n * @param options - participant fields to update\n */\n async updateParticipant(\n room: string,\n identity: string,\n options: UpdateParticipantOptions,\n ): Promise<ParticipantInfo>;\n /**\n * Updates a participant's state or permissions\n * @param room - target room\n * @param identity - participant identity\n * @param options - participant fields to update\n */\n async updateParticipant(\n room: string,\n identity: string,\n metadata?: string,\n permission?: Partial<ParticipantPermission>,\n name?: string,\n ): Promise<ParticipantInfo>;\n async updateParticipant(\n room: string,\n identity: string,\n metadataOrOptions?: string | UpdateParticipantOptions,\n maybePermission?: Partial<ParticipantPermission>,\n maybeName?: string,\n ): Promise<ParticipantInfo> {\n const hasOptions = typeof metadataOrOptions === 'object';\n const metadata = hasOptions ? metadataOrOptions?.metadata : metadataOrOptions;\n const permission = hasOptions ? metadataOrOptions.permission : maybePermission;\n const name = hasOptions ? metadataOrOptions.name : maybeName;\n const attributes: Record<string, string> | undefined = hasOptions\n ? metadataOrOptions.attributes\n : {};\n\n const req = new UpdateParticipantRequest({\n room,\n identity,\n attributes,\n metadata,\n name,\n });\n if (permission) {\n req.permission = new ParticipantPermission(permission);\n }\n const data = await this.rpc.request(\n svc,\n 'UpdateParticipant',\n req.toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n return ParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates a participant's subscription to tracks\n * @param room -\n * @param identity -\n * @param trackSids -\n * @param subscribe - true to subscribe, false to unsubscribe\n */\n async updateSubscriptions(\n room: string,\n identity: string,\n trackSids: string[],\n subscribe: boolean,\n ): Promise<void> {\n const req = new UpdateSubscriptionsRequest({\n room,\n identity,\n trackSids,\n subscribe,\n participantTracks: [],\n }).toJson();\n await this.rpc.request(\n svc,\n 'UpdateSubscriptions',\n req,\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n\n /**\n * Sends data message to participants in the room\n * @param room -\n * @param data - opaque payload to send\n * @param kind - delivery reliability\n * @param options - optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)\n */\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n options: SendDataOptions,\n ): Promise<void>;\n /**\n * Sends data message to participants in the room\n * @deprecated use sendData(room, data, kind, options) instead\n * @param room -\n * @param data - opaque payload to send\n * @param kind - delivery reliability\n * @param destinationSids - optional. when empty, message is sent to everyone\n */\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n destinationSids?: string[],\n ): Promise<void>;\n async sendData(\n room: string,\n data: Uint8Array,\n kind: DataPacket_Kind,\n options: SendDataOptions | string[] = {},\n ): Promise<void> {\n const destinationSids = Array.isArray(options) ? options : options.destinationSids;\n const topic = Array.isArray(options) ? undefined : options.topic;\n const req = new SendDataRequest({\n room,\n data,\n kind,\n destinationSids: destinationSids ?? [],\n topic,\n });\n if (!Array.isArray(options) && options.destinationIdentities) {\n req.destinationIdentities = options.destinationIdentities;\n }\n req.nonce = await getRandomBytes(16);\n await this.rpc.request(\n svc,\n 'SendData',\n req.toJson(),\n await this.authHeader({ roomAdmin: true, room }),\n );\n }\n}\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,OACK;AACP,SAAS,mBAAmB;AAE5B,SAAS,UAAU,sBAAsB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AM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA,IAAI,OAAO;AAAA,MACX,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,KAAK,CAAC;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
|
package/dist/SipClient.cjs
CHANGED
|
@@ -83,9 +83,12 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
83
83
|
return import_protocol.SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
+
* Create a new SIP inbound trunk.
|
|
87
|
+
*
|
|
86
88
|
* @param name - human-readable name of the trunk
|
|
87
89
|
* @param numbers - phone numbers of the trunk
|
|
88
90
|
* @param opts - CreateSipTrunkOptions
|
|
91
|
+
* @returns Created SIP inbound trunk
|
|
89
92
|
*/
|
|
90
93
|
async createSipInboundTrunk(name, numbers, opts) {
|
|
91
94
|
if (opts === void 0) {
|
|
@@ -115,10 +118,13 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
115
118
|
return import_protocol.SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
121
|
+
* Create a new SIP outbound trunk.
|
|
122
|
+
*
|
|
118
123
|
* @param name - human-readable name of the trunk
|
|
119
124
|
* @param address - hostname and port of the SIP server to dial
|
|
120
125
|
* @param numbers - phone numbers of the trunk
|
|
121
126
|
* @param opts - CreateSipTrunkOptions
|
|
127
|
+
* @returns Created SIP outbound trunk
|
|
122
128
|
*/
|
|
123
129
|
async createSipOutboundTrunk(name, address, numbers, opts) {
|
|
124
130
|
if (opts === void 0) {
|
|
@@ -161,28 +167,43 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
161
167
|
);
|
|
162
168
|
return import_protocol.ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
163
169
|
}
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
/**
|
|
171
|
+
* List SIP inbound trunks with optional filtering.
|
|
172
|
+
*
|
|
173
|
+
* @param list - Request with optional filtering parameters
|
|
174
|
+
* @returns Response containing list of SIP inbound trunks
|
|
175
|
+
*/
|
|
176
|
+
async listSipInboundTrunk(list = {}) {
|
|
177
|
+
const req = new import_protocol.ListSIPInboundTrunkRequest(list).toJson();
|
|
166
178
|
const data = await this.rpc.request(
|
|
167
179
|
svc,
|
|
168
180
|
"ListSIPInboundTrunk",
|
|
169
|
-
|
|
181
|
+
req,
|
|
170
182
|
await this.authHeader({}, { admin: true })
|
|
171
183
|
);
|
|
172
184
|
return import_protocol.ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
173
185
|
}
|
|
174
|
-
|
|
175
|
-
|
|
186
|
+
/**
|
|
187
|
+
* List SIP outbound trunks with optional filtering.
|
|
188
|
+
*
|
|
189
|
+
* @param list - Request with optional filtering parameters
|
|
190
|
+
* @returns Response containing list of SIP outbound trunks
|
|
191
|
+
*/
|
|
192
|
+
async listSipOutboundTrunk(list = {}) {
|
|
193
|
+
const req = new import_protocol.ListSIPOutboundTrunkRequest(list).toJson();
|
|
176
194
|
const data = await this.rpc.request(
|
|
177
195
|
svc,
|
|
178
196
|
"ListSIPOutboundTrunk",
|
|
179
|
-
|
|
197
|
+
req,
|
|
180
198
|
await this.authHeader({}, { admin: true })
|
|
181
199
|
);
|
|
182
200
|
return import_protocol.ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
183
201
|
}
|
|
184
202
|
/**
|
|
185
|
-
*
|
|
203
|
+
* Delete a SIP trunk.
|
|
204
|
+
*
|
|
205
|
+
* @param sipTrunkId - ID of the SIP trunk to delete
|
|
206
|
+
* @returns Deleted trunk information
|
|
186
207
|
*/
|
|
187
208
|
async deleteSipTrunk(sipTrunkId) {
|
|
188
209
|
const data = await this.rpc.request(
|
|
@@ -194,8 +215,11 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
194
215
|
return import_protocol.SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
195
216
|
}
|
|
196
217
|
/**
|
|
197
|
-
*
|
|
218
|
+
* Create a new SIP dispatch rule.
|
|
219
|
+
*
|
|
220
|
+
* @param rule - SIP dispatch rule to create
|
|
198
221
|
* @param opts - CreateSipDispatchRuleOptions
|
|
222
|
+
* @returns Created SIP dispatch rule
|
|
199
223
|
*/
|
|
200
224
|
async createSipDispatchRule(rule, opts) {
|
|
201
225
|
if (opts === void 0) {
|
|
@@ -241,18 +265,168 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
241
265
|
);
|
|
242
266
|
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
243
267
|
}
|
|
244
|
-
|
|
245
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Updates an existing SIP dispatch rule by replacing it entirely.
|
|
270
|
+
*
|
|
271
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to update
|
|
272
|
+
* @param rule - new SIP dispatch rule
|
|
273
|
+
* @returns Updated SIP dispatch rule
|
|
274
|
+
*/
|
|
275
|
+
async updateSipDispatchRule(sipDispatchRuleId, rule) {
|
|
276
|
+
const req = new import_protocol.UpdateSIPDispatchRuleRequest({
|
|
277
|
+
sipDispatchRuleId,
|
|
278
|
+
action: {
|
|
279
|
+
case: "replace",
|
|
280
|
+
value: rule
|
|
281
|
+
}
|
|
282
|
+
}).toJson();
|
|
283
|
+
const data = await this.rpc.request(
|
|
284
|
+
svc,
|
|
285
|
+
"UpdateSIPDispatchRule",
|
|
286
|
+
req,
|
|
287
|
+
await this.authHeader({}, { admin: true })
|
|
288
|
+
);
|
|
289
|
+
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Updates specific fields of an existing SIP dispatch rule.
|
|
293
|
+
* Only provided fields will be updated.
|
|
294
|
+
*
|
|
295
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to update
|
|
296
|
+
* @param fields - Fields of the dispatch rule to update
|
|
297
|
+
* @returns Updated SIP dispatch rule
|
|
298
|
+
*/
|
|
299
|
+
async updateSipDispatchRuleFields(sipDispatchRuleId, fields = {}) {
|
|
300
|
+
const req = new import_protocol.UpdateSIPDispatchRuleRequest({
|
|
301
|
+
sipDispatchRuleId,
|
|
302
|
+
action: {
|
|
303
|
+
case: "update",
|
|
304
|
+
value: fields
|
|
305
|
+
}
|
|
306
|
+
}).toJson();
|
|
307
|
+
const data = await this.rpc.request(
|
|
308
|
+
svc,
|
|
309
|
+
"UpdateSIPDispatchRule",
|
|
310
|
+
req,
|
|
311
|
+
await this.authHeader({}, { admin: true })
|
|
312
|
+
);
|
|
313
|
+
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Updates an existing SIP inbound trunk by replacing it entirely.
|
|
317
|
+
*
|
|
318
|
+
* @param sipTrunkId - ID of the SIP inbound trunk to update
|
|
319
|
+
* @param trunk - SIP inbound trunk to update with
|
|
320
|
+
* @returns Updated SIP inbound trunk
|
|
321
|
+
*/
|
|
322
|
+
async updateSipInboundTrunk(sipTrunkId, trunk) {
|
|
323
|
+
const req = new import_protocol.UpdateSIPInboundTrunkRequest({
|
|
324
|
+
sipTrunkId,
|
|
325
|
+
action: {
|
|
326
|
+
case: "replace",
|
|
327
|
+
value: trunk
|
|
328
|
+
}
|
|
329
|
+
}).toJson();
|
|
330
|
+
const data = await this.rpc.request(
|
|
331
|
+
svc,
|
|
332
|
+
"UpdateSIPInboundTrunk",
|
|
333
|
+
req,
|
|
334
|
+
await this.authHeader({}, { admin: true })
|
|
335
|
+
);
|
|
336
|
+
return import_protocol.SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Updates specific fields of an existing SIP inbound trunk.
|
|
340
|
+
* Only provided fields will be updated.
|
|
341
|
+
*
|
|
342
|
+
* @param sipTrunkId - ID of the SIP inbound trunk to update
|
|
343
|
+
* @param fields - Fields of the inbound trunk to update
|
|
344
|
+
* @returns Updated SIP inbound trunk
|
|
345
|
+
*/
|
|
346
|
+
async updateSipInboundTrunkFields(sipTrunkId, fields) {
|
|
347
|
+
const req = new import_protocol.UpdateSIPInboundTrunkRequest({
|
|
348
|
+
sipTrunkId,
|
|
349
|
+
action: {
|
|
350
|
+
case: "update",
|
|
351
|
+
value: fields
|
|
352
|
+
}
|
|
353
|
+
}).toJson();
|
|
354
|
+
const data = await this.rpc.request(
|
|
355
|
+
svc,
|
|
356
|
+
"UpdateSIPInboundTrunk",
|
|
357
|
+
req,
|
|
358
|
+
await this.authHeader({}, { admin: true })
|
|
359
|
+
);
|
|
360
|
+
return import_protocol.SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Updates an existing SIP outbound trunk by replacing it entirely.
|
|
364
|
+
*
|
|
365
|
+
* @param sipTrunkId - ID of the SIP outbound trunk to update
|
|
366
|
+
* @param trunk - SIP outbound trunk to update with
|
|
367
|
+
* @returns Updated SIP outbound trunk
|
|
368
|
+
*/
|
|
369
|
+
async updateSipOutboundTrunk(sipTrunkId, trunk) {
|
|
370
|
+
const req = new import_protocol.UpdateSIPOutboundTrunkRequest({
|
|
371
|
+
sipTrunkId,
|
|
372
|
+
action: {
|
|
373
|
+
case: "replace",
|
|
374
|
+
value: trunk
|
|
375
|
+
}
|
|
376
|
+
}).toJson();
|
|
377
|
+
const data = await this.rpc.request(
|
|
378
|
+
svc,
|
|
379
|
+
"UpdateSIPOutboundTrunk",
|
|
380
|
+
req,
|
|
381
|
+
await this.authHeader({}, { admin: true })
|
|
382
|
+
);
|
|
383
|
+
return import_protocol.SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Updates specific fields of an existing SIP outbound trunk.
|
|
387
|
+
* Only provided fields will be updated.
|
|
388
|
+
*
|
|
389
|
+
* @param sipTrunkId - ID of the SIP outbound trunk to update
|
|
390
|
+
* @param fields - Fields of the outbound trunk to update
|
|
391
|
+
* @returns Updated SIP outbound trunk
|
|
392
|
+
*/
|
|
393
|
+
async updateSipOutboundTrunkFields(sipTrunkId, fields) {
|
|
394
|
+
const req = new import_protocol.UpdateSIPOutboundTrunkRequest({
|
|
395
|
+
sipTrunkId,
|
|
396
|
+
action: {
|
|
397
|
+
case: "update",
|
|
398
|
+
value: fields
|
|
399
|
+
}
|
|
400
|
+
}).toJson();
|
|
401
|
+
const data = await this.rpc.request(
|
|
402
|
+
svc,
|
|
403
|
+
"UpdateSIPOutboundTrunk",
|
|
404
|
+
req,
|
|
405
|
+
await this.authHeader({}, { admin: true })
|
|
406
|
+
);
|
|
407
|
+
return import_protocol.SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* List SIP dispatch rules with optional filtering.
|
|
411
|
+
*
|
|
412
|
+
* @param list - Request with optional filtering parameters
|
|
413
|
+
* @returns Response containing list of SIP dispatch rules
|
|
414
|
+
*/
|
|
415
|
+
async listSipDispatchRule(list = {}) {
|
|
416
|
+
const req = new import_protocol.ListSIPDispatchRuleRequest(list).toJson();
|
|
246
417
|
const data = await this.rpc.request(
|
|
247
418
|
svc,
|
|
248
419
|
"ListSIPDispatchRule",
|
|
249
|
-
|
|
420
|
+
req,
|
|
250
421
|
await this.authHeader({}, { admin: true })
|
|
251
422
|
);
|
|
252
423
|
return import_protocol.ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
253
424
|
}
|
|
254
425
|
/**
|
|
255
|
-
*
|
|
426
|
+
* Delete a SIP dispatch rule.
|
|
427
|
+
*
|
|
428
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to delete
|
|
429
|
+
* @returns Deleted rule information
|
|
256
430
|
*/
|
|
257
431
|
async deleteSipDispatchRule(sipDispatchRuleId) {
|
|
258
432
|
const data = await this.rpc.request(
|
|
@@ -264,10 +438,13 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
264
438
|
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
265
439
|
}
|
|
266
440
|
/**
|
|
441
|
+
* Create a new SIP participant.
|
|
442
|
+
*
|
|
267
443
|
* @param sipTrunkId - sip trunk to use for the call
|
|
268
444
|
* @param number - number to dial
|
|
269
445
|
* @param roomName - room to attach the call to
|
|
270
446
|
* @param opts - CreateSipParticipantOptions
|
|
447
|
+
* @returns Created SIP participant
|
|
271
448
|
*/
|
|
272
449
|
async createSipParticipant(sipTrunkId, number, roomName, opts) {
|
|
273
450
|
if (opts === void 0) {
|
|
@@ -289,20 +466,25 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
289
466
|
includeHeaders: opts.includeHeaders,
|
|
290
467
|
ringingTimeout: opts.ringingTimeout ? new import_protobuf.Duration({ seconds: BigInt(opts.ringingTimeout) }) : void 0,
|
|
291
468
|
maxCallDuration: opts.maxCallDuration ? new import_protobuf.Duration({ seconds: BigInt(opts.maxCallDuration) }) : void 0,
|
|
292
|
-
krispEnabled: opts.krispEnabled
|
|
469
|
+
krispEnabled: opts.krispEnabled,
|
|
470
|
+
waitUntilAnswered: opts.waitUntilAnswered
|
|
293
471
|
}).toJson();
|
|
294
472
|
const data = await this.rpc.request(
|
|
295
473
|
svc,
|
|
296
474
|
"CreateSIPParticipant",
|
|
297
475
|
req,
|
|
298
|
-
await this.authHeader({}, { call: true })
|
|
476
|
+
await this.authHeader({}, { call: true }),
|
|
477
|
+
opts.timeout
|
|
299
478
|
);
|
|
300
479
|
return import_protocol.SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
301
480
|
}
|
|
302
481
|
/**
|
|
482
|
+
* Transfer a SIP participant to a different room.
|
|
483
|
+
*
|
|
303
484
|
* @param roomName - room the SIP participant to transfer is connectd to
|
|
304
485
|
* @param participantIdentity - identity of the SIP participant to transfer
|
|
305
486
|
* @param transferTo - SIP URL to transfer the participant to
|
|
487
|
+
* @param opts - TransferSipParticipantOptions
|
|
306
488
|
*/
|
|
307
489
|
async transferSipParticipant(roomName, participantIdentity, transferTo, opts) {
|
|
308
490
|
if (opts === void 0) {
|
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 { RoomConfiguration, SIPHeaderOptions } 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 SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n} from '@livekit/protocol';\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}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\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}\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 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; // Deprecated, use playDialtone instead\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 ringingTimeout?: number; // Duration in seconds\n maxCallDuration?: number; // Duration in seconds\n krispEnabled?: boolean;\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 */\n constructor(host: string, apiKey?: string, secret?: string) {\n super(apiKey, secret);\n this.rpc = new TwirpRpc(host, livekitPackage);\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 * @param name - human-readable name of the trunk\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\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 }),\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 * @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 */\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 }),\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 async listSipInboundTrunk(): Promise<Array<SIPInboundTrunkInfo>> {\n const req: Partial<ListSIPInboundTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPInboundTrunk',\n new ListSIPInboundTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n async listSipOutboundTrunk(): Promise<Array<SIPOutboundTrunkInfo>> {\n const req: Partial<ListSIPOutboundTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPOutboundTrunk',\n new ListSIPOutboundTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * @param sipTrunkId - sip trunk to delete\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 * @param rule - sip dispatch rule\n * @param opts - CreateSipDispatchRuleOptions\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 async listSipDispatchRule(): Promise<Array<SIPDispatchRuleInfo>> {\n const req: Partial<ListSIPDispatchRuleRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPDispatchRule',\n new ListSIPDispatchRuleRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * @param sipDispatchRuleId - sip trunk to delete\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 * @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 */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\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 }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPParticipant',\n req,\n await this.authHeader({}, { call: true }),\n );\n return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\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 */\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,\n await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AAEzB,sBA0BO;AACP,yBAA4B;AAE5B,sBAAyC;AAEzC,MAAM,MAAM;AA4GL,MAAM,kBAAkB,+BAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzC,YAAY,MAAc,QAAiB,QAAiB;AAC1D,UAAM,QAAQ,MAAM;AACpB,SAAK,MAAM,IAAI,yBAAS,MAAM,8BAAc;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe,QAAgB,MAAqD;AACxF,QAAI;AACJ,QAAI;AACJ,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,mBAA2B;AAC/B,QAAI,mBAA2B;AAC/B,QAAI,OAAe;AACnB,QAAI,WAAmB;AAEvB,QAAI,SAAS,QAAW;AACtB,yBAAmB,KAAK;AACxB,uBAAiB,KAAK;AACtB,wBAAkB,KAAK,oBAAoB;AAC3C,wBAAkB,KAAK,oBAAoB;AAC3C,wBAAkB,KAAK,oBAAoB;AAC3C,yBAAmB,KAAK,qBAAqB;AAC7C,yBAAmB,KAAK,qBAAqB;AAC7C,aAAO,KAAK,QAAQ;AACpB,iBAAW,KAAK,YAAY;AAAA,IAC9B;AAEA,UAAM,MAAM,IAAI,sCAAsB;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB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AAC;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 SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n UpdateSIPDispatchRuleRequest,\n UpdateSIPInboundTrunkRequest,\n UpdateSIPOutboundTrunkRequest,\n} from '@livekit/protocol';\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}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\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}\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 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. */\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 SipTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n name?: string;\n metadata?: string;\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 */\n constructor(host: string, apiKey?: string, secret?: string) {\n super(apiKey, secret);\n this.rpc = new TwirpRpc(host, livekitPackage);\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 }),\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 }),\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: SipTrunkUpdateOptions,\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: SipTrunkUpdateOptions,\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 * @returns Created SIP participant\n */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\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,\n await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AAOzB,sBA6BO;AACP,yBAA4B;AAE5B,sBAAyC;AAEzC,MAAM,MAAM;AAwJL,MAAM,kBAAkB,+BAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzC,YAAY,MAAc,QAAiB,QAAiB;AAC1D,UAAM,QAAQ,MAAM;AACpB,SAAK,MAAM,IAAI,yBAAS,MAAM,8BAAc;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe,QAAgB,MAAqD;AACxF,QAAI;AACJ,QAAI;AACJ,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,mBAA2B;AAC/B,QAAI,mBAA2B;AAC/B,QAAI,OAAe;AACnB,QAAI,WAAmB;AAEvB,QAAI,SAAS,QAAW;AACtB,yBAAmB,KAAK;AACxB,uBAAiB,KAAK;AACtB,wBAAkB,KAAK,oBAAoB;AAC3C,wBAAkB,KAAK,oBAAoB;AAC3C,wBAAkB,KAAK,oBAAoB;AAC3C,yBAAmB,KAAK,qBAAqB;AAC7C,yBAAmB,KAAK,qBAAqB;AAC7C,aAAO,KAAK,QAAQ;AACpB,iBAA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