livekit-server-sdk 2.12.0 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccessToken.cjs.map +1 -1
- package/dist/AccessToken.d.cts +2 -2
- package/dist/AccessToken.d.ts +2 -2
- package/dist/AccessToken.js.map +1 -1
- 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 +201 -15
- package/dist/SipClient.cjs.map +1 -1
- package/dist/SipClient.d.cts +161 -9
- package/dist/SipClient.d.ts +161 -9
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +205 -16
- 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/AccessToken.ts +2 -2
- package/src/EgressClient.ts +10 -0
- package/src/RoomServiceClient.ts +21 -0
- package/src/SipClient.ts +315 -26
- package/src/TwirpRPC.ts +37 -9
|
@@ -129,8 +129,20 @@ declare class RoomServiceClient extends ServiceBase {
|
|
|
129
129
|
* participant. When the source participant disconnects or the
|
|
130
130
|
* `RemoveParticipant` method is called in the destination room, the
|
|
131
131
|
* forwarding will be stopped.
|
|
132
|
+
* @param room -
|
|
133
|
+
* @param identity -
|
|
134
|
+
* @param destinationRoom - the room to forward the participant to
|
|
132
135
|
*/
|
|
133
136
|
forwardParticipant(room: string, identity: string, destinationRoom: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`.
|
|
139
|
+
* The participant will be removed from the current room and added to the destination room.
|
|
140
|
+
* From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one.
|
|
141
|
+
* @param room -
|
|
142
|
+
* @param identity -
|
|
143
|
+
* @param destinationRoom - the room to move the participant to
|
|
144
|
+
*/
|
|
145
|
+
moveParticipant(room: string, identity: string, destinationRoom: string): Promise<void>;
|
|
134
146
|
/**
|
|
135
147
|
* Mutes a track that the participant has published.
|
|
136
148
|
* @param room -
|
|
@@ -127,8 +127,20 @@ export declare class RoomServiceClient extends ServiceBase {
|
|
|
127
127
|
* participant. When the source participant disconnects or the
|
|
128
128
|
* `RemoveParticipant` method is called in the destination room, the
|
|
129
129
|
* forwarding will be stopped.
|
|
130
|
+
* @param room -
|
|
131
|
+
* @param identity -
|
|
132
|
+
* @param destinationRoom - the room to forward the participant to
|
|
130
133
|
*/
|
|
131
134
|
forwardParticipant(room: string, identity: string, destinationRoom: string): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`.
|
|
137
|
+
* The participant will be removed from the current room and added to the destination room.
|
|
138
|
+
* From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one.
|
|
139
|
+
* @param room -
|
|
140
|
+
* @param identity -
|
|
141
|
+
* @param destinationRoom - the room to move the participant to
|
|
142
|
+
*/
|
|
143
|
+
moveParticipant(room: string, identity: string, destinationRoom: string): Promise<void>;
|
|
132
144
|
/**
|
|
133
145
|
* Mutes a track that the participant has published.
|
|
134
146
|
* @param room -
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomServiceClient.d.ts","sourceRoot":"","sources":["../src/RoomServiceClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"RoomServiceClient.d.ts","sourceRoot":"","sources":["../src/RoomServiceClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAWL,eAAe,EACf,qBAAqB,EACrB,IAAI,EAML,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAw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
|
ListRoomsRequest,
|
|
8
8
|
ListRoomsResponse,
|
|
9
|
+
MoveParticipantRequest,
|
|
9
10
|
MuteRoomTrackRequest,
|
|
10
11
|
MuteRoomTrackResponse,
|
|
11
12
|
ParticipantInfo,
|
|
@@ -137,6 +138,9 @@ class RoomServiceClient extends ServiceBase {
|
|
|
137
138
|
* participant. When the source participant disconnects or the
|
|
138
139
|
* `RemoveParticipant` method is called in the destination room, the
|
|
139
140
|
* forwarding will be stopped.
|
|
141
|
+
* @param room -
|
|
142
|
+
* @param identity -
|
|
143
|
+
* @param destinationRoom - the room to forward the participant to
|
|
140
144
|
*/
|
|
141
145
|
async forwardParticipant(room, identity, destinationRoom) {
|
|
142
146
|
await this.rpc.request(
|
|
@@ -146,6 +150,22 @@ class RoomServiceClient extends ServiceBase {
|
|
|
146
150
|
await this.authHeader({ roomAdmin: true, room, destinationRoom })
|
|
147
151
|
);
|
|
148
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`.
|
|
155
|
+
* The participant will be removed from the current room and added to the destination room.
|
|
156
|
+
* From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one.
|
|
157
|
+
* @param room -
|
|
158
|
+
* @param identity -
|
|
159
|
+
* @param destinationRoom - the room to move the participant to
|
|
160
|
+
*/
|
|
161
|
+
async moveParticipant(room, identity, destinationRoom) {
|
|
162
|
+
await this.rpc.request(
|
|
163
|
+
svc,
|
|
164
|
+
"MoveParticipant",
|
|
165
|
+
new MoveParticipantRequest({ room, identity, destinationRoom }).toJson(),
|
|
166
|
+
await this.authHeader({ roomAdmin: true, room, destinationRoom })
|
|
167
|
+
);
|
|
168
|
+
}
|
|
149
169
|
/**
|
|
150
170
|
* Mutes a track that the participant has published.
|
|
151
171
|
* @param room -
|
|
@@ -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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rE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,oBACJ,MACA,UACA,WACA,WACe;AACf,UAAM,MAAM,IAAI,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;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AO,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":[]}
|
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) {
|
|
@@ -137,7 +143,8 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
137
143
|
authPassword: opts.authPassword ?? opts.auth_password,
|
|
138
144
|
headers: opts.headers,
|
|
139
145
|
headersToAttributes: opts.headersToAttributes,
|
|
140
|
-
includeHeaders: opts.includeHeaders
|
|
146
|
+
includeHeaders: opts.includeHeaders,
|
|
147
|
+
destinationCountry: opts.destinationCountry
|
|
141
148
|
})
|
|
142
149
|
}).toJson();
|
|
143
150
|
const data = await this.rpc.request(
|
|
@@ -161,28 +168,43 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
161
168
|
);
|
|
162
169
|
return import_protocol.ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
163
170
|
}
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
/**
|
|
172
|
+
* List SIP inbound trunks with optional filtering.
|
|
173
|
+
*
|
|
174
|
+
* @param list - Request with optional filtering parameters
|
|
175
|
+
* @returns Response containing list of SIP inbound trunks
|
|
176
|
+
*/
|
|
177
|
+
async listSipInboundTrunk(list = {}) {
|
|
178
|
+
const req = new import_protocol.ListSIPInboundTrunkRequest(list).toJson();
|
|
166
179
|
const data = await this.rpc.request(
|
|
167
180
|
svc,
|
|
168
181
|
"ListSIPInboundTrunk",
|
|
169
|
-
|
|
182
|
+
req,
|
|
170
183
|
await this.authHeader({}, { admin: true })
|
|
171
184
|
);
|
|
172
185
|
return import_protocol.ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
173
186
|
}
|
|
174
|
-
|
|
175
|
-
|
|
187
|
+
/**
|
|
188
|
+
* List SIP outbound trunks with optional filtering.
|
|
189
|
+
*
|
|
190
|
+
* @param list - Request with optional filtering parameters
|
|
191
|
+
* @returns Response containing list of SIP outbound trunks
|
|
192
|
+
*/
|
|
193
|
+
async listSipOutboundTrunk(list = {}) {
|
|
194
|
+
const req = new import_protocol.ListSIPOutboundTrunkRequest(list).toJson();
|
|
176
195
|
const data = await this.rpc.request(
|
|
177
196
|
svc,
|
|
178
197
|
"ListSIPOutboundTrunk",
|
|
179
|
-
|
|
198
|
+
req,
|
|
180
199
|
await this.authHeader({}, { admin: true })
|
|
181
200
|
);
|
|
182
201
|
return import_protocol.ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
183
202
|
}
|
|
184
203
|
/**
|
|
185
|
-
*
|
|
204
|
+
* Delete a SIP trunk.
|
|
205
|
+
*
|
|
206
|
+
* @param sipTrunkId - ID of the SIP trunk to delete
|
|
207
|
+
* @returns Deleted trunk information
|
|
186
208
|
*/
|
|
187
209
|
async deleteSipTrunk(sipTrunkId) {
|
|
188
210
|
const data = await this.rpc.request(
|
|
@@ -194,8 +216,11 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
194
216
|
return import_protocol.SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
195
217
|
}
|
|
196
218
|
/**
|
|
197
|
-
*
|
|
219
|
+
* Create a new SIP dispatch rule.
|
|
220
|
+
*
|
|
221
|
+
* @param rule - SIP dispatch rule to create
|
|
198
222
|
* @param opts - CreateSipDispatchRuleOptions
|
|
223
|
+
* @returns Created SIP dispatch rule
|
|
199
224
|
*/
|
|
200
225
|
async createSipDispatchRule(rule, opts) {
|
|
201
226
|
if (opts === void 0) {
|
|
@@ -241,18 +266,168 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
241
266
|
);
|
|
242
267
|
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
243
268
|
}
|
|
244
|
-
|
|
245
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Updates an existing SIP dispatch rule by replacing it entirely.
|
|
271
|
+
*
|
|
272
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to update
|
|
273
|
+
* @param rule - new SIP dispatch rule
|
|
274
|
+
* @returns Updated SIP dispatch rule
|
|
275
|
+
*/
|
|
276
|
+
async updateSipDispatchRule(sipDispatchRuleId, rule) {
|
|
277
|
+
const req = new import_protocol.UpdateSIPDispatchRuleRequest({
|
|
278
|
+
sipDispatchRuleId,
|
|
279
|
+
action: {
|
|
280
|
+
case: "replace",
|
|
281
|
+
value: rule
|
|
282
|
+
}
|
|
283
|
+
}).toJson();
|
|
284
|
+
const data = await this.rpc.request(
|
|
285
|
+
svc,
|
|
286
|
+
"UpdateSIPDispatchRule",
|
|
287
|
+
req,
|
|
288
|
+
await this.authHeader({}, { admin: true })
|
|
289
|
+
);
|
|
290
|
+
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Updates specific fields of an existing SIP dispatch rule.
|
|
294
|
+
* Only provided fields will be updated.
|
|
295
|
+
*
|
|
296
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to update
|
|
297
|
+
* @param fields - Fields of the dispatch rule to update
|
|
298
|
+
* @returns Updated SIP dispatch rule
|
|
299
|
+
*/
|
|
300
|
+
async updateSipDispatchRuleFields(sipDispatchRuleId, fields = {}) {
|
|
301
|
+
const req = new import_protocol.UpdateSIPDispatchRuleRequest({
|
|
302
|
+
sipDispatchRuleId,
|
|
303
|
+
action: {
|
|
304
|
+
case: "update",
|
|
305
|
+
value: fields
|
|
306
|
+
}
|
|
307
|
+
}).toJson();
|
|
308
|
+
const data = await this.rpc.request(
|
|
309
|
+
svc,
|
|
310
|
+
"UpdateSIPDispatchRule",
|
|
311
|
+
req,
|
|
312
|
+
await this.authHeader({}, { admin: true })
|
|
313
|
+
);
|
|
314
|
+
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Updates an existing SIP inbound trunk by replacing it entirely.
|
|
318
|
+
*
|
|
319
|
+
* @param sipTrunkId - ID of the SIP inbound trunk to update
|
|
320
|
+
* @param trunk - SIP inbound trunk to update with
|
|
321
|
+
* @returns Updated SIP inbound trunk
|
|
322
|
+
*/
|
|
323
|
+
async updateSipInboundTrunk(sipTrunkId, trunk) {
|
|
324
|
+
const req = new import_protocol.UpdateSIPInboundTrunkRequest({
|
|
325
|
+
sipTrunkId,
|
|
326
|
+
action: {
|
|
327
|
+
case: "replace",
|
|
328
|
+
value: trunk
|
|
329
|
+
}
|
|
330
|
+
}).toJson();
|
|
331
|
+
const data = await this.rpc.request(
|
|
332
|
+
svc,
|
|
333
|
+
"UpdateSIPInboundTrunk",
|
|
334
|
+
req,
|
|
335
|
+
await this.authHeader({}, { admin: true })
|
|
336
|
+
);
|
|
337
|
+
return import_protocol.SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Updates specific fields of an existing SIP inbound trunk.
|
|
341
|
+
* Only provided fields will be updated.
|
|
342
|
+
*
|
|
343
|
+
* @param sipTrunkId - ID of the SIP inbound trunk to update
|
|
344
|
+
* @param fields - Fields of the inbound trunk to update
|
|
345
|
+
* @returns Updated SIP inbound trunk
|
|
346
|
+
*/
|
|
347
|
+
async updateSipInboundTrunkFields(sipTrunkId, fields) {
|
|
348
|
+
const req = new import_protocol.UpdateSIPInboundTrunkRequest({
|
|
349
|
+
sipTrunkId,
|
|
350
|
+
action: {
|
|
351
|
+
case: "update",
|
|
352
|
+
value: fields
|
|
353
|
+
}
|
|
354
|
+
}).toJson();
|
|
355
|
+
const data = await this.rpc.request(
|
|
356
|
+
svc,
|
|
357
|
+
"UpdateSIPInboundTrunk",
|
|
358
|
+
req,
|
|
359
|
+
await this.authHeader({}, { admin: true })
|
|
360
|
+
);
|
|
361
|
+
return import_protocol.SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Updates an existing SIP outbound trunk by replacing it entirely.
|
|
365
|
+
*
|
|
366
|
+
* @param sipTrunkId - ID of the SIP outbound trunk to update
|
|
367
|
+
* @param trunk - SIP outbound trunk to update with
|
|
368
|
+
* @returns Updated SIP outbound trunk
|
|
369
|
+
*/
|
|
370
|
+
async updateSipOutboundTrunk(sipTrunkId, trunk) {
|
|
371
|
+
const req = new import_protocol.UpdateSIPOutboundTrunkRequest({
|
|
372
|
+
sipTrunkId,
|
|
373
|
+
action: {
|
|
374
|
+
case: "replace",
|
|
375
|
+
value: trunk
|
|
376
|
+
}
|
|
377
|
+
}).toJson();
|
|
378
|
+
const data = await this.rpc.request(
|
|
379
|
+
svc,
|
|
380
|
+
"UpdateSIPOutboundTrunk",
|
|
381
|
+
req,
|
|
382
|
+
await this.authHeader({}, { admin: true })
|
|
383
|
+
);
|
|
384
|
+
return import_protocol.SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Updates specific fields of an existing SIP outbound trunk.
|
|
388
|
+
* Only provided fields will be updated.
|
|
389
|
+
*
|
|
390
|
+
* @param sipTrunkId - ID of the SIP outbound trunk to update
|
|
391
|
+
* @param fields - Fields of the outbound trunk to update
|
|
392
|
+
* @returns Updated SIP outbound trunk
|
|
393
|
+
*/
|
|
394
|
+
async updateSipOutboundTrunkFields(sipTrunkId, fields) {
|
|
395
|
+
const req = new import_protocol.UpdateSIPOutboundTrunkRequest({
|
|
396
|
+
sipTrunkId,
|
|
397
|
+
action: {
|
|
398
|
+
case: "update",
|
|
399
|
+
value: fields
|
|
400
|
+
}
|
|
401
|
+
}).toJson();
|
|
402
|
+
const data = await this.rpc.request(
|
|
403
|
+
svc,
|
|
404
|
+
"UpdateSIPOutboundTrunk",
|
|
405
|
+
req,
|
|
406
|
+
await this.authHeader({}, { admin: true })
|
|
407
|
+
);
|
|
408
|
+
return import_protocol.SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* List SIP dispatch rules with optional filtering.
|
|
412
|
+
*
|
|
413
|
+
* @param list - Request with optional filtering parameters
|
|
414
|
+
* @returns Response containing list of SIP dispatch rules
|
|
415
|
+
*/
|
|
416
|
+
async listSipDispatchRule(list = {}) {
|
|
417
|
+
const req = new import_protocol.ListSIPDispatchRuleRequest(list).toJson();
|
|
246
418
|
const data = await this.rpc.request(
|
|
247
419
|
svc,
|
|
248
420
|
"ListSIPDispatchRule",
|
|
249
|
-
|
|
421
|
+
req,
|
|
250
422
|
await this.authHeader({}, { admin: true })
|
|
251
423
|
);
|
|
252
424
|
return import_protocol.ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];
|
|
253
425
|
}
|
|
254
426
|
/**
|
|
255
|
-
*
|
|
427
|
+
* Delete a SIP dispatch rule.
|
|
428
|
+
*
|
|
429
|
+
* @param sipDispatchRuleId - ID of the SIP dispatch rule to delete
|
|
430
|
+
* @returns Deleted rule information
|
|
256
431
|
*/
|
|
257
432
|
async deleteSipDispatchRule(sipDispatchRuleId) {
|
|
258
433
|
const data = await this.rpc.request(
|
|
@@ -264,15 +439,21 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
264
439
|
return import_protocol.SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
265
440
|
}
|
|
266
441
|
/**
|
|
442
|
+
* Create a new SIP participant.
|
|
443
|
+
*
|
|
267
444
|
* @param sipTrunkId - sip trunk to use for the call
|
|
268
445
|
* @param number - number to dial
|
|
269
446
|
* @param roomName - room to attach the call to
|
|
270
447
|
* @param opts - CreateSipParticipantOptions
|
|
448
|
+
* @returns Created SIP participant
|
|
271
449
|
*/
|
|
272
450
|
async createSipParticipant(sipTrunkId, number, roomName, opts) {
|
|
273
451
|
if (opts === void 0) {
|
|
274
452
|
opts = {};
|
|
275
453
|
}
|
|
454
|
+
if (opts.timeout === void 0) {
|
|
455
|
+
opts.timeout = opts.waitUntilAnswered ? 60 : 10;
|
|
456
|
+
}
|
|
276
457
|
const req = new import_protocol.CreateSIPParticipantRequest({
|
|
277
458
|
sipTrunkId,
|
|
278
459
|
sipCallTo: number,
|
|
@@ -289,20 +470,25 @@ class SipClient extends import_ServiceBase.ServiceBase {
|
|
|
289
470
|
includeHeaders: opts.includeHeaders,
|
|
290
471
|
ringingTimeout: opts.ringingTimeout ? new import_protobuf.Duration({ seconds: BigInt(opts.ringingTimeout) }) : void 0,
|
|
291
472
|
maxCallDuration: opts.maxCallDuration ? new import_protobuf.Duration({ seconds: BigInt(opts.maxCallDuration) }) : void 0,
|
|
292
|
-
krispEnabled: opts.krispEnabled
|
|
473
|
+
krispEnabled: opts.krispEnabled,
|
|
474
|
+
waitUntilAnswered: opts.waitUntilAnswered
|
|
293
475
|
}).toJson();
|
|
294
476
|
const data = await this.rpc.request(
|
|
295
477
|
svc,
|
|
296
478
|
"CreateSIPParticipant",
|
|
297
479
|
req,
|
|
298
|
-
await this.authHeader({}, { call: true })
|
|
480
|
+
await this.authHeader({}, { call: true }),
|
|
481
|
+
opts.timeout
|
|
299
482
|
);
|
|
300
483
|
return import_protocol.SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });
|
|
301
484
|
}
|
|
302
485
|
/**
|
|
486
|
+
* Transfer a SIP participant to a different room.
|
|
487
|
+
*
|
|
303
488
|
* @param roomName - room the SIP participant to transfer is connectd to
|
|
304
489
|
* @param participantIdentity - identity of the SIP participant to transfer
|
|
305
490
|
* @param transferTo - SIP URL to transfer the participant to
|
|
491
|
+
* @param opts - TransferSipParticipantOptions
|
|
306
492
|
*/
|
|
307
493
|
async transferSipParticipant(roomName, participantIdentity, transferTo, opts) {
|
|
308
494
|
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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AAE,OAAO;AAEV,UAAM,OAAO,MAAM,KAAK,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,IAC1C;AACA,WAAO,mCAAmB,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,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 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 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}\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. 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}\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}\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 destinationCountry: opts.destinationCountry,\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 * @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 if (opts.timeout === undefined) {\n opts.timeout = opts.waitUntilAnswered ? 60 : 10;\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;AAoKL,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;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,EAAE,OAAO;AAEV,UAAM,OAAO,MAAM,KAAK,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA,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