@ipcom/asterisk-ari 0.0.24 → 0.0.25

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.
@@ -582,6 +582,7 @@ __export(src_exports, {
582
582
  Applications: () => Applications,
583
583
  AriClient: () => AriClient,
584
584
  Asterisk: () => Asterisk,
585
+ Bridges: () => Bridges,
585
586
  Channels: () => Channels,
586
587
  Endpoints: () => Endpoints,
587
588
  Playbacks: () => Playbacks,
@@ -764,6 +765,95 @@ var Asterisk = class {
764
765
  }
765
766
  };
766
767
 
768
+ // src/ari-client/resources/bridges.ts
769
+ var Bridges = class {
770
+ constructor(client) {
771
+ this.client = client;
772
+ }
773
+ /**
774
+ * Lists all active bridges.
775
+ */
776
+ async list() {
777
+ return this.client.get("/bridges");
778
+ }
779
+ /**
780
+ * Creates a new bridge.
781
+ */
782
+ async createBridge(request) {
783
+ return this.client.post("/bridges", request);
784
+ }
785
+ /**
786
+ * Retrieves details of a specific bridge.
787
+ */
788
+ async getDetails(bridgeId) {
789
+ return this.client.get(`/bridges/${bridgeId}`);
790
+ }
791
+ /**
792
+ * Destroys (deletes) a specific bridge.
793
+ */
794
+ async destroy(bridgeId) {
795
+ return this.client.delete(`/bridges/${bridgeId}`);
796
+ }
797
+ /**
798
+ * Adds a channel or multiple channels to a bridge.
799
+ */
800
+ async addChannels(bridgeId, request) {
801
+ const queryParams = new URLSearchParams({
802
+ channel: Array.isArray(request.channel) ? request.channel.join(",") : request.channel,
803
+ ...request.role && { role: request.role }
804
+ }).toString();
805
+ await this.client.post(
806
+ `/bridges/${bridgeId}/addChannel?${queryParams}`
807
+ );
808
+ }
809
+ /**
810
+ * Removes a channel or multiple channels from a bridge.
811
+ */
812
+ async removeChannels(bridgeId, request) {
813
+ const queryParams = new URLSearchParams({
814
+ channel: Array.isArray(request.channel) ? request.channel.join(",") : request.channel
815
+ }).toString();
816
+ await this.client.post(
817
+ `/bridges/${bridgeId}/removeChannel?${queryParams}`
818
+ );
819
+ }
820
+ /**
821
+ * Plays media to a bridge.
822
+ */
823
+ async playMedia(bridgeId, request) {
824
+ const queryParams = new URLSearchParams({
825
+ ...request.lang && { lang: request.lang },
826
+ ...request.offsetms && { offsetms: request.offsetms.toString() },
827
+ ...request.skipms && { skipms: request.skipms.toString() },
828
+ ...request.playbackId && { playbackId: request.playbackId }
829
+ }).toString();
830
+ return this.client.post(
831
+ `/bridges/${bridgeId}/play?${queryParams}`,
832
+ { media: request.media }
833
+ );
834
+ }
835
+ /**
836
+ * Stops media playback on a bridge.
837
+ */
838
+ async stopPlayback(bridgeId, playbackId) {
839
+ await this.client.delete(`/bridges/${bridgeId}/play/${playbackId}`);
840
+ }
841
+ /**
842
+ * Sets the video source for a bridge.
843
+ */
844
+ async setVideoSource(bridgeId, channelId) {
845
+ await this.client.post(
846
+ `/bridges/${bridgeId}/videoSource?channelId=${encodeURIComponent(channelId)}`
847
+ );
848
+ }
849
+ /**
850
+ * Clears the video source for a bridge.
851
+ */
852
+ async clearVideoSource(bridgeId) {
853
+ await this.client.delete(`/bridges/${bridgeId}/videoSource`);
854
+ }
855
+ };
856
+
767
857
  // src/ari-client/resources/channels.ts
768
858
  function toQueryParams2(options) {
769
859
  return new URLSearchParams(
@@ -1125,17 +1215,22 @@ var Playbacks = class {
1125
1215
  return this.client.get(`/playbacks/${playbackId}`);
1126
1216
  }
1127
1217
  /**
1128
- * Controls a specific playback (e.g., pause, resume, rewind, forward, stop).
1218
+ * Controls a specific playback by performing various operations such as pause, resume, restart, reverse, forward, or stop.
1129
1219
  *
1130
1220
  * @param playbackId - The unique identifier of the playback to control.
1131
- * @param controlRequest - The PlaybackControlRequest containing the control operation.
1221
+ * @param operation - The operation to perform on the playback. Possible values are:
1222
+ * - "pause": Pauses the playback.
1223
+ * - "unpause": Resumes a paused playback.
1224
+ * - "restart": Restarts the playback from the beginning.
1225
+ * - "reverse": Reverses the playback direction.
1226
+ * - "forward": Moves the playback forward.
1227
+ * - "stop": Stops the playback.
1132
1228
  * @returns A promise that resolves when the control operation is successfully executed.
1133
1229
  */
1134
- async control(playbackId, controlRequest) {
1135
- await this.client.post(
1136
- `/playbacks/${playbackId}/control`,
1137
- controlRequest
1138
- );
1230
+ async control(playbackId, operation) {
1231
+ await this.client.post(`/playbacks/${playbackId}/control`, {
1232
+ operation
1233
+ });
1139
1234
  }
1140
1235
  /**
1141
1236
  * Stops a specific playback.
@@ -1281,6 +1376,7 @@ var AriClient = class {
1281
1376
  this.playbacks = new Playbacks(this.baseClient);
1282
1377
  this.sounds = new Sounds(this.baseClient);
1283
1378
  this.asterisk = new Asterisk(this.baseClient);
1379
+ this.bridges = new Bridges(this.baseClient);
1284
1380
  }
1285
1381
  wsClient = null;
1286
1382
  baseClient;
@@ -1291,10 +1387,12 @@ var AriClient = class {
1291
1387
  playbacks;
1292
1388
  sounds;
1293
1389
  asterisk;
1390
+ bridges;
1294
1391
  /**
1295
1392
  * Connects to the ARI WebSocket for a specific application.
1296
1393
  *
1297
1394
  * @param app - The application name to connect to.
1395
+ * @param subscribedEvents
1298
1396
  * @returns {Promise<void>} Resolves when the WebSocket connects successfully.
1299
1397
  */
1300
1398
  async connectWebSocket(app, subscribedEvents) {
@@ -1801,14 +1899,23 @@ var AriClient = class {
1801
1899
  return this.playbacks.getDetails(playbackId);
1802
1900
  }
1803
1901
  /**
1804
- * Controls a specific playback in the Asterisk server.
1805
- *
1806
- * @param playbackId - The unique identifier of the playback to control.
1807
- * @param controlRequest - An object containing the control operation details.
1808
- * @returns A Promise that resolves when the control operation is successfully executed.
1809
- */
1902
+ * Controls a specific playback in the Asterisk server.
1903
+ * This function allows manipulation of an ongoing playback, such as pausing, resuming, or skipping.
1904
+ *
1905
+ * @param playbackId - The unique identifier of the playback to control.
1906
+ * This should be a string that uniquely identifies the playback in the Asterisk system.
1907
+ * @param controlRequest - An object containing the control operation details.
1908
+ * This object should conform to the PlaybackControlRequest interface,
1909
+ * which includes an 'operation' property specifying the control action to perform.
1910
+ * @returns A Promise that resolves when the control operation is successfully executed.
1911
+ * The promise resolves to void, indicating no specific return value.
1912
+ * If an error occurs during the operation, the promise will be rejected with an error object.
1913
+ * @throws Will throw an error if the playback control operation fails, e.g., if the playback doesn't exist
1914
+ * or the requested operation is invalid.
1915
+ */
1810
1916
  async controlPlayback(playbackId, controlRequest) {
1811
- return this.playbacks.control(playbackId, controlRequest);
1917
+ const { operation } = controlRequest;
1918
+ return this.playbacks.control(playbackId, operation);
1812
1919
  }
1813
1920
  /**
1814
1921
  * Stops a specific playback in the Asterisk server.
@@ -1923,6 +2030,7 @@ var AriClient = class {
1923
2030
  Applications,
1924
2031
  AriClient,
1925
2032
  Asterisk,
2033
+ Bridges,
1926
2034
  Channels,
1927
2035
  Endpoints,
1928
2036
  Playbacks,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/index.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/applications.ts", "../../src/ari-client/resources/asterisk.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/resources/endpoints.ts", "../../src/ari-client/resources/playbacks.ts", "../../src/ari-client/resources/sounds.ts", "../../src/ari-client/websocketClient.ts"],
4
- "sourcesContent": [null, null, null, null, null, null, null, null, null, "// Exporta a classe principal AriClient\nexport { AriClient } from \"./ari-client/ariClient.js\";\n\n// Exporta as classes dos recursos, caso o usu\u00E1rio precise us\u00E1-las diretamente\nexport { Channels } from \"./ari-client/resources/channels.js\";\nexport { Endpoints } from \"./ari-client/resources/endpoints.js\";\nexport { Applications } from \"./ari-client/resources/applications.js\";\nexport { Sounds } from \"./ari-client/resources/sounds.js\";\nexport { Playbacks } from \"./ari-client/resources/playbacks.js\";\nexport { Asterisk } from \"./ari-client/resources/asterisk.js\";\n\n// Exporta interfaces importantes para tipagem\nexport type {\n AriClientConfig,\n Channel,\n Endpoint,\n Playback,\n Application,\n Sound,\n AsteriskInfo,\n Module,\n Logging,\n Variable,\n WebSocketEvent,\n WebSocketEventType,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n ExternalMediaOptions,\n ChannelPlayback,\n ChannelVar,\n ChannelDialplan,\n AriApplication,\n EndpointDetails,\n PlaybackControlRequest,\n ApplicationDetails,\n SoundListRequest,\n} from \"./ari-client/interfaces/index.js\";\n", "import { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n} from \"./interfaces/applications.types\";\nimport type {\n AsteriskInfo,\n Logging,\n Module,\n Variable,\n} from \"./interfaces/asterisk.types\";\nimport type {\n Channel,\n ChannelPlayback,\n ChannelVar,\n ExternalMediaOptions,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n} from \"./interfaces/channels.types\";\nimport type {\n Endpoint,\n EndpointDetails,\n} from \"./interfaces/endpoints.types.js\";\nimport type {\n WebSocketEvent,\n WebSocketEventType,\n} from \"./interfaces/events.types\";\nimport type {\n Playback as APIPlayback,\n PlaybackControlRequest,\n} from \"./interfaces/playbacks.types\";\nimport type { AriApplication, AriClientConfig } from \"./interfaces/requests.js\";\nimport type { Sound, SoundListRequest } from \"./interfaces/sounds.types\";\nimport { Applications } from \"./resources/applications.js\";\nimport { Asterisk } from \"./resources/asterisk\";\nimport { Channels } from \"./resources/channels.js\";\nimport { Endpoints } from \"./resources/endpoints\";\nimport { Playbacks } from \"./resources/playbacks\";\nimport { Sounds } from \"./resources/sounds\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n private isReconnecting = false;\n\n public channels: Channels;\n public endpoints: Endpoints;\n public applications: Applications;\n public playbacks: Playbacks;\n public sounds: Sounds;\n public asterisk: Asterisk;\n\n constructor(private config: AriClientConfig) {\n const httpProtocol = config.secure ? \"https\" : \"http\";\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n this.channels = new Channels(this.baseClient);\n this.endpoints = new Endpoints(this.baseClient);\n this.applications = new Applications(this.baseClient);\n this.playbacks = new Playbacks(this.baseClient);\n this.sounds = new Sounds(this.baseClient);\n this.asterisk = new Asterisk(this.baseClient);\n }\n\n /**\n * Connects to the ARI WebSocket for a specific application.\n *\n * @param app - The application name to connect to.\n * @returns {Promise<void>} Resolves when the WebSocket connects successfully.\n */\n async connectWebSocket(\n app: string,\n subscribedEvents?: WebSocketEventType[],\n ): Promise<void> {\n if (!app) {\n throw new Error(\n \"The 'app' parameter is required to connect to the WebSocket.\",\n );\n }\n\n if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n // Se nenhum evento foi especificado, assumimos que o cliente quer escutar todos.\n const eventsParam =\n subscribedEvents && subscribedEvents.length > 0\n ? `&event=${subscribedEvents.join(\",\")}`\n : \"&subscribeAll=true\";\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}${eventsParam}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback function for WebSocket events.\n * This method allows you to listen for and respond to WebSocket messages\n * and process specific event types.\n *\n * @param callback - The callback function to execute when a WebSocket message is received.\n * The function will receive the parsed event data as its parameter.\n * @throws {Error} Throws an error if the WebSocket is not connected when trying to register the event.\n * @returns {void}\n */\n onWebSocketEvent<T extends WebSocketEvent[\"type\"]>(\n callback: (data: Extract<WebSocketEvent, { type: T }>) => void,\n ): void {\n if (!this.wsClient) {\n throw new Error(\"WebSocket is not connected.\");\n }\n\n this.wsClient.on(\"message\", callback);\n }\n\n /**\n * Closes the WebSocket connection.\n */\n closeWebSocket(): void {\n if (this.wsClient) {\n this.wsClient.close();\n this.wsClient = null;\n }\n }\n /**\n * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n /**\n * Lists all active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\n }\n\n /**\n * Creates a new channel.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n\n /**\n * Sets a channel variable.\n */\n async setChannelVariable(\n channelId: string,\n variable: string,\n value: string,\n ): Promise<void> {\n return this.channels.setVariable(channelId, variable, value);\n }\n\n /**\n * Gets a channel variable.\n */\n async getChannelVariable(\n channelId: string,\n variable: string,\n ): Promise<ChannelVar> {\n return this.channels.getVariable(channelId, variable);\n }\n\n /**\n * Plays a media file to a channel.\n */\n async playMediaToChannel(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n return this.channels.playMedia(channelId, media, options);\n }\n\n /**\n * Starts music on hold for a channel.\n */\n async startChannelMusicOnHold(channelId: string): Promise<void> {\n return this.channels.startMusicOnHold(channelId);\n }\n\n /**\n * Stops music on hold for a channel.\n */\n async stopChannelMusicOnHold(channelId: string): Promise<void> {\n return this.channels.stopMusicOnHold(channelId);\n }\n\n /**\n * Starts playback of a media file on a channel.\n */\n async startChannelPlayback(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n return this.channels.startPlayback(channelId, media, options);\n }\n\n /**\n * Stops playback of a media file on a channel.\n */\n async stopChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.stopPlayback(channelId, playbackId);\n }\n\n /**\n * Pauses playback of a media file on a channel.\n */\n async pauseChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.pausePlayback(channelId, playbackId);\n }\n\n /**\n * Resumes playback of a media file on a channel.\n */\n async resumeChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.resumePlayback(channelId, playbackId);\n }\n\n /**\n * Rewinds playback of a media file on a channel.\n */\n async rewindChannelPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.channels.rewindPlayback(channelId, playbackId, skipMs);\n }\n\n /**\n * Fast-forwards playback of a media file on a channel.\n */\n async fastForwardChannelPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.channels.fastForwardPlayback(channelId, playbackId, skipMs);\n }\n\n /**\n * Records audio from a channel.\n */\n async recordAudio(\n channelId: string,\n options: RecordingOptions,\n ): Promise<Channel> {\n return this.channels.record(channelId, options);\n }\n\n /**\n * Starts snooping on a channel.\n */\n async snoopChannel(\n channelId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n return this.channels.snoopChannel(channelId, options);\n }\n\n /**\n * Starts snooping on a channel with a specific snoop ID.\n */\n async snoopChannelWithId(\n channelId: string,\n snoopId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n return this.channels.snoopChannelWithId(channelId, snoopId, options);\n }\n\n /**\n * Initiates a dial operation on a previously created channel.\n * This function attempts to connect the specified channel to its configured destination.\n *\n * @param channelId - The unique identifier of the channel to dial.\n * @param caller - Optional. The caller ID to use for the outgoing call. If not provided, the default caller ID for the channel will be used.\n * @param timeout - Optional. The maximum time in seconds to wait for the dial operation to complete. If not specified, the system's default timeout will be used.\n * @returns A Promise that resolves when the dial operation has been initiated successfully. Note that this does not guarantee that the call was answered, only that dialing has begun.\n * @throws Will throw an error if the dial operation fails, e.g., if the channel doesn't exist or is in an invalid state.\n */\n async dialChannel(\n channelId: string,\n caller?: string,\n timeout?: number,\n ): Promise<void> {\n return this.channels.dial(channelId, caller, timeout);\n }\n\n /**\n * Retrieves RTP statistics for a channel.\n */\n async getRTPStatistics(channelId: string): Promise<RTPStats> {\n return this.channels.getRTPStatistics(channelId);\n }\n\n /**\n * Creates a channel to an external media source/sink.\n */\n async createExternalMedia(options: ExternalMediaOptions): Promise<Channel> {\n return this.channels.createExternalMedia(options);\n }\n\n /**\n * Redirects a channel to a different location.\n */\n async redirectChannel(channelId: string, endpoint: string): Promise<void> {\n return this.channels.redirectChannel(channelId, endpoint);\n }\n\n /**\n * Answers a channel.\n */\n async answerChannel(channelId: string): Promise<void> {\n return this.channels.answerChannel(channelId);\n }\n\n /**\n * Sends a ringing indication to a channel.\n */\n async ringChannel(channelId: string): Promise<void> {\n return this.channels.ringChannel(channelId);\n }\n\n /**\n * Stops the ringing indication on a specified channel in the Asterisk system.\n *\n * This function sends a request to the Asterisk server to cease the ringing\n * indication on a particular channel. This is typically used when you want to\n * stop the ringing sound on a channel without answering or hanging up the call.\n *\n * @param channelId - The unique identifier of the channel on which to stop the ringing.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the ringing has been successfully stopped on the specified channel.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async stopRingChannel(channelId: string): Promise<void> {\n return this.channels.stopRingChannel(channelId);\n }\n\n /**\n * Sends DTMF (Dual-Tone Multi-Frequency) tones to a specified channel.\n *\n * This function allows sending DTMF tones to a channel, which can be used for various purposes\n * such as interacting with IVR systems or sending signals during a call.\n *\n * @param channelId - The unique identifier of the channel to send DTMF tones to.\n * @param dtmf - A string representing the DTMF tones to send (e.g., \"123#\").\n * @param options - Optional parameters to control the timing of DTMF tones.\n * @param options.before - The time (in milliseconds) to wait before sending DTMF.\n * @param options.between - The time (in milliseconds) to wait between each DTMF tone.\n * @param options.duration - The duration (in milliseconds) of each DTMF tone.\n * @param options.after - The time (in milliseconds) to wait after sending all DTMF tones.\n * @returns A Promise that resolves when the DTMF tones have been successfully sent.\n */\n async sendDTMF(\n channelId: string,\n dtmf: string,\n options?: {\n before?: number;\n between?: number;\n duration?: number;\n after?: number;\n },\n ): Promise<void> {\n return this.channels.sendDTMF(channelId, dtmf, options);\n }\n\n /**\n * Mutes a channel in the Asterisk system.\n *\n * This function initiates a mute operation on the specified channel, preventing\n * audio transmission in the specified direction(s).\n *\n * @param channelId - The unique identifier of the channel to be muted.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n * @param direction - The direction of audio to mute. Can be one of:\n * - \"both\": Mute both incoming and outgoing audio (default)\n * - \"in\": Mute only incoming audio\n * - \"out\": Mute only outgoing audio\n *\n * @returns A Promise that resolves when the mute operation has been successfully completed.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async muteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.channels.muteChannel(channelId, direction);\n }\n\n /**\n * Unmutes a channel in the Asterisk system.\n *\n * This function removes the mute status from a specified channel, allowing audio\n * transmission to resume in the specified direction(s).\n *\n * @param channelId - The unique identifier of the channel to be unmuted.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n * @param direction - The direction of audio to unmute. Can be one of:\n * - \"both\": Unmute both incoming and outgoing audio (default)\n * - \"in\": Unmute only incoming audio\n * - \"out\": Unmute only outgoing audio\n *\n * @returns A Promise that resolves when the unmute operation has been successfully completed.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async unmuteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.channels.unmuteChannel(channelId, direction);\n }\n\n /**\n * Puts a specified channel on hold.\n *\n * This function initiates a hold operation on the specified channel in the Asterisk system.\n * When a channel is put on hold, typically the audio is muted or replaced with hold music,\n * depending on the system configuration.\n *\n * @param channelId - The unique identifier of the channel to be put on hold.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the hold operation has been successfully initiated.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async holdChannel(channelId: string): Promise<void> {\n return this.channels.holdChannel(channelId);\n }\n\n /**\n * Removes a specified channel from hold.\n *\n * This function initiates an unhold operation on the specified channel in the Asterisk system.\n * When a channel is taken off hold, it typically resumes normal audio transmission,\n * allowing the parties to continue their conversation.\n *\n * @param channelId - The unique identifier of the channel to be taken off hold.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the unhold operation has been successfully initiated.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async unholdChannel(channelId: string): Promise<void> {\n return this.channels.unholdChannel(channelId);\n }\n\n /**\n * Creates a new channel in the Asterisk system using the provided originate request data.\n * This function initiates a new communication channel based on the specified parameters.\n *\n * @param data - An object containing the originate request data for channel creation.\n * This includes details such as the endpoint to call, the context to use,\n * and any variables to set on the new channel.\n * @param data.endpoint - The endpoint to call (e.g., \"SIP/1234\").\n * @param data.extension - The extension to dial after the channel is created.\n * @param data.context - The dialplan context to use for the new channel.\n * @param data.priority - The priority to start at in the dialplan.\n * @param data.app - The application to execute on the channel (alternative to extension/context/priority).\n * @param data.appArgs - The arguments to pass to the application, if 'app' is specified.\n * @param data.callerId - The caller ID to set on the new channel.\n * @param data.timeout - The timeout (in seconds) to wait for the channel to be answered.\n * @param data.variables - An object containing key-value pairs of channel variables to set.\n * @param data.channelId - An optional ID to assign to the new channel.\n * @param data.otherChannelId - The ID of another channel to bridge with after creation.\n *\n * @returns A Promise that resolves to the created Channel object.\n * The Channel object contains details about the newly created channel,\n * such as its unique identifier, state, and other relevant information.\n *\n * @throws Will throw an error if the channel creation fails for any reason,\n * such as invalid parameters or system issues.\n */\n async createChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.createChannel(data);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @param options - Optional parameters for the hangup operation.\n * @param options.reason_code - An optional reason code for the hangup.\n * @param options.reason - An optional textual reason for the hangup.\n * @returns A promise that resolves when the hangup operation is complete.\n */\n async hangup(\n channelId: string,\n options?: { reason_code?: string; reason?: string },\n ): Promise<void> {\n return this.channels.hangup(channelId, options);\n }\n\n /**\n * Originates a new channel with a specified ID using the provided originate request data.\n *\n * @param channelId - The desired unique identifier for the new channel.\n * @param data - The originate request data containing channel creation parameters.\n * @returns A promise that resolves to the created Channel object.\n */\n async originateWithId(\n channelId: string,\n data: OriginateRequest,\n ): Promise<Channel> {\n return this.channels.originateWithId(channelId, data);\n }\n\n // M\u00E9todos relacionados a endpoints:\n\n /**\n * Lists all endpoints.\n *\n * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.\n */\n async listEndpoints(): Promise<Endpoint[]> {\n return this.endpoints.list();\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.\n */\n async getEndpointDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.endpoints.getDetails(technology, resource);\n }\n\n /**\n * Sends a message to an endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent.\n */\n async sendMessageToEndpoint(\n technology: string,\n resource: string,\n body: any,\n ): Promise<void> {\n return this.endpoints.sendMessage(technology, resource, body);\n }\n\n // M\u00E9todos relacionados a applications\n /**\n * Lists all applications.\n *\n * @returns {Promise<Application[]>} A promise resolving to the list of applications.\n */\n async listApplications(): Promise<Application[]> {\n return this.applications.list();\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The name of the application.\n * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.\n */\n async getApplicationDetails(appName: string): Promise<ApplicationDetails> {\n return this.applications.getDetails(appName);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The name of the application.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent successfully.\n */\n async sendMessageToApplication(appName: string, body: any): Promise<void> {\n return this.applications.sendMessage(appName, body);\n }\n\n // M\u00E9todos relacionados a playbacks\n /**\n * Retrieves details of a specific playback.\n *\n * @param playbackId - The unique identifier of the playback.\n * @returns {Promise<Playback>} A promise resolving to the playback details.\n */\n async getPlaybackDetails(playbackId: string): Promise<APIPlayback> {\n return this.playbacks.getDetails(playbackId);\n }\n\n /**\n * Controls a specific playback in the Asterisk server.\n *\n * @param playbackId - The unique identifier of the playback to control.\n * @param controlRequest - An object containing the control operation details.\n * @returns A Promise that resolves when the control operation is successfully executed.\n */\n async controlPlayback(\n playbackId: string,\n controlRequest: PlaybackControlRequest,\n ): Promise<void> {\n return this.playbacks.control(playbackId, controlRequest);\n }\n\n /**\n * Stops a specific playback in the Asterisk server.\n *\n * @param playbackId - The unique identifier of the playback to stop.\n * @returns A Promise that resolves when the playback is successfully stopped.\n */\n async stopPlayback(playbackId: string): Promise<void> {\n return this.playbacks.stop(playbackId);\n }\n\n /**\n * Retrieves a list of all available sounds in the Asterisk server.\n *\n * @param params - Optional parameters to filter the list of sounds.\n * @returns A Promise that resolves to an array of Sound objects representing the available sounds.\n */\n async listSounds(params?: SoundListRequest): Promise<Sound[]> {\n return this.sounds.list(params);\n }\n\n /**\n * Retrieves detailed information about a specific sound in the Asterisk server.\n *\n * @param soundId - The unique identifier of the sound to retrieve details for.\n * @returns A Promise that resolves to a Sound object containing the details of the specified sound.\n */\n async getSoundDetails(soundId: string): Promise<Sound> {\n return this.sounds.getDetails(soundId);\n }\n\n /**\n * Retrieves general information about the Asterisk server.\n *\n * @returns A Promise that resolves to an AsteriskInfo object containing server information.\n */\n async getAsteriskInfo(): Promise<AsteriskInfo> {\n return this.asterisk.getInfo();\n }\n\n /**\n * Retrieves a list of all loaded modules in the Asterisk server.\n *\n * @returns A Promise that resolves to an array of Module objects representing the loaded modules.\n */\n async listModules(): Promise<Module[]> {\n return this.asterisk.listModules();\n }\n\n /**\n * Manages a specific module in the Asterisk server by loading, unloading, or reloading it.\n *\n * @param moduleName - The name of the module to manage.\n * @param action - The action to perform on the module: \"load\", \"unload\", or \"reload\".\n * @returns A Promise that resolves when the module management action is completed successfully.\n */\n async manageModule(\n moduleName: string,\n action: \"load\" | \"unload\" | \"reload\",\n ): Promise<void> {\n return this.asterisk.manageModule(moduleName, action);\n }\n\n /**\n * Retrieves a list of all configured logging channels in the Asterisk server.\n *\n * @returns A Promise that resolves to an array of Logging objects representing the configured logging channels.\n */\n async listLoggingChannels(): Promise<Logging[]> {\n return this.asterisk.listLoggingChannels();\n }\n\n /**\n * Adds or removes a log channel in the Asterisk server.\n *\n * @param logChannelName - The name of the log channel to manage.\n * @param action - The action to perform: \"add\" to create a new log channel or \"remove\" to delete an existing one.\n * @param configuration - Optional configuration object for adding a log channel. Ignored when removing a channel.\n * @param configuration.type - The type of the log channel.\n * @param configuration.configuration - Additional configuration details for the log channel.\n * @returns A Promise that resolves when the log channel management action is completed successfully.\n */\n async manageLogChannel(\n logChannelName: string,\n action: \"add\" | \"remove\",\n configuration?: { type?: string; configuration?: string },\n ): Promise<void> {\n return this.asterisk.manageLogChannel(\n logChannelName,\n action,\n configuration,\n );\n }\n\n /**\n * Retrieves the value of a global variable from the Asterisk server.\n *\n * @param variableName - The name of the global variable to retrieve.\n * @returns A Promise that resolves to a Variable object containing the name and value of the global variable.\n */\n async getGlobalVariable(variableName: string): Promise<Variable> {\n return this.asterisk.getGlobalVariable(variableName);\n }\n\n /**\n * Sets a global variable in the Asterisk server.\n *\n * This function allows you to set or update the value of a global variable\n * in the Asterisk server. Global variables are accessible throughout the\n * entire Asterisk system and can be used for various purposes such as\n * configuration settings or sharing data between different parts of the system.\n *\n * @param variableName - The name of the global variable to set or update.\n * This should be a string identifying the variable uniquely.\n * @param value - The value to assign to the global variable. This can be any\n * string value, including empty strings.\n * @returns A Promise that resolves when the global variable has been successfully\n * set. The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected\n * with an error object.\n */\n async setGlobalVariable(variableName: string, value: string): Promise<void> {\n return this.asterisk.setGlobalVariable(variableName, value);\n }\n}\n", "import axios, { type AxiosInstance } from \"axios\";\n\nexport class BaseClient {\n private client: AxiosInstance;\n\n constructor(baseUrl: string, username: string, password: string) {\n this.client = axios.create({\n baseURL: baseUrl,\n auth: { username, password },\n });\n }\n\n /**\n * Executes a GET request.\n * @param path - The API endpoint path.\n */\n async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\n\n /**\n * Executes a POST request.\n * @param path - The API endpoint path.\n * @param data - Optional payload to send with the request.\n */\n async post<T>(path: string, data?: unknown): Promise<T> {\n const response = await this.client.post<T>(path, data);\n return response.data;\n }\n\n /**\n * Executes a PUT request.\n * @param path - The API endpoint path.\n * @param data - Payload to send with the request.\n */\n async put<T>(path: string, data: unknown): Promise<T> {\n const response = await this.client.put<T>(path, data);\n return response.data;\n }\n\n /**\n * Executes a DELETE request.\n * @param path - The API endpoint path.\n */\n async delete<T>(path: string): Promise<T> {\n const response = await this.client.delete<T>(path);\n return response.data;\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n} from \"../interfaces/applications.types.js\";\n\nexport interface ApplicationMessage {\n event: string;\n data?: Record<string, any>;\n}\n\nexport class Applications {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all applications.\n * \n * @returns A promise that resolves to an array of Application objects.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Application[]> {\n const applications = await this.client.get<unknown>(\"/applications\");\n\n if (!Array.isArray(applications)) {\n throw new Error(\"Resposta da API /applications n\u00E3o \u00E9 um array.\");\n }\n\n return applications as Application[];\n }\n\n /**\n * Retrieves details of a specific application.\n * \n * @param appName - The name of the application to retrieve details for.\n * @returns A promise that resolves to an ApplicationDetails object.\n * @throws {Error} If there's an error fetching the application details.\n */\n async getDetails(appName: string): Promise<ApplicationDetails> {\n try {\n return await this.client.get<ApplicationDetails>(\n `/applications/${appName}`,\n );\n } catch (error) {\n console.error(`Erro ao obter detalhes do aplicativo ${appName}:`, error);\n throw error;\n }\n }\n\n /**\n * Sends a message to a specific application.\n * \n * @param appName - The name of the application to send the message to.\n * @param body - The message to be sent, containing an event and optional data.\n * @returns A promise that resolves when the message is successfully sent.\n */\n async sendMessage(appName: string, body: ApplicationMessage): Promise<void> {\n await this.client.post<void>(`/applications/${appName}/messages`, body);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n AsteriskInfo,\n Logging,\n Module,\n Variable,\n} from \"../interfaces/asterisk.types.js\";\n\nfunction toQueryParams<T>(options: T): string {\n return new URLSearchParams(\n Object.entries(options as Record<string, string>)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n ).toString();\n}\n\nexport class Asterisk {\n constructor(private client: BaseClient) {}\n\n /**\n * Retrieves information about the Asterisk server.\n */\n async getInfo(): Promise<AsteriskInfo> {\n return this.client.get<AsteriskInfo>(\"/asterisk/info\");\n }\n\n /**\n * Lists all loaded modules in the Asterisk server.\n */\n async listModules(): Promise<Module[]> {\n return this.client.get<Module[]>(\"/asterisk/modules\");\n }\n\n /**\n * Manages a specific module in the Asterisk server.\n *\n * @param moduleName - The name of the module to manage.\n * @param action - The action to perform on the module: \"load\", \"unload\", or \"reload\".\n * @returns A promise that resolves when the action is completed successfully.\n * @throws {Error} Throws an error if the HTTP method or action is invalid.\n */\n async manageModule(\n moduleName: string,\n action: \"load\" | \"unload\" | \"reload\",\n ): Promise<void> {\n const url = `/asterisk/modules/${moduleName}`;\n switch (action) {\n case \"load\":\n await this.client.post<void>(`${url}?action=load`);\n break;\n case \"unload\":\n await this.client.delete<void>(url);\n break;\n case \"reload\":\n await this.client.put<void>(url, {});\n break;\n default:\n throw new Error(`A\u00E7\u00E3o inv\u00E1lida: ${action}`);\n }\n }\n\n /**\n * Retrieves all configured logging channels.\n */\n async listLoggingChannels(): Promise<Logging[]> {\n return this.client.get<Logging[]>(\"/asterisk/logging\");\n }\n\n /**\n * Adds or removes a log channel in the Asterisk server.\n */\n async manageLogChannel(\n logChannelName: string,\n action: \"add\" | \"remove\",\n configuration?: { type?: string; configuration?: string },\n ): Promise<void> {\n const queryParams = toQueryParams(configuration || {});\n return this.client.post<void>(\n `/asterisk/logging/${logChannelName}?action=${encodeURIComponent(action)}&${queryParams}`,\n );\n }\n\n /**\n * Retrieves the value of a global variable.\n */\n async getGlobalVariable(variableName: string): Promise<Variable> {\n return this.client.get<Variable>(\n `/asterisk/variables?variable=${encodeURIComponent(variableName)}`,\n );\n }\n\n /**\n * Sets a global variable.\n */\n async setGlobalVariable(variableName: string, value: string): Promise<void> {\n return this.client.post<void>(\n `/asterisk/variables?variable=${encodeURIComponent(variableName)}&value=${encodeURIComponent(value)}`,\n );\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Channel,\n ChannelPlayback,\n ChannelVar,\n ExternalMediaOptions,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n} from \"../interfaces/channels.types.js\";\n\nfunction toQueryParams<T>(options: T): string {\n return new URLSearchParams(\n Object.entries(options as Record<string, string>) // Convers\u00E3o expl\u00EDcita\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, value as string]), // Garante que value \u00E9 string\n ).toString();\n}\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all active channels.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Creates a channel and places it in a Stasis app without dialing it.\n */\n async createChannel(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels/create\", data);\n }\n\n /**\n * Creates a new channel with a specific ID and originates a call.\n */\n async originateWithId(\n channelId: string,\n data: OriginateRequest,\n ): Promise<Channel> {\n return this.client.post<Channel>(`/channels/${channelId}`, data);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n */\n /**\n * Hangs up a specific channel with optional reason or reason code.\n */\n async hangup(\n channelId: string,\n options?: { reason_code?: string; reason?: string },\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n ...(options?.reason_code && { reason_code: options.reason_code }),\n ...(options?.reason && { reason: options.reason }),\n });\n\n return this.client.delete<void>(\n `/channels/${channelId}?${queryParams.toString()}`,\n );\n }\n\n /**\n * Continues the dialplan for a specific channel.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n\n /**\n * Sets a channel variable.\n */\n async setVariable(\n channelId: string,\n variable: string,\n value: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/variable`, {\n variable,\n value,\n });\n }\n\n /**\n * Gets a channel variable.\n */\n async getVariable(channelId: string, variable: string): Promise<ChannelVar> {\n return this.client.get<ChannelVar>(\n `/channels/${channelId}/variable?variable=${encodeURIComponent(variable)}`,\n );\n }\n\n /**\n * Plays a media file to a channel.\n */\n async playMedia(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n const queryParams = options\n ? `?${new URLSearchParams(options as Record<string, string>).toString()}`\n : \"\";\n\n return this.client.post<ChannelPlayback>(\n `/channels/${channelId}/play${queryParams}`,\n { media },\n );\n }\n\n /**\n * Starts music on hold (MOH) for a channel.\n */\n async startMusicOnHold(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/moh`);\n }\n\n /**\n * Stops music on hold (MOH) for a channel.\n */\n async stopMusicOnHold(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/moh`);\n }\n\n /**\n * Starts playback of a media file on a channel.\n */\n async startPlayback(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n const queryParams = options\n ? `?${new URLSearchParams(options as Record<string, string>).toString()}`\n : \"\";\n\n return this.client.post<ChannelPlayback>(\n `/channels/${channelId}/play${queryParams}`,\n { media },\n );\n }\n\n /**\n * Stops playback of a media file on a channel.\n */\n async stopPlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/play/${playbackId}`,\n );\n }\n\n /**\n * Pauses playback of a media file on a channel.\n */\n async pausePlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/pause`,\n );\n }\n\n /**\n * Resumes playback of a media file on a channel.\n */\n async resumePlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/play/${playbackId}/pause`,\n );\n }\n\n /**\n * Rewinds playback of a media file on a channel.\n */\n async rewindPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/rewind`,\n { skipMs },\n );\n }\n\n /**\n * Fast-forwards playback of a media file on a channel.\n */\n async fastForwardPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/forward`,\n { skipMs },\n );\n }\n\n /**\n * Records audio from a channel.\n */\n async record(channelId: string, options: RecordingOptions): Promise<Channel> {\n // Converte RecordingOptions para URLSearchParams, garantindo compatibilidade\n const queryParams = new URLSearchParams(\n Object.entries(options as unknown as Record<string, string>).filter(\n ([, value]) => value !== undefined,\n ),\n );\n\n return this.client.post<Channel>(\n `/channels/${channelId}/record?${queryParams.toString()}`,\n );\n }\n\n /**\n * Starts snooping on a channel.\n */\n async snoopChannel(\n channelId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n const queryParams = toQueryParams(options);\n\n return this.client.post<Channel>(\n `/channels/${channelId}/snoop?${queryParams}`,\n );\n }\n\n /**\n * Starts snooping on a channel with a specific snoop ID.\n */\n async snoopChannelWithId(\n channelId: string,\n snoopId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n const queryParams = new URLSearchParams(options as Record<string, string>);\n return this.client.post<Channel>(\n `/channels/${channelId}/snoop/${snoopId}?${queryParams.toString()}`,\n );\n }\n\n /**\n * Dials a created channel.\n */\n async dial(\n channelId: string,\n caller?: string,\n timeout?: number,\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n ...(caller && { caller }),\n ...(timeout && { timeout: timeout.toString() }),\n });\n return this.client.post<void>(\n `/channels/${channelId}/dial?${queryParams.toString()}`,\n );\n }\n\n /**\n * Retrieves RTP statistics for a channel.\n */\n async getRTPStatistics(channelId: string): Promise<RTPStats> {\n return this.client.get<RTPStats>(`/channels/${channelId}/rtp_statistics`);\n }\n\n /**\n * Creates a channel to an external media source/sink.\n */\n async createExternalMedia(options: ExternalMediaOptions): Promise<Channel> {\n const queryParams = new URLSearchParams(options as Record<string, string>);\n return this.client.post<Channel>(\n `/channels/externalMedia?${queryParams.toString()}`,\n );\n }\n\n /**\n * Redirects the channel to a different location.\n */\n async redirectChannel(channelId: string, endpoint: string): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/redirect?endpoint=${encodeURIComponent(endpoint)}`,\n );\n }\n\n /**\n * Answers a channel.\n */\n async answerChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/answer`);\n }\n\n /**\n * Sends a ringing indication to a channel.\n */\n async ringChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/ring`);\n }\n\n /**\n * Stops ringing indication on a channel.\n */\n async stopRingChannel(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/ring`);\n }\n\n /**\n * Sends DTMF to a channel.\n */\n async sendDTMF(\n channelId: string,\n dtmf: string,\n options?: {\n before?: number;\n between?: number;\n duration?: number;\n after?: number;\n },\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n dtmf,\n ...(options?.before && { before: options.before.toString() }),\n ...(options?.between && { between: options.between.toString() }),\n ...(options?.duration && { duration: options.duration.toString() }),\n ...(options?.after && { after: options.after.toString() }),\n });\n\n return this.client.post<void>(\n `/channels/${channelId}/dtmf?${queryParams.toString()}`,\n );\n }\n\n /**\n * Mutes a channel.\n */\n async muteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/mute?direction=${direction}`,\n );\n }\n\n /**\n * Unmutes a channel.\n */\n async unmuteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/mute?direction=${direction}`,\n );\n }\n\n /**\n * Puts a channel on hold.\n */\n async holdChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hold`);\n }\n\n /**\n * Removes a channel from hold.\n */\n async unholdChannel(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/hold`);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Endpoint, EndpointDetails } from \"../interfaces/endpoints.types\";\n\nexport class Endpoints {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available endpoints.\n *\n * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Endpoint[]> {\n const endpoints = await this.client.get<unknown>(\"/endpoints\");\n\n if (!Array.isArray(endpoints)) {\n throw new Error(\"Resposta da API /endpoints n\u00E3o \u00E9 um array.\");\n }\n\n return endpoints as Endpoint[];\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.\n */\n async getDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.client.get<EndpointDetails>(\n `/endpoints/${technology}/${resource}`,\n );\n }\n\n /**\n * Sends a message to a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @param message - The message payload to send to the endpoint.\n * @returns A promise that resolves when the message has been successfully sent.\n */\n async sendMessage(\n technology: string,\n resource: string,\n message: Record<string, unknown>,\n ): Promise<void> {\n await this.client.post<void>(\n `/endpoints/${technology}/${resource}/sendMessage`,\n message,\n );\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Playback,\n PlaybackControlRequest,\n} from \"../interfaces/playbacks.types.js\";\n\nexport class Playbacks {\n constructor(private client: BaseClient) {}\n\n /**\n * Retrieves details of a specific playback.\n *\n * @param playbackId - The unique identifier of the playback.\n * @returns A promise that resolves to a Playback object containing the details of the specified playback.\n */\n async getDetails(playbackId: string): Promise<Playback> {\n return this.client.get<Playback>(`/playbacks/${playbackId}`);\n }\n\n /**\n * Controls a specific playback (e.g., pause, resume, rewind, forward, stop).\n *\n * @param playbackId - The unique identifier of the playback to control.\n * @param controlRequest - The PlaybackControlRequest containing the control operation.\n * @returns A promise that resolves when the control operation is successfully executed.\n */\n async control(\n playbackId: string,\n controlRequest: PlaybackControlRequest,\n ): Promise<void> {\n await this.client.post<void>(\n `/playbacks/${playbackId}/control`,\n controlRequest,\n );\n }\n\n /**\n * Stops a specific playback.\n *\n * @param playbackId - The unique identifier of the playback to stop.\n * @returns A promise that resolves when the playback is successfully stopped.\n */\n async stop(playbackId: string): Promise<void> {\n await this.client.post<void>(`/playbacks/${playbackId}/stop`);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Sound, SoundListRequest } from \"../interfaces/sounds.types.js\";\n\nexport class Sounds {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available sounds.\n *\n * @param params - Optional parameters to filter the list of sounds.\n * @returns A promise that resolves to an array of Sound objects.\n * @throws {Error} If the API response is not an array.\n */\n async list(params?: SoundListRequest): Promise<Sound[]> {\n const query = params\n ? `?${new URLSearchParams(params as Record<string, string>).toString()}`\n : \"\";\n\n const sounds = await this.client.get<unknown>(`/sounds${query}`);\n\n if (!Array.isArray(sounds)) {\n throw new Error(\"Resposta da API /sounds n\u00E3o \u00E9 um array.\");\n }\n\n return sounds as Sound[];\n }\n\n /**\n * Retrieves details of a specific sound.\n *\n * @param soundId - The unique identifier of the sound.\n * @returns A promise that resolves to a Sound object containing the details of the specified sound.\n */\n async getDetails(soundId: string): Promise<Sound> {\n return this.client.get<Sound>(`/sounds/${soundId}`);\n }\n}\n", "import WebSocket from \"ws\";\nimport type { WebSocketEvent } from \"./interfaces/events.types\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on<T extends WebSocketEvent[\"type\"]>(\n event: \"message\" | \"open\" | \"error\" | \"close\",\n callback: (data: Extract<WebSocketEvent, { type: T }>) => void,\n ): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n if (event === \"message\") {\n this.ws.on(event, (rawData) => {\n try {\n const decodedData = JSON.parse(rawData.toString());\n if (decodedData?.type) {\n const matchedEvent = decodedData as WebSocketEvent;\n callback(matchedEvent as Extract<WebSocketEvent, { type: T }>);\n } else {\n console.warn(\"Mensagem sem tipo:\", decodedData);\n }\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n }\n });\n } else {\n this.ws.on(event, callback as (data: any) => void);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log(\"WebSocket fechado manualmente.\");\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,QAAM,iBAAkC;MACtC,mBAAmB;MACnB,QAAQ;MACR,UAAU;MACV,eAAe;MACf,OAAO,WAAA;AAAM,eAAA;MAAA;MACb,eAAe;MACf,cAAc;;AAGhB,aAAgB,oBAAoB,SAAuB;AACzD,UAAM,YAAS,SAAA,SAAA,CAAA,GAAyB,cAAc,GAAK,OAAO;AAElE,UAAI,UAAU,gBAAgB,GAAG;AAC/B,kBAAU,gBAAgB;;AAG5B,aAAO;IACT;AARA,IAAAA,SAAA,sBAAA;;;;;;;;;ACxBA,aAAgB,WAAW,OAAa;AACpC,UAAM,gBAAgB,KAAK,OAAM,IAAK;AACtC,aAAO,KAAK,MAAM,aAAa;IACnC;AAHA,IAAAC,SAAA,aAAA;;;;;;;;;ACAA,aAAgB,SAAS,OAAa;AAClC,aAAO;IACX;AAFA,IAAAC,SAAA,WAAA;;;;;;;;;ACCA,QAAA,gBAAA;AACA,QAAA,cAAA;AAIA,aAAgB,cAAc,SAAwB;AACpD,cAAQ,QAAQ,QAAQ;QACtB,KAAK;AACH,iBAAO,cAAA;QAET,KAAK;QACL;AACE,iBAAO,YAAA;;IAEb;AATA,IAAAC,SAAA,gBAAA;;;;;;;;;ACJA,QAAA,mBAAA;AAEA,QAAA;;MAAA,WAAA;AAEE,iBAAAC,OAAoB,SAAwB;AAAxB,eAAA,UAAA;AADV,eAAA,UAAU;Q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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBA,MAAM,kBAAkB,cAAsB,OAA8B;AAC1E,WAAO,KAAK,SAAS,kBAAkB,cAAc,KAAK;AAAA,EAC5D;AACF;",
3
+ "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/index.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/applications.ts", "../../src/ari-client/resources/asterisk.ts", "../../src/ari-client/resources/bridges.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/resources/endpoints.ts", "../../src/ari-client/resources/playbacks.ts", "../../src/ari-client/resources/sounds.ts", "../../src/ari-client/websocketClient.ts"],
4
+ "sourcesContent": [null, null, null, null, null, null, null, null, null, "// Exporta a classe principal AriClient\nexport { AriClient } from \"./ari-client/ariClient.js\";\n\n// Exporta as classes dos recursos, caso o usu\u00E1rio precise us\u00E1-las diretamente\nexport { Channels } from \"./ari-client/resources/channels.js\";\nexport { Endpoints } from \"./ari-client/resources/endpoints.js\";\nexport { Applications } from \"./ari-client/resources/applications.js\";\nexport { Sounds } from \"./ari-client/resources/sounds.js\";\nexport { Playbacks } from \"./ari-client/resources/playbacks.js\";\nexport { Asterisk } from \"./ari-client/resources/asterisk.js\";\nexport { Bridges } from \"./ari-client/resources/bridges.js\";\n\n// Exporta interfaces importantes para tipagem\nexport type {\n AriClientConfig,\n Channel,\n Endpoint,\n Playback,\n Application,\n Sound,\n AsteriskInfo,\n Module,\n Logging,\n Variable,\n WebSocketEvent,\n WebSocketEventType,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n ExternalMediaOptions,\n ChannelPlayback,\n ChannelVar,\n ChannelDialplan,\n AriApplication,\n EndpointDetails,\n PlaybackControlRequest,\n ApplicationDetails,\n SoundListRequest,\n PlayMediaRequest,\n Bridge,\n BridgePlayback,\n CreateBridgeRequest,\n RemoveChannelRequest,\n AddChannelRequest,\n} from \"./ari-client/interfaces/index.js\";\n", "import { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n WebSocketEventType,\n} from \"./interfaces\";\nimport type { AsteriskInfo, Logging, Module, Variable } from \"./interfaces\";\nimport type {\n Channel,\n ChannelPlayback,\n ChannelVar,\n ExternalMediaOptions,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n} from \"./interfaces\";\nimport type { Endpoint, EndpointDetails } from \"./interfaces\";\nimport type { WebSocketEvent } from \"./interfaces\";\nimport type { AriApplication, AriClientConfig } from \"./interfaces\";\nimport type { Sound, SoundListRequest } from \"./interfaces\";\nimport type {\n Playback as APIPlayback,\n PlaybackControlRequest,\n} from \"./interfaces/playbacks.types\";\nimport { Applications } from \"./resources/applications.js\";\nimport { Asterisk } from \"./resources/asterisk\";\nimport { Bridges } from \"./resources/bridges\";\nimport { Channels } from \"./resources/channels.js\";\nimport { Endpoints } from \"./resources/endpoints\";\nimport { Playbacks } from \"./resources/playbacks\";\nimport { Sounds } from \"./resources/sounds\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n private isReconnecting = false;\n\n public channels: Channels;\n public endpoints: Endpoints;\n public applications: Applications;\n public playbacks: Playbacks;\n public sounds: Sounds;\n public asterisk: Asterisk;\n public bridges: Bridges;\n\n constructor(private config: AriClientConfig) {\n const httpProtocol = config.secure ? \"https\" : \"http\";\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n this.channels = new Channels(this.baseClient);\n this.endpoints = new Endpoints(this.baseClient);\n this.applications = new Applications(this.baseClient);\n this.playbacks = new Playbacks(this.baseClient);\n this.sounds = new Sounds(this.baseClient);\n this.asterisk = new Asterisk(this.baseClient);\n this.bridges = new Bridges(this.baseClient);\n }\n\n /**\n * Connects to the ARI WebSocket for a specific application.\n *\n * @param app - The application name to connect to.\n * @param subscribedEvents\n * @returns {Promise<void>} Resolves when the WebSocket connects successfully.\n */\n async connectWebSocket(\n app: string,\n subscribedEvents?: WebSocketEventType[],\n ): Promise<void> {\n if (!app) {\n throw new Error(\n \"The 'app' parameter is required to connect to the WebSocket.\",\n );\n }\n\n if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n // Se nenhum evento foi especificado, assumimos que o cliente quer escutar todos.\n const eventsParam =\n subscribedEvents && subscribedEvents.length > 0\n ? `&event=${subscribedEvents.join(\",\")}`\n : \"&subscribeAll=true\";\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}${eventsParam}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback function for WebSocket events.\n * This method allows you to listen for and respond to WebSocket messages\n * and process specific event types.\n *\n * @param callback - The callback function to execute when a WebSocket message is received.\n * The function will receive the parsed event data as its parameter.\n * @throws {Error} Throws an error if the WebSocket is not connected when trying to register the event.\n * @returns {void}\n */\n onWebSocketEvent<T extends WebSocketEvent[\"type\"]>(\n callback: (data: Extract<WebSocketEvent, { type: T }>) => void,\n ): void {\n if (!this.wsClient) {\n throw new Error(\"WebSocket is not connected.\");\n }\n\n this.wsClient.on(\"message\", callback);\n }\n\n /**\n * Closes the WebSocket connection.\n */\n closeWebSocket(): void {\n if (this.wsClient) {\n this.wsClient.close();\n this.wsClient = null;\n }\n }\n /**\n * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n /**\n * Lists all active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\n }\n\n /**\n * Creates a new channel.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n\n /**\n * Sets a channel variable.\n */\n async setChannelVariable(\n channelId: string,\n variable: string,\n value: string,\n ): Promise<void> {\n return this.channels.setVariable(channelId, variable, value);\n }\n\n /**\n * Gets a channel variable.\n */\n async getChannelVariable(\n channelId: string,\n variable: string,\n ): Promise<ChannelVar> {\n return this.channels.getVariable(channelId, variable);\n }\n\n /**\n * Plays a media file to a channel.\n */\n async playMediaToChannel(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n return this.channels.playMedia(channelId, media, options);\n }\n\n /**\n * Starts music on hold for a channel.\n */\n async startChannelMusicOnHold(channelId: string): Promise<void> {\n return this.channels.startMusicOnHold(channelId);\n }\n\n /**\n * Stops music on hold for a channel.\n */\n async stopChannelMusicOnHold(channelId: string): Promise<void> {\n return this.channels.stopMusicOnHold(channelId);\n }\n\n /**\n * Starts playback of a media file on a channel.\n */\n async startChannelPlayback(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n return this.channels.startPlayback(channelId, media, options);\n }\n\n /**\n * Stops playback of a media file on a channel.\n */\n async stopChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.stopPlayback(channelId, playbackId);\n }\n\n /**\n * Pauses playback of a media file on a channel.\n */\n async pauseChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.pausePlayback(channelId, playbackId);\n }\n\n /**\n * Resumes playback of a media file on a channel.\n */\n async resumeChannelPlayback(\n channelId: string,\n playbackId: string,\n ): Promise<void> {\n return this.channels.resumePlayback(channelId, playbackId);\n }\n\n /**\n * Rewinds playback of a media file on a channel.\n */\n async rewindChannelPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.channels.rewindPlayback(channelId, playbackId, skipMs);\n }\n\n /**\n * Fast-forwards playback of a media file on a channel.\n */\n async fastForwardChannelPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.channels.fastForwardPlayback(channelId, playbackId, skipMs);\n }\n\n /**\n * Records audio from a channel.\n */\n async recordAudio(\n channelId: string,\n options: RecordingOptions,\n ): Promise<Channel> {\n return this.channels.record(channelId, options);\n }\n\n /**\n * Starts snooping on a channel.\n */\n async snoopChannel(\n channelId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n return this.channels.snoopChannel(channelId, options);\n }\n\n /**\n * Starts snooping on a channel with a specific snoop ID.\n */\n async snoopChannelWithId(\n channelId: string,\n snoopId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n return this.channels.snoopChannelWithId(channelId, snoopId, options);\n }\n\n /**\n * Initiates a dial operation on a previously created channel.\n * This function attempts to connect the specified channel to its configured destination.\n *\n * @param channelId - The unique identifier of the channel to dial.\n * @param caller - Optional. The caller ID to use for the outgoing call. If not provided, the default caller ID for the channel will be used.\n * @param timeout - Optional. The maximum time in seconds to wait for the dial operation to complete. If not specified, the system's default timeout will be used.\n * @returns A Promise that resolves when the dial operation has been initiated successfully. Note that this does not guarantee that the call was answered, only that dialing has begun.\n * @throws Will throw an error if the dial operation fails, e.g., if the channel doesn't exist or is in an invalid state.\n */\n async dialChannel(\n channelId: string,\n caller?: string,\n timeout?: number,\n ): Promise<void> {\n return this.channels.dial(channelId, caller, timeout);\n }\n\n /**\n * Retrieves RTP statistics for a channel.\n */\n async getRTPStatistics(channelId: string): Promise<RTPStats> {\n return this.channels.getRTPStatistics(channelId);\n }\n\n /**\n * Creates a channel to an external media source/sink.\n */\n async createExternalMedia(options: ExternalMediaOptions): Promise<Channel> {\n return this.channels.createExternalMedia(options);\n }\n\n /**\n * Redirects a channel to a different location.\n */\n async redirectChannel(channelId: string, endpoint: string): Promise<void> {\n return this.channels.redirectChannel(channelId, endpoint);\n }\n\n /**\n * Answers a channel.\n */\n async answerChannel(channelId: string): Promise<void> {\n return this.channels.answerChannel(channelId);\n }\n\n /**\n * Sends a ringing indication to a channel.\n */\n async ringChannel(channelId: string): Promise<void> {\n return this.channels.ringChannel(channelId);\n }\n\n /**\n * Stops the ringing indication on a specified channel in the Asterisk system.\n *\n * This function sends a request to the Asterisk server to cease the ringing\n * indication on a particular channel. This is typically used when you want to\n * stop the ringing sound on a channel without answering or hanging up the call.\n *\n * @param channelId - The unique identifier of the channel on which to stop the ringing.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the ringing has been successfully stopped on the specified channel.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async stopRingChannel(channelId: string): Promise<void> {\n return this.channels.stopRingChannel(channelId);\n }\n\n /**\n * Sends DTMF (Dual-Tone Multi-Frequency) tones to a specified channel.\n *\n * This function allows sending DTMF tones to a channel, which can be used for various purposes\n * such as interacting with IVR systems or sending signals during a call.\n *\n * @param channelId - The unique identifier of the channel to send DTMF tones to.\n * @param dtmf - A string representing the DTMF tones to send (e.g., \"123#\").\n * @param options - Optional parameters to control the timing of DTMF tones.\n * @param options.before - The time (in milliseconds) to wait before sending DTMF.\n * @param options.between - The time (in milliseconds) to wait between each DTMF tone.\n * @param options.duration - The duration (in milliseconds) of each DTMF tone.\n * @param options.after - The time (in milliseconds) to wait after sending all DTMF tones.\n * @returns A Promise that resolves when the DTMF tones have been successfully sent.\n */\n async sendDTMF(\n channelId: string,\n dtmf: string,\n options?: {\n before?: number;\n between?: number;\n duration?: number;\n after?: number;\n },\n ): Promise<void> {\n return this.channels.sendDTMF(channelId, dtmf, options);\n }\n\n /**\n * Mutes a channel in the Asterisk system.\n *\n * This function initiates a mute operation on the specified channel, preventing\n * audio transmission in the specified direction(s).\n *\n * @param channelId - The unique identifier of the channel to be muted.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n * @param direction - The direction of audio to mute. Can be one of:\n * - \"both\": Mute both incoming and outgoing audio (default)\n * - \"in\": Mute only incoming audio\n * - \"out\": Mute only outgoing audio\n *\n * @returns A Promise that resolves when the mute operation has been successfully completed.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async muteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.channels.muteChannel(channelId, direction);\n }\n\n /**\n * Unmutes a channel in the Asterisk system.\n *\n * This function removes the mute status from a specified channel, allowing audio\n * transmission to resume in the specified direction(s).\n *\n * @param channelId - The unique identifier of the channel to be unmuted.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n * @param direction - The direction of audio to unmute. Can be one of:\n * - \"both\": Unmute both incoming and outgoing audio (default)\n * - \"in\": Unmute only incoming audio\n * - \"out\": Unmute only outgoing audio\n *\n * @returns A Promise that resolves when the unmute operation has been successfully completed.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async unmuteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.channels.unmuteChannel(channelId, direction);\n }\n\n /**\n * Puts a specified channel on hold.\n *\n * This function initiates a hold operation on the specified channel in the Asterisk system.\n * When a channel is put on hold, typically the audio is muted or replaced with hold music,\n * depending on the system configuration.\n *\n * @param channelId - The unique identifier of the channel to be put on hold.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the hold operation has been successfully initiated.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async holdChannel(channelId: string): Promise<void> {\n return this.channels.holdChannel(channelId);\n }\n\n /**\n * Removes a specified channel from hold.\n *\n * This function initiates an unhold operation on the specified channel in the Asterisk system.\n * When a channel is taken off hold, it typically resumes normal audio transmission,\n * allowing the parties to continue their conversation.\n *\n * @param channelId - The unique identifier of the channel to be taken off hold.\n * This should be a string that uniquely identifies the channel in the Asterisk system.\n *\n * @returns A Promise that resolves when the unhold operation has been successfully initiated.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n */\n async unholdChannel(channelId: string): Promise<void> {\n return this.channels.unholdChannel(channelId);\n }\n\n /**\n * Creates a new channel in the Asterisk system using the provided originate request data.\n * This function initiates a new communication channel based on the specified parameters.\n *\n * @param data - An object containing the originate request data for channel creation.\n * This includes details such as the endpoint to call, the context to use,\n * and any variables to set on the new channel.\n * @param data.endpoint - The endpoint to call (e.g., \"SIP/1234\").\n * @param data.extension - The extension to dial after the channel is created.\n * @param data.context - The dialplan context to use for the new channel.\n * @param data.priority - The priority to start at in the dialplan.\n * @param data.app - The application to execute on the channel (alternative to extension/context/priority).\n * @param data.appArgs - The arguments to pass to the application, if 'app' is specified.\n * @param data.callerId - The caller ID to set on the new channel.\n * @param data.timeout - The timeout (in seconds) to wait for the channel to be answered.\n * @param data.variables - An object containing key-value pairs of channel variables to set.\n * @param data.channelId - An optional ID to assign to the new channel.\n * @param data.otherChannelId - The ID of another channel to bridge with after creation.\n *\n * @returns A Promise that resolves to the created Channel object.\n * The Channel object contains details about the newly created channel,\n * such as its unique identifier, state, and other relevant information.\n *\n * @throws Will throw an error if the channel creation fails for any reason,\n * such as invalid parameters or system issues.\n */\n async createChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.createChannel(data);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @param options - Optional parameters for the hangup operation.\n * @param options.reason_code - An optional reason code for the hangup.\n * @param options.reason - An optional textual reason for the hangup.\n * @returns A promise that resolves when the hangup operation is complete.\n */\n async hangup(\n channelId: string,\n options?: { reason_code?: string; reason?: string },\n ): Promise<void> {\n return this.channels.hangup(channelId, options);\n }\n\n /**\n * Originates a new channel with a specified ID using the provided originate request data.\n *\n * @param channelId - The desired unique identifier for the new channel.\n * @param data - The originate request data containing channel creation parameters.\n * @returns A promise that resolves to the created Channel object.\n */\n async originateWithId(\n channelId: string,\n data: OriginateRequest,\n ): Promise<Channel> {\n return this.channels.originateWithId(channelId, data);\n }\n\n // M\u00E9todos relacionados a endpoints:\n\n /**\n * Lists all endpoints.\n *\n * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.\n */\n async listEndpoints(): Promise<Endpoint[]> {\n return this.endpoints.list();\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.\n */\n async getEndpointDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.endpoints.getDetails(technology, resource);\n }\n\n /**\n * Sends a message to an endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent.\n */\n async sendMessageToEndpoint(\n technology: string,\n resource: string,\n body: any,\n ): Promise<void> {\n return this.endpoints.sendMessage(technology, resource, body);\n }\n\n // M\u00E9todos relacionados a applications\n /**\n * Lists all applications.\n *\n * @returns {Promise<Application[]>} A promise resolving to the list of applications.\n */\n async listApplications(): Promise<Application[]> {\n return this.applications.list();\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The name of the application.\n * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.\n */\n async getApplicationDetails(appName: string): Promise<ApplicationDetails> {\n return this.applications.getDetails(appName);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The name of the application.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent successfully.\n */\n async sendMessageToApplication(appName: string, body: any): Promise<void> {\n return this.applications.sendMessage(appName, body);\n }\n\n // M\u00E9todos relacionados a playbacks\n /**\n * Retrieves details of a specific playback.\n *\n * @param playbackId - The unique identifier of the playback.\n * @returns {Promise<Playback>} A promise resolving to the playback details.\n */\n async getPlaybackDetails(playbackId: string): Promise<APIPlayback> {\n return this.playbacks.getDetails(playbackId);\n }\n\n /**\n * Controls a specific playback in the Asterisk server.\n * This function allows manipulation of an ongoing playback, such as pausing, resuming, or skipping.\n *\n * @param playbackId - The unique identifier of the playback to control.\n * This should be a string that uniquely identifies the playback in the Asterisk system.\n * @param controlRequest - An object containing the control operation details.\n * This object should conform to the PlaybackControlRequest interface,\n * which includes an 'operation' property specifying the control action to perform.\n * @returns A Promise that resolves when the control operation is successfully executed.\n * The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected with an error object.\n * @throws Will throw an error if the playback control operation fails, e.g., if the playback doesn't exist\n * or the requested operation is invalid.\n */\nasync controlPlayback(\n playbackId: string,\n controlRequest: PlaybackControlRequest,\n): Promise<void> {\n const { operation } = controlRequest; // Extrai a opera\u00E7\u00E3o do objeto\n return this.playbacks.control(playbackId, operation);\n}\n\n /**\n * Stops a specific playback in the Asterisk server.\n *\n * @param playbackId - The unique identifier of the playback to stop.\n * @returns A Promise that resolves when the playback is successfully stopped.\n */\n async stopPlayback(playbackId: string): Promise<void> {\n return this.playbacks.stop(playbackId);\n }\n\n /**\n * Retrieves a list of all available sounds in the Asterisk server.\n *\n * @param params - Optional parameters to filter the list of sounds.\n * @returns A Promise that resolves to an array of Sound objects representing the available sounds.\n */\n async listSounds(params?: SoundListRequest): Promise<Sound[]> {\n return this.sounds.list(params);\n }\n\n /**\n * Retrieves detailed information about a specific sound in the Asterisk server.\n *\n * @param soundId - The unique identifier of the sound to retrieve details for.\n * @returns A Promise that resolves to a Sound object containing the details of the specified sound.\n */\n async getSoundDetails(soundId: string): Promise<Sound> {\n return this.sounds.getDetails(soundId);\n }\n\n /**\n * Retrieves general information about the Asterisk server.\n *\n * @returns A Promise that resolves to an AsteriskInfo object containing server information.\n */\n async getAsteriskInfo(): Promise<AsteriskInfo> {\n return this.asterisk.getInfo();\n }\n\n /**\n * Retrieves a list of all loaded modules in the Asterisk server.\n *\n * @returns A Promise that resolves to an array of Module objects representing the loaded modules.\n */\n async listModules(): Promise<Module[]> {\n return this.asterisk.listModules();\n }\n\n /**\n * Manages a specific module in the Asterisk server by loading, unloading, or reloading it.\n *\n * @param moduleName - The name of the module to manage.\n * @param action - The action to perform on the module: \"load\", \"unload\", or \"reload\".\n * @returns A Promise that resolves when the module management action is completed successfully.\n */\n async manageModule(\n moduleName: string,\n action: \"load\" | \"unload\" | \"reload\",\n ): Promise<void> {\n return this.asterisk.manageModule(moduleName, action);\n }\n\n /**\n * Retrieves a list of all configured logging channels in the Asterisk server.\n *\n * @returns A Promise that resolves to an array of Logging objects representing the configured logging channels.\n */\n async listLoggingChannels(): Promise<Logging[]> {\n return this.asterisk.listLoggingChannels();\n }\n\n /**\n * Adds or removes a log channel in the Asterisk server.\n *\n * @param logChannelName - The name of the log channel to manage.\n * @param action - The action to perform: \"add\" to create a new log channel or \"remove\" to delete an existing one.\n * @param configuration - Optional configuration object for adding a log channel. Ignored when removing a channel.\n * @param configuration.type - The type of the log channel.\n * @param configuration.configuration - Additional configuration details for the log channel.\n * @returns A Promise that resolves when the log channel management action is completed successfully.\n */\n async manageLogChannel(\n logChannelName: string,\n action: \"add\" | \"remove\",\n configuration?: { type?: string; configuration?: string },\n ): Promise<void> {\n return this.asterisk.manageLogChannel(\n logChannelName,\n action,\n configuration,\n );\n }\n\n /**\n * Retrieves the value of a global variable from the Asterisk server.\n *\n * @param variableName - The name of the global variable to retrieve.\n * @returns A Promise that resolves to a Variable object containing the name and value of the global variable.\n */\n async getGlobalVariable(variableName: string): Promise<Variable> {\n return this.asterisk.getGlobalVariable(variableName);\n }\n\n /**\n * Sets a global variable in the Asterisk server.\n *\n * This function allows you to set or update the value of a global variable\n * in the Asterisk server. Global variables are accessible throughout the\n * entire Asterisk system and can be used for various purposes such as\n * configuration settings or sharing data between different parts of the system.\n *\n * @param variableName - The name of the global variable to set or update.\n * This should be a string identifying the variable uniquely.\n * @param value - The value to assign to the global variable. This can be any\n * string value, including empty strings.\n * @returns A Promise that resolves when the global variable has been successfully\n * set. The promise resolves to void, indicating no specific return value.\n * If an error occurs during the operation, the promise will be rejected\n * with an error object.\n */\n async setGlobalVariable(variableName: string, value: string): Promise<void> {\n return this.asterisk.setGlobalVariable(variableName, value);\n }\n}\n", "import axios, { type AxiosInstance } from \"axios\";\n\nexport class BaseClient {\n private client: AxiosInstance;\n\n constructor(baseUrl: string, username: string, password: string) {\n this.client = axios.create({\n baseURL: baseUrl,\n auth: { username, password },\n });\n }\n\n /**\n * Executes a GET request.\n * @param path - The API endpoint path.\n */\n async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\n\n /**\n * Executes a POST request.\n * @param path - The API endpoint path.\n * @param data - Optional payload to send with the request.\n */\n async post<T>(path: string, data?: unknown): Promise<T> {\n const response = await this.client.post<T>(path, data);\n return response.data;\n }\n\n /**\n * Executes a PUT request.\n * @param path - The API endpoint path.\n * @param data - Payload to send with the request.\n */\n async put<T>(path: string, data: unknown): Promise<T> {\n const response = await this.client.put<T>(path, data);\n return response.data;\n }\n\n /**\n * Executes a DELETE request.\n * @param path - The API endpoint path.\n */\n async delete<T>(path: string): Promise<T> {\n const response = await this.client.delete<T>(path);\n return response.data;\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n} from \"../interfaces/applications.types.js\";\n\nexport interface ApplicationMessage {\n event: string;\n data?: Record<string, any>;\n}\n\nexport class Applications {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all applications.\n * \n * @returns A promise that resolves to an array of Application objects.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Application[]> {\n const applications = await this.client.get<unknown>(\"/applications\");\n\n if (!Array.isArray(applications)) {\n throw new Error(\"Resposta da API /applications n\u00E3o \u00E9 um array.\");\n }\n\n return applications as Application[];\n }\n\n /**\n * Retrieves details of a specific application.\n * \n * @param appName - The name of the application to retrieve details for.\n * @returns A promise that resolves to an ApplicationDetails object.\n * @throws {Error} If there's an error fetching the application details.\n */\n async getDetails(appName: string): Promise<ApplicationDetails> {\n try {\n return await this.client.get<ApplicationDetails>(\n `/applications/${appName}`,\n );\n } catch (error) {\n console.error(`Erro ao obter detalhes do aplicativo ${appName}:`, error);\n throw error;\n }\n }\n\n /**\n * Sends a message to a specific application.\n * \n * @param appName - The name of the application to send the message to.\n * @param body - The message to be sent, containing an event and optional data.\n * @returns A promise that resolves when the message is successfully sent.\n */\n async sendMessage(appName: string, body: ApplicationMessage): Promise<void> {\n await this.client.post<void>(`/applications/${appName}/messages`, body);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { AsteriskInfo, Logging, Module, Variable } from \"../interfaces\";\n\nfunction toQueryParams<T>(options: T): string {\n return new URLSearchParams(\n Object.entries(options as Record<string, string>)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n ).toString();\n}\n\nexport class Asterisk {\n constructor(private client: BaseClient) {}\n\n /**\n * Retrieves information about the Asterisk server.\n */\n async getInfo(): Promise<AsteriskInfo> {\n return this.client.get<AsteriskInfo>(\"/asterisk/info\");\n }\n\n /**\n * Lists all loaded modules in the Asterisk server.\n */\n async listModules(): Promise<Module[]> {\n return this.client.get<Module[]>(\"/asterisk/modules\");\n }\n\n /**\n * Manages a specific module in the Asterisk server.\n *\n * @param moduleName - The name of the module to manage.\n * @param action - The action to perform on the module: \"load\", \"unload\", or \"reload\".\n * @returns A promise that resolves when the action is completed successfully.\n * @throws {Error} Throws an error if the HTTP method or action is invalid.\n */\n async manageModule(\n moduleName: string,\n action: \"load\" | \"unload\" | \"reload\",\n ): Promise<void> {\n const url = `/asterisk/modules/${moduleName}`;\n switch (action) {\n case \"load\":\n await this.client.post<void>(`${url}?action=load`);\n break;\n case \"unload\":\n await this.client.delete<void>(url);\n break;\n case \"reload\":\n await this.client.put<void>(url, {});\n break;\n default:\n throw new Error(`A\u00E7\u00E3o inv\u00E1lida: ${action}`);\n }\n }\n\n /**\n * Retrieves all configured logging channels.\n */\n async listLoggingChannels(): Promise<Logging[]> {\n return this.client.get<Logging[]>(\"/asterisk/logging\");\n }\n\n /**\n * Adds or removes a log channel in the Asterisk server.\n */\n async manageLogChannel(\n logChannelName: string,\n action: \"add\" | \"remove\",\n configuration?: { type?: string; configuration?: string },\n ): Promise<void> {\n const queryParams = toQueryParams(configuration || {});\n return this.client.post<void>(\n `/asterisk/logging/${logChannelName}?action=${encodeURIComponent(action)}&${queryParams}`,\n );\n }\n\n /**\n * Retrieves the value of a global variable.\n */\n async getGlobalVariable(variableName: string): Promise<Variable> {\n return this.client.get<Variable>(\n `/asterisk/variables?variable=${encodeURIComponent(variableName)}`,\n );\n }\n\n /**\n * Sets a global variable.\n */\n async setGlobalVariable(variableName: string, value: string): Promise<void> {\n return this.client.post<void>(\n `/asterisk/variables?variable=${encodeURIComponent(variableName)}&value=${encodeURIComponent(value)}`,\n );\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n AddChannelRequest,\n Bridge,\n BridgePlayback,\n CreateBridgeRequest,\n PlayMediaRequest,\n RemoveChannelRequest,\n} from \"../interfaces/bridges.types.js\";\n\nexport class Bridges {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all active bridges.\n */\n async list(): Promise<Bridge[]> {\n return this.client.get<Bridge[]>(\"/bridges\");\n }\n\n /**\n * Creates a new bridge.\n */\n async createBridge(request: CreateBridgeRequest): Promise<Bridge> {\n return this.client.post<Bridge>(\"/bridges\", request);\n }\n\n /**\n * Retrieves details of a specific bridge.\n */\n async getDetails(bridgeId: string): Promise<Bridge> {\n return this.client.get<Bridge>(`/bridges/${bridgeId}`);\n }\n\n /**\n * Destroys (deletes) a specific bridge.\n */\n async destroy(bridgeId: string): Promise<void> {\n return this.client.delete<void>(`/bridges/${bridgeId}`);\n }\n\n /**\n * Adds a channel or multiple channels to a bridge.\n */\n async addChannels(\n bridgeId: string,\n request: AddChannelRequest,\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n channel: Array.isArray(request.channel)\n ? request.channel.join(\",\")\n : request.channel,\n ...(request.role && { role: request.role }),\n }).toString();\n\n await this.client.post<void>(\n `/bridges/${bridgeId}/addChannel?${queryParams}`,\n );\n }\n\n /**\n * Removes a channel or multiple channels from a bridge.\n */\n async removeChannels(\n bridgeId: string,\n request: RemoveChannelRequest,\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n channel: Array.isArray(request.channel)\n ? request.channel.join(\",\")\n : request.channel,\n }).toString();\n\n await this.client.post<void>(\n `/bridges/${bridgeId}/removeChannel?${queryParams}`,\n );\n }\n\n /**\n * Plays media to a bridge.\n */\n async playMedia(\n bridgeId: string,\n request: PlayMediaRequest,\n ): Promise<BridgePlayback> {\n const queryParams = new URLSearchParams({\n ...(request.lang && { lang: request.lang }),\n ...(request.offsetms && { offsetms: request.offsetms.toString() }),\n ...(request.skipms && { skipms: request.skipms.toString() }),\n ...(request.playbackId && { playbackId: request.playbackId }),\n }).toString();\n\n return this.client.post<BridgePlayback>(\n `/bridges/${bridgeId}/play?${queryParams}`,\n { media: request.media },\n );\n }\n\n /**\n * Stops media playback on a bridge.\n */\n async stopPlayback(bridgeId: string, playbackId: string): Promise<void> {\n await this.client.delete<void>(`/bridges/${bridgeId}/play/${playbackId}`);\n }\n\n /**\n * Sets the video source for a bridge.\n */\n async setVideoSource(bridgeId: string, channelId: string): Promise<void> {\n await this.client.post<void>(\n `/bridges/${bridgeId}/videoSource?channelId=${encodeURIComponent(channelId)}`,\n );\n }\n\n /**\n * Clears the video source for a bridge.\n */\n async clearVideoSource(bridgeId: string): Promise<void> {\n await this.client.delete<void>(`/bridges/${bridgeId}/videoSource`);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Channel,\n ChannelPlayback,\n ChannelVar,\n ExternalMediaOptions,\n OriginateRequest,\n PlaybackOptions,\n RTPStats,\n RecordingOptions,\n SnoopOptions,\n} from \"../interfaces/channels.types.js\";\n\nfunction toQueryParams<T>(options: T): string {\n return new URLSearchParams(\n Object.entries(options as Record<string, string>) // Convers\u00E3o expl\u00EDcita\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, value as string]), // Garante que value \u00E9 string\n ).toString();\n}\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all active channels.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Creates a channel and places it in a Stasis app without dialing it.\n */\n async createChannel(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels/create\", data);\n }\n\n /**\n * Creates a new channel with a specific ID and originates a call.\n */\n async originateWithId(\n channelId: string,\n data: OriginateRequest,\n ): Promise<Channel> {\n return this.client.post<Channel>(`/channels/${channelId}`, data);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n */\n /**\n * Hangs up a specific channel with optional reason or reason code.\n */\n async hangup(\n channelId: string,\n options?: { reason_code?: string; reason?: string },\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n ...(options?.reason_code && { reason_code: options.reason_code }),\n ...(options?.reason && { reason: options.reason }),\n });\n\n return this.client.delete<void>(\n `/channels/${channelId}?${queryParams.toString()}`,\n );\n }\n\n /**\n * Continues the dialplan for a specific channel.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n\n /**\n * Sets a channel variable.\n */\n async setVariable(\n channelId: string,\n variable: string,\n value: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/variable`, {\n variable,\n value,\n });\n }\n\n /**\n * Gets a channel variable.\n */\n async getVariable(channelId: string, variable: string): Promise<ChannelVar> {\n return this.client.get<ChannelVar>(\n `/channels/${channelId}/variable?variable=${encodeURIComponent(variable)}`,\n );\n }\n\n /**\n * Plays a media file to a channel.\n */\n async playMedia(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n const queryParams = options\n ? `?${new URLSearchParams(options as Record<string, string>).toString()}`\n : \"\";\n\n return this.client.post<ChannelPlayback>(\n `/channels/${channelId}/play${queryParams}`,\n { media },\n );\n }\n\n /**\n * Starts music on hold (MOH) for a channel.\n */\n async startMusicOnHold(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/moh`);\n }\n\n /**\n * Stops music on hold (MOH) for a channel.\n */\n async stopMusicOnHold(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/moh`);\n }\n\n /**\n * Starts playback of a media file on a channel.\n */\n async startPlayback(\n channelId: string,\n media: string,\n options?: PlaybackOptions,\n ): Promise<ChannelPlayback> {\n const queryParams = options\n ? `?${new URLSearchParams(options as Record<string, string>).toString()}`\n : \"\";\n\n return this.client.post<ChannelPlayback>(\n `/channels/${channelId}/play${queryParams}`,\n { media },\n );\n }\n\n /**\n * Stops playback of a media file on a channel.\n */\n async stopPlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/play/${playbackId}`,\n );\n }\n\n /**\n * Pauses playback of a media file on a channel.\n */\n async pausePlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/pause`,\n );\n }\n\n /**\n * Resumes playback of a media file on a channel.\n */\n async resumePlayback(channelId: string, playbackId: string): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/play/${playbackId}/pause`,\n );\n }\n\n /**\n * Rewinds playback of a media file on a channel.\n */\n async rewindPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/rewind`,\n { skipMs },\n );\n }\n\n /**\n * Fast-forwards playback of a media file on a channel.\n */\n async fastForwardPlayback(\n channelId: string,\n playbackId: string,\n skipMs: number,\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/play/${playbackId}/forward`,\n { skipMs },\n );\n }\n\n /**\n * Records audio from a channel.\n */\n async record(channelId: string, options: RecordingOptions): Promise<Channel> {\n // Converte RecordingOptions para URLSearchParams, garantindo compatibilidade\n const queryParams = new URLSearchParams(\n Object.entries(options as unknown as Record<string, string>).filter(\n ([, value]) => value !== undefined,\n ),\n );\n\n return this.client.post<Channel>(\n `/channels/${channelId}/record?${queryParams.toString()}`,\n );\n }\n\n /**\n * Starts snooping on a channel.\n */\n async snoopChannel(\n channelId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n const queryParams = toQueryParams(options);\n\n return this.client.post<Channel>(\n `/channels/${channelId}/snoop?${queryParams}`,\n );\n }\n\n /**\n * Starts snooping on a channel with a specific snoop ID.\n */\n async snoopChannelWithId(\n channelId: string,\n snoopId: string,\n options: SnoopOptions,\n ): Promise<Channel> {\n const queryParams = new URLSearchParams(options as Record<string, string>);\n return this.client.post<Channel>(\n `/channels/${channelId}/snoop/${snoopId}?${queryParams.toString()}`,\n );\n }\n\n /**\n * Dials a created channel.\n */\n async dial(\n channelId: string,\n caller?: string,\n timeout?: number,\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n ...(caller && { caller }),\n ...(timeout && { timeout: timeout.toString() }),\n });\n return this.client.post<void>(\n `/channels/${channelId}/dial?${queryParams.toString()}`,\n );\n }\n\n /**\n * Retrieves RTP statistics for a channel.\n */\n async getRTPStatistics(channelId: string): Promise<RTPStats> {\n return this.client.get<RTPStats>(`/channels/${channelId}/rtp_statistics`);\n }\n\n /**\n * Creates a channel to an external media source/sink.\n */\n async createExternalMedia(options: ExternalMediaOptions): Promise<Channel> {\n const queryParams = new URLSearchParams(options as Record<string, string>);\n return this.client.post<Channel>(\n `/channels/externalMedia?${queryParams.toString()}`,\n );\n }\n\n /**\n * Redirects the channel to a different location.\n */\n async redirectChannel(channelId: string, endpoint: string): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/redirect?endpoint=${encodeURIComponent(endpoint)}`,\n );\n }\n\n /**\n * Answers a channel.\n */\n async answerChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/answer`);\n }\n\n /**\n * Sends a ringing indication to a channel.\n */\n async ringChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/ring`);\n }\n\n /**\n * Stops ringing indication on a channel.\n */\n async stopRingChannel(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/ring`);\n }\n\n /**\n * Sends DTMF to a channel.\n */\n async sendDTMF(\n channelId: string,\n dtmf: string,\n options?: {\n before?: number;\n between?: number;\n duration?: number;\n after?: number;\n },\n ): Promise<void> {\n const queryParams = new URLSearchParams({\n dtmf,\n ...(options?.before && { before: options.before.toString() }),\n ...(options?.between && { between: options.between.toString() }),\n ...(options?.duration && { duration: options.duration.toString() }),\n ...(options?.after && { after: options.after.toString() }),\n });\n\n return this.client.post<void>(\n `/channels/${channelId}/dtmf?${queryParams.toString()}`,\n );\n }\n\n /**\n * Mutes a channel.\n */\n async muteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.client.post<void>(\n `/channels/${channelId}/mute?direction=${direction}`,\n );\n }\n\n /**\n * Unmutes a channel.\n */\n async unmuteChannel(\n channelId: string,\n direction: \"both\" | \"in\" | \"out\" = \"both\",\n ): Promise<void> {\n return this.client.delete<void>(\n `/channels/${channelId}/mute?direction=${direction}`,\n );\n }\n\n /**\n * Puts a channel on hold.\n */\n async holdChannel(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hold`);\n }\n\n /**\n * Removes a channel from hold.\n */\n async unholdChannel(channelId: string): Promise<void> {\n return this.client.delete<void>(`/channels/${channelId}/hold`);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Endpoint, EndpointDetails } from \"../interfaces/endpoints.types\";\n\nexport class Endpoints {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available endpoints.\n *\n * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Endpoint[]> {\n const endpoints = await this.client.get<unknown>(\"/endpoints\");\n\n if (!Array.isArray(endpoints)) {\n throw new Error(\"Resposta da API /endpoints n\u00E3o \u00E9 um array.\");\n }\n\n return endpoints as Endpoint[];\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.\n */\n async getDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.client.get<EndpointDetails>(\n `/endpoints/${technology}/${resource}`,\n );\n }\n\n /**\n * Sends a message to a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @param message - The message payload to send to the endpoint.\n * @returns A promise that resolves when the message has been successfully sent.\n */\n async sendMessage(\n technology: string,\n resource: string,\n message: Record<string, unknown>,\n ): Promise<void> {\n await this.client.post<void>(\n `/endpoints/${technology}/${resource}/sendMessage`,\n message,\n );\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Playback, PlaybackControlRequest } from \"../interfaces\";\n\nexport class Playbacks {\n constructor(private client: BaseClient) {}\n\n /**\n * Retrieves details of a specific playback.\n *\n * @param playbackId - The unique identifier of the playback.\n * @returns A promise that resolves to a Playback object containing the details of the specified playback.\n */\n async getDetails(playbackId: string): Promise<Playback> {\n return this.client.get<Playback>(`/playbacks/${playbackId}`);\n }\n\n /**\n * Controls a specific playback by performing various operations such as pause, resume, restart, reverse, forward, or stop.\n *\n * @param playbackId - The unique identifier of the playback to control.\n * @param operation - The operation to perform on the playback. Possible values are:\n * - \"pause\": Pauses the playback.\n * - \"unpause\": Resumes a paused playback.\n * - \"restart\": Restarts the playback from the beginning.\n * - \"reverse\": Reverses the playback direction.\n * - \"forward\": Moves the playback forward.\n * - \"stop\": Stops the playback.\n * @returns A promise that resolves when the control operation is successfully executed.\n */\n async control(\n playbackId: string,\n operation: \"pause\" | \"unpause\" | \"restart\" | \"reverse\" | \"forward\" | \"stop\",\n ): Promise<void> {\n await this.client.post<void>(`/playbacks/${playbackId}/control`, {\n operation,\n });\n }\n\n /**\n * Stops a specific playback.\n *\n * @param playbackId - The unique identifier of the playback to stop.\n * @returns A promise that resolves when the playback is successfully stopped.\n */\n async stop(playbackId: string): Promise<void> {\n await this.client.post<void>(`/playbacks/${playbackId}/stop`);\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Sound, SoundListRequest } from \"../interfaces/sounds.types.js\";\n\nexport class Sounds {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available sounds.\n *\n * @param params - Optional parameters to filter the list of sounds.\n * @returns A promise that resolves to an array of Sound objects.\n * @throws {Error} If the API response is not an array.\n */\n async list(params?: SoundListRequest): Promise<Sound[]> {\n const query = params\n ? `?${new URLSearchParams(params as Record<string, string>).toString()}`\n : \"\";\n\n const sounds = await this.client.get<unknown>(`/sounds${query}`);\n\n if (!Array.isArray(sounds)) {\n throw new Error(\"Resposta da API /sounds n\u00E3o \u00E9 um array.\");\n }\n\n return sounds as Sound[];\n }\n\n /**\n * Retrieves details of a specific sound.\n *\n * @param soundId - The unique identifier of the sound.\n * @returns A promise that resolves to a Sound object containing the details of the specified sound.\n */\n async getDetails(soundId: string): Promise<Sound> {\n return this.client.get<Sound>(`/sounds/${soundId}`);\n }\n}\n", "import WebSocket from \"ws\";\nimport type { WebSocketEvent } from \"./interfaces\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on<T extends WebSocketEvent[\"type\"]>(\n event: \"message\" | \"open\" | \"error\" | \"close\",\n callback: (data: Extract<WebSocketEvent, { type: T }>) => void,\n ): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n if (event === \"message\") {\n this.ws.on(event, (rawData) => {\n try {\n const decodedData = JSON.parse(rawData.toString());\n if (decodedData?.type) {\n const matchedEvent = decodedData as WebSocketEvent;\n callback(matchedEvent as Extract<WebSocketEvent, { type: T }>);\n } else {\n console.warn(\"Mensagem sem tipo:\", decodedData);\n }\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n }\n });\n } else {\n this.ws.on(event, callback as (data: any) => void);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log(\"WebSocket fechado manualmente.\");\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,QAAM,iBAAkC;MACtC,mBAAmB;MACnB,QAAQ;MACR,UAAU;MACV,eAAe;MACf,OAAO,WAAA;AAAM,eAAA;MAAA;MACb,eAAe;MACf,cAAc;;AAGhB,aAAgB,oBAAoB,SAAuB;AACzD,UAAM,Y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AAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,sBAA0C;AAC9C,WAAO,KAAK,SAAS,oBAAoB;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,iBACJ,gBACA,QACA,eACe;AACf,WAAO,KAAK,SAAS;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,kBAAkB,cAAyC;AAC/D,WAAO,KAAK,SAAS,kBAAkB,YAAY;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBA,MAAM,kBAAkB,cAAsB,OAA8B;AAC1E,WAAO,KAAK,SAAS,kBAAkB,cAAc,KAAK;AAAA,EAC5D;AACF;",
6
6
  "names": ["exports", "exports", "exports", "exports", "Delay", "exports", "SkipFirstDelay", "exports", "AlwaysDelay", "exports", "exports", "backOff", "exports", "BackOff", "axios", "toQueryParams", "WebSocket"]
7
7
  }