@ipcom/asterisk-ari 0.0.5 → 0.0.7

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.
@@ -162,94 +162,81 @@ var WebSocketClient = class {
162
162
 
163
163
  // src/ari-client/ariClient.ts
164
164
  var AriClient = class {
165
- // Adicionado
166
165
  /**
167
166
  * Initializes a new instance of the AriClient class.
168
- *
167
+ *
169
168
  * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,
170
- * including WebSocket and HTTP connections. It also initializes the channels resource.
171
- *
169
+ * including HTTP connections. WebSocket connections are handled dynamically per application.
170
+ *
172
171
  * @param config - The configuration object for the ARI client.
173
- * @param config.host - The hostname or IP address of the Asterisk server.
174
- * @param config.port - The port number on which the Asterisk ARI is listening.
175
- * @param config.username - The username for authentication with the Asterisk ARI.
176
- * @param config.password - The password for authentication with the Asterisk ARI.
177
- * @param config.secure - Optional. If true, uses secure protocols (WSS/HTTPS). Defaults to false.
178
172
  */
179
173
  constructor(config) {
180
174
  this.config = config;
181
- const protocol = config.secure ? "wss" : "ws";
182
175
  const httpProtocol = config.secure ? "https" : "http";
183
- const encodedUsername = encodeURIComponent(config.username);
184
- const encodedPassword = encodeURIComponent(config.password);
185
176
  const normalizedHost = config.host.replace(/^https?:\/\//, "");
186
- const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;
187
177
  const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
188
- console.log({ wsUrl, baseUrl });
189
- this.wsClient = new WebSocketClient(wsUrl);
190
178
  this.baseClient = new BaseClient(baseUrl, config.username, config.password);
191
179
  this.channels = new Channels(this.baseClient);
192
180
  }
193
- wsClient;
181
+ wsClient = null;
194
182
  baseClient;
195
183
  channels;
196
184
  /**
197
- * Conecta ao WebSocket do ARI.
198
- * @returns {Promise<void>} Retorna uma promise resolvida ao conectar com sucesso.
185
+ * Connects to the ARI WebSocket for a specific application.
186
+ *
187
+ * @param app - The application name to connect to.
188
+ * @returns {Promise<void>} Resolves when the WebSocket connects successfully.
199
189
  */
200
- async connectWebSocket() {
190
+ async connectWebSocket(app) {
191
+ if (!app) {
192
+ throw new Error(
193
+ "The 'app' parameter is required to connect to the WebSocket."
194
+ );
195
+ }
196
+ const protocol = this.config.secure ? "wss" : "ws";
197
+ const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${this.config.host}:${this.config.port}/ari/events?app=${app}`;
198
+ this.wsClient = new WebSocketClient(wsUrl);
201
199
  try {
202
200
  await this.wsClient.connect();
203
- console.log("WebSocket conectado com sucesso!");
201
+ console.log(`WebSocket connected for app: ${app}`);
204
202
  } catch (err) {
205
- console.error("Erro ao conectar ao WebSocket:", err);
203
+ console.error("Error connecting to WebSocket:", err);
206
204
  throw err;
207
205
  }
208
206
  }
209
207
  /**
210
- * Checks if the WebSocket connection is currently active.
211
- *
212
- * This method provides a way to determine the current state of the WebSocket connection
213
- * to the Asterisk ARI server.
208
+ * Checks if the WebSocket connection is active.
214
209
  *
215
- * @returns {boolean} Returns true if the WebSocket is connected, false otherwise.
210
+ * @returns {boolean} True if connected, false otherwise.
216
211
  */
217
212
  isWebSocketConnected() {
218
- return this.wsClient.isConnected();
213
+ return this.wsClient ? this.wsClient.isConnected() : false;
219
214
  }
220
215
  /**
221
- * Registers a callback function for a specific WebSocket event.
216
+ * Registers a callback for a specific WebSocket event.
222
217
  *
223
- * This method allows you to attach event listeners to WebSocket events
224
- * from the Asterisk ARI server. When the specified event occurs, the
225
- * provided callback function will be executed.
226
- *
227
- * @param event - The name of the WebSocket event to listen for.
228
- * @param callback - The function to be called when the event occurs.
229
- * It receives the event data as its parameter.
230
- * @returns void
218
+ * @param event - The WebSocket event to listen for.
219
+ * @param callback - The callback function to execute when the event occurs.
231
220
  */
232
221
  onWebSocketEvent(event, callback) {
222
+ if (!this.wsClient) {
223
+ throw new Error("WebSocket is not connected.");
224
+ }
233
225
  this.wsClient.on(event, callback);
234
226
  }
235
227
  /**
236
- * Closes the WebSocket connection to the Asterisk ARI server.
237
- *
238
- * This method terminates the existing WebSocket connection, if one is active.
239
- * It's useful for cleaning up resources when the connection is no longer needed.
228
+ * Closes the WebSocket connection.
240
229
  */
241
230
  closeWebSocket() {
242
- this.wsClient.close();
231
+ if (this.wsClient) {
232
+ this.wsClient.close();
233
+ this.wsClient = null;
234
+ }
243
235
  }
244
236
  /**
245
- * Retrieves a list of all active channels from the Asterisk ARI server.
246
- *
247
- * This method makes an asynchronous GET request to the '/channels' endpoint
248
- * of the Asterisk ARI.
237
+ * Retrieves a list of active channels from the Asterisk ARI.
249
238
  *
250
- * @returns {Promise<any>} A promise that resolves with the list of active channels.
251
- * The exact structure of the returned data depends on the
252
- * Asterisk ARI specification.
239
+ * @returns {Promise<any>} A promise resolving to the list of active channels.
253
240
  */
254
241
  async listChannels() {
255
242
  return this.baseClient.get("/channels");
@@ -257,15 +244,8 @@ var AriClient = class {
257
244
  /**
258
245
  * Initiates a new channel on the Asterisk server.
259
246
  *
260
- * This method makes an asynchronous POST request to the '/channels' endpoint
261
- * of the Asterisk ARI to create a new channel with the specified parameters.
262
- *
263
- * @param {any} data - An object containing the parameters for the new channel.
264
- * The structure of this object should conform to the
265
- * Asterisk ARI specification for channel origination.
266
- * @returns {Promise<any>} A promise that resolves with the response from the
267
- * Asterisk server, typically containing details of
268
- * the newly created channel.
247
+ * @param data - The parameters for creating the new channel.
248
+ * @returns {Promise<any>} A promise resolving to the new channel's details.
269
249
  */
270
250
  async originateChannel(data) {
271
251
  return this.baseClient.post("/channels", data);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/websocketClient.ts", "../../src/ari-client/ariClient.ts"],
4
- "sourcesContent": ["// Exporta a classe principal AriClient\nexport { AriClient } from \"./ari-client/ariClient\";\n\n// Exporta as classes dos recursos, caso o usu\u00E1rio precise us\u00E1-las diretamente\nexport { Channels } from \"./ari-client/resources/channels\";\n\n// Exporta interfaces importantes para tipagem\nexport type { AriClientConfig } from \"./ari-client/ariClient\";\nexport type { Channel } from \"./ari-client/interfaces/channels.types\";\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 async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\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", "import type { BaseClient } from \"../baseClient\";\nimport type { Channel, OriginateRequest } from \"../interfaces/channels.types\";\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n // Lista todos os canais ativos\n async list(): Promise<Channel[]> {\n return this.client.get<Channel[]>(\"/channels\");\n }\n\n // Cria um novo canal\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n // Obt\u00E9m detalhes de um canal espec\u00EDfico\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n // Desliga (hangup) um canal\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n // Continua no dialplan\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 // Move o canal para outra aplica\u00E7\u00E3o Stasis\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", "import WebSocket from \"ws\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n\n constructor(private url: string) {}\n\n async connect(retryInterval = 1000): Promise<void> {\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 resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n });\n });\n }\n\n private reconnect(retryInterval: number): void {\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.connect(retryInterval).catch((err) => {\n console.error(\"Erro ao tentar reconectar:\", err);\n });\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(event: string, callback: (data: any) => void): 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.on(event, callback);\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", "import { BaseClient } from \"./baseClient.js\";\nimport { Channels } from \"./resources/channels\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport interface AriClientConfig {\n host: string;\n port: number;\n username: string;\n password: string;\n secure?: boolean;\n}\n\nexport class AriClient {\n private wsClient: WebSocketClient;\n private readonly baseClient: BaseClient;\n\n public channels: Channels; // Adicionado\n\n /**\n * Initializes a new instance of the AriClient class.\n * \n * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,\n * including WebSocket and HTTP connections. It also initializes the channels resource.\n * \n * @param config - The configuration object for the ARI client.\n * @param config.host - The hostname or IP address of the Asterisk server.\n * @param config.port - The port number on which the Asterisk ARI is listening.\n * @param config.username - The username for authentication with the Asterisk ARI.\n * @param config.password - The password for authentication with the Asterisk ARI.\n * @param config.secure - Optional. If true, uses secure protocols (WSS/HTTPS). Defaults to false.\n */\n constructor(private config: AriClientConfig) {\n // Determina o protocolo com base na seguran\u00E7a\n const protocol = config.secure ? \"wss\" : \"ws\";\n const httpProtocol = config.secure ? \"https\" : \"http\";\n \n // Codifica credenciais para uso seguro no URL\n const encodedUsername = encodeURIComponent(config.username);\n const encodedPassword = encodeURIComponent(config.password);\n \n // Remove o protocolo do host, caso esteja presente\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n \n // Constr\u00F3i os URLs\n const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n \n console.log({ wsUrl, baseUrl });\n \n // Inicializa os clientes WebSocket e HTTP\n this.wsClient = new WebSocketClient(wsUrl);\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n \n // Inicializa os recursos do cliente\n this.channels = new Channels(this.baseClient);\n }\n\n /**\n * Conecta ao WebSocket do ARI.\n * @returns {Promise<void>} Retorna uma promise resolvida ao conectar com sucesso.\n */\n async connectWebSocket(): Promise<void> {\n try {\n await this.wsClient.connect();\n console.log(\"WebSocket conectado com sucesso!\");\n } catch (err) {\n console.error(\"Erro ao conectar ao WebSocket:\", err);\n throw err;\n }\n }\n\n /**\n * Checks if the WebSocket connection is currently active.\n *\n * This method provides a way to determine the current state of the WebSocket connection\n * to the Asterisk ARI server.\n *\n * @returns {boolean} Returns true if the WebSocket is connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient.isConnected();\n }\n\n /**\n * Registers a callback function for a specific WebSocket event.\n *\n * This method allows you to attach event listeners to WebSocket events\n * from the Asterisk ARI server. When the specified event occurs, the\n * provided callback function will be executed.\n *\n * @param event - The name of the WebSocket event to listen for.\n * @param callback - The function to be called when the event occurs.\n * It receives the event data as its parameter.\n * @returns void\n */\n onWebSocketEvent(event: string, callback: (data: any) => void): void {\n this.wsClient.on(event, callback);\n }\n\n /**\n * Closes the WebSocket connection to the Asterisk ARI server.\n *\n * This method terminates the existing WebSocket connection, if one is active.\n * It's useful for cleaning up resources when the connection is no longer needed.\n */\n closeWebSocket(): void {\n this.wsClient.close();\n }\n\n /**\n * Retrieves a list of all active channels from the Asterisk ARI server.\n *\n * This method makes an asynchronous GET request to the '/channels' endpoint\n * of the Asterisk ARI.\n *\n * @returns {Promise<any>} A promise that resolves with the list of active channels.\n * The exact structure of the returned data depends on the\n * Asterisk ARI specification.\n */\n async listChannels() {\n return this.baseClient.get(\"/channels\");\n }\n\n /**\n * Initiates a new channel on the Asterisk server.\n *\n * This method makes an asynchronous POST request to the '/channels' endpoint\n * of the Asterisk ARI to create a new channel with the specified parameters.\n *\n * @param {any} data - An object containing the parameters for the new channel.\n * The structure of this object should conform to the\n * Asterisk ARI specification for channel origination.\n * @returns {Promise<any>} A promise that resolves with the response from the\n * Asterisk server, typically containing details of\n * the newly created channel.\n */\n async originateChannel(data: any) {\n return this.baseClient.post(\"/channels\", data);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0C;AAEnC,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,SAAiB,UAAkB,UAAkB;AAC/D,SAAK,SAAS,aAAAA,QAAM,OAAO;AAAA,MACzB,SAAS;AAAA,MACT,MAAM,EAAE,UAAU,SAAS;AAAA,IAC7B,CAAC;AAAA,E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A;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,uBAAgC;AAC9B,WAAO,KAAK,SAAS,YAAY;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,iBAAiB,OAAe,UAAqC;AACnE,SAAK,SAAS,GAAG,OAAO,QAAQ;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAuB;AACrB,SAAK,SAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,eAAe;AACnB,WAAO,KAAK,WAAW,IAAI,WAAW;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAM,iBAAiB,MAAW;AAChC,WAAO,KAAK,WAAW,KAAK,aAAa,IAAI;AAAA,EAC/C;AACF;",
4
+ "sourcesContent": ["// 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\";\n\n// Exporta interfaces importantes para tipagem\nexport type { AriClientConfig } from \"./ari-client/interfaces/requests.js\";\nexport type { Channel } from \"./ari-client/interfaces/channels.types.js\";\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 async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\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", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Channel,\n OriginateRequest,\n} from \"../interfaces/channels.types.js\";\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n // Lista todos os canais ativos\n async list(): Promise<Channel[]> {\n return this.client.get<Channel[]>(\"/channels\");\n }\n\n // Cria um novo canal\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n // Obt\u00E9m detalhes de um canal espec\u00EDfico\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n // Desliga (hangup) um canal\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n // Continua no dialplan\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 // Move o canal para outra aplica\u00E7\u00E3o Stasis\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", "import WebSocket from \"ws\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n\n constructor(private url: string) {}\n\n async connect(retryInterval = 1000): Promise<void> {\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 resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n });\n });\n }\n\n private reconnect(retryInterval: number): void {\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.connect(retryInterval).catch((err) => {\n console.error(\"Erro ao tentar reconectar:\", err);\n });\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(event: string, callback: (data: any) => void): 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.on(event, callback);\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", "import { BaseClient } from \"./baseClient.js\";\nimport type { AriClientConfig } from \"./interfaces/requests.js\";\nimport { Channels } from \"./resources/channels.js\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n\n public channels: Channels;\n\n /**\n * Initializes a new instance of the AriClient class.\n *\n * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,\n * including HTTP connections. WebSocket connections are handled dynamically per application.\n *\n * @param config - The configuration object for the ARI client.\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 }\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(app: string): Promise<void> {\n if (!app) {\n throw new Error(\n \"The 'app' parameter is required to connect to the WebSocket.\",\n );\n }\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}`;\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await this.wsClient.connect();\n console.log(`WebSocket connected for app: ${app}`);\n } catch (err) {\n console.error(\"Error connecting to WebSocket:\", err);\n throw err;\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 for a specific WebSocket event.\n *\n * @param event - The WebSocket event to listen for.\n * @param callback - The callback function to execute when the event occurs.\n */\n onWebSocketEvent(event: string, callback: (data: any) => void): void {\n if (!this.wsClient) {\n throw new Error(\"WebSocket is not connected.\");\n }\n this.wsClient.on(event, 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 /**\n * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<any>} A promise resolving to the list of active channels.\n */\n async listChannels() {\n return this.baseClient.get(\"/channels\");\n }\n\n /**\n * Initiates a new channel on the Asterisk server.\n *\n * @param data - The parameters for creating the new channel.\n * @returns {Promise<any>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: any) {\n return this.baseClient.post(\"/channels\", data);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0C;AAEnC,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,SAAiB,UAAkB,UAAkB;AAC/D,SAAK,SAAS,aAAAA,QAAM,OAAO;AAAA,MACzB,SAAS;AAAA,MACT,MAAM,EAAE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Q,MAAM,kCAAkC,GAAG;AACnD,YAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,uBAAgC;AAC9B,WAAO,KAAK,WAAW,KAAK,SAAS,YAAY,IAAI;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,OAAe,UAAqC;AACnE,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AACA,SAAK,SAAS,GAAG,OAAO,QAAQ;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAuB;AACrB,QAAI,KAAK,UAAU;AACjB,WAAK,SAAS,MAAM;AACpB,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe;AACnB,WAAO,KAAK,WAAW,IAAI,WAAW;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,MAAW;AAChC,WAAO,KAAK,WAAW,KAAK,aAAa,IAAI;AAAA,EAC/C;AACF;",
6
6
  "names": ["axios", "WebSocket"]
7
7
  }
package/dist/esm/index.js CHANGED
@@ -125,94 +125,81 @@ var WebSocketClient = class {
125
125
 
126
126
  // src/ari-client/ariClient.ts
127
127
  var AriClient = class {
128
- // Adicionado
129
128
  /**
130
129
  * Initializes a new instance of the AriClient class.
131
- *
130
+ *
132
131
  * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,
133
- * including WebSocket and HTTP connections. It also initializes the channels resource.
134
- *
132
+ * including HTTP connections. WebSocket connections are handled dynamically per application.
133
+ *
135
134
  * @param config - The configuration object for the ARI client.
136
- * @param config.host - The hostname or IP address of the Asterisk server.
137
- * @param config.port - The port number on which the Asterisk ARI is listening.
138
- * @param config.username - The username for authentication with the Asterisk ARI.
139
- * @param config.password - The password for authentication with the Asterisk ARI.
140
- * @param config.secure - Optional. If true, uses secure protocols (WSS/HTTPS). Defaults to false.
141
135
  */
142
136
  constructor(config) {
143
137
  this.config = config;
144
- const protocol = config.secure ? "wss" : "ws";
145
138
  const httpProtocol = config.secure ? "https" : "http";
146
- const encodedUsername = encodeURIComponent(config.username);
147
- const encodedPassword = encodeURIComponent(config.password);
148
139
  const normalizedHost = config.host.replace(/^https?:\/\//, "");
149
- const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;
150
140
  const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
151
- console.log({ wsUrl, baseUrl });
152
- this.wsClient = new WebSocketClient(wsUrl);
153
141
  this.baseClient = new BaseClient(baseUrl, config.username, config.password);
154
142
  this.channels = new Channels(this.baseClient);
155
143
  }
156
- wsClient;
144
+ wsClient = null;
157
145
  baseClient;
158
146
  channels;
159
147
  /**
160
- * Conecta ao WebSocket do ARI.
161
- * @returns {Promise<void>} Retorna uma promise resolvida ao conectar com sucesso.
148
+ * Connects to the ARI WebSocket for a specific application.
149
+ *
150
+ * @param app - The application name to connect to.
151
+ * @returns {Promise<void>} Resolves when the WebSocket connects successfully.
162
152
  */
163
- async connectWebSocket() {
153
+ async connectWebSocket(app) {
154
+ if (!app) {
155
+ throw new Error(
156
+ "The 'app' parameter is required to connect to the WebSocket."
157
+ );
158
+ }
159
+ const protocol = this.config.secure ? "wss" : "ws";
160
+ const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${this.config.host}:${this.config.port}/ari/events?app=${app}`;
161
+ this.wsClient = new WebSocketClient(wsUrl);
164
162
  try {
165
163
  await this.wsClient.connect();
166
- console.log("WebSocket conectado com sucesso!");
164
+ console.log(`WebSocket connected for app: ${app}`);
167
165
  } catch (err) {
168
- console.error("Erro ao conectar ao WebSocket:", err);
166
+ console.error("Error connecting to WebSocket:", err);
169
167
  throw err;
170
168
  }
171
169
  }
172
170
  /**
173
- * Checks if the WebSocket connection is currently active.
174
- *
175
- * This method provides a way to determine the current state of the WebSocket connection
176
- * to the Asterisk ARI server.
171
+ * Checks if the WebSocket connection is active.
177
172
  *
178
- * @returns {boolean} Returns true if the WebSocket is connected, false otherwise.
173
+ * @returns {boolean} True if connected, false otherwise.
179
174
  */
180
175
  isWebSocketConnected() {
181
- return this.wsClient.isConnected();
176
+ return this.wsClient ? this.wsClient.isConnected() : false;
182
177
  }
183
178
  /**
184
- * Registers a callback function for a specific WebSocket event.
179
+ * Registers a callback for a specific WebSocket event.
185
180
  *
186
- * This method allows you to attach event listeners to WebSocket events
187
- * from the Asterisk ARI server. When the specified event occurs, the
188
- * provided callback function will be executed.
189
- *
190
- * @param event - The name of the WebSocket event to listen for.
191
- * @param callback - The function to be called when the event occurs.
192
- * It receives the event data as its parameter.
193
- * @returns void
181
+ * @param event - The WebSocket event to listen for.
182
+ * @param callback - The callback function to execute when the event occurs.
194
183
  */
195
184
  onWebSocketEvent(event, callback) {
185
+ if (!this.wsClient) {
186
+ throw new Error("WebSocket is not connected.");
187
+ }
196
188
  this.wsClient.on(event, callback);
197
189
  }
198
190
  /**
199
- * Closes the WebSocket connection to the Asterisk ARI server.
200
- *
201
- * This method terminates the existing WebSocket connection, if one is active.
202
- * It's useful for cleaning up resources when the connection is no longer needed.
191
+ * Closes the WebSocket connection.
203
192
  */
204
193
  closeWebSocket() {
205
- this.wsClient.close();
194
+ if (this.wsClient) {
195
+ this.wsClient.close();
196
+ this.wsClient = null;
197
+ }
206
198
  }
207
199
  /**
208
- * Retrieves a list of all active channels from the Asterisk ARI server.
209
- *
210
- * This method makes an asynchronous GET request to the '/channels' endpoint
211
- * of the Asterisk ARI.
200
+ * Retrieves a list of active channels from the Asterisk ARI.
212
201
  *
213
- * @returns {Promise<any>} A promise that resolves with the list of active channels.
214
- * The exact structure of the returned data depends on the
215
- * Asterisk ARI specification.
202
+ * @returns {Promise<any>} A promise resolving to the list of active channels.
216
203
  */
217
204
  async listChannels() {
218
205
  return this.baseClient.get("/channels");
@@ -220,15 +207,8 @@ var AriClient = class {
220
207
  /**
221
208
  * Initiates a new channel on the Asterisk server.
222
209
  *
223
- * This method makes an asynchronous POST request to the '/channels' endpoint
224
- * of the Asterisk ARI to create a new channel with the specified parameters.
225
- *
226
- * @param {any} data - An object containing the parameters for the new channel.
227
- * The structure of this object should conform to the
228
- * Asterisk ARI specification for channel origination.
229
- * @returns {Promise<any>} A promise that resolves with the response from the
230
- * Asterisk server, typically containing details of
231
- * the newly created channel.
210
+ * @param data - The parameters for creating the new channel.
211
+ * @returns {Promise<any>} A promise resolving to the new channel's details.
232
212
  */
233
213
  async originateChannel(data) {
234
214
  return this.baseClient.post("/channels", data);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/websocketClient.ts", "../../src/ari-client/ariClient.ts"],
4
- "sourcesContent": ["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 async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\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", "import type { BaseClient } from \"../baseClient\";\nimport type { Channel, OriginateRequest } from \"../interfaces/channels.types\";\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n // Lista todos os canais ativos\n async list(): Promise<Channel[]> {\n return this.client.get<Channel[]>(\"/channels\");\n }\n\n // Cria um novo canal\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n // Obt\u00E9m detalhes de um canal espec\u00EDfico\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n // Desliga (hangup) um canal\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n // Continua no dialplan\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 // Move o canal para outra aplica\u00E7\u00E3o Stasis\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", "import WebSocket from \"ws\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n\n constructor(private url: string) {}\n\n async connect(retryInterval = 1000): Promise<void> {\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 resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n });\n });\n }\n\n private reconnect(retryInterval: number): void {\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.connect(retryInterval).catch((err) => {\n console.error(\"Erro ao tentar reconectar:\", err);\n });\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(event: string, callback: (data: any) => void): 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.on(event, callback);\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", "import { BaseClient } from \"./baseClient.js\";\nimport { Channels } from \"./resources/channels\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport interface AriClientConfig {\n host: string;\n port: number;\n username: string;\n password: string;\n secure?: boolean;\n}\n\nexport class AriClient {\n private wsClient: WebSocketClient;\n private readonly baseClient: BaseClient;\n\n public channels: Channels; // Adicionado\n\n /**\n * Initializes a new instance of the AriClient class.\n * \n * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,\n * including WebSocket and HTTP connections. It also initializes the channels resource.\n * \n * @param config - The configuration object for the ARI client.\n * @param config.host - The hostname or IP address of the Asterisk server.\n * @param config.port - The port number on which the Asterisk ARI is listening.\n * @param config.username - The username for authentication with the Asterisk ARI.\n * @param config.password - The password for authentication with the Asterisk ARI.\n * @param config.secure - Optional. If true, uses secure protocols (WSS/HTTPS). Defaults to false.\n */\n constructor(private config: AriClientConfig) {\n // Determina o protocolo com base na seguran\u00E7a\n const protocol = config.secure ? \"wss\" : \"ws\";\n const httpProtocol = config.secure ? \"https\" : \"http\";\n \n // Codifica credenciais para uso seguro no URL\n const encodedUsername = encodeURIComponent(config.username);\n const encodedPassword = encodeURIComponent(config.password);\n \n // Remove o protocolo do host, caso esteja presente\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n \n // Constr\u00F3i os URLs\n const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n \n console.log({ wsUrl, baseUrl });\n \n // Inicializa os clientes WebSocket e HTTP\n this.wsClient = new WebSocketClient(wsUrl);\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n \n // Inicializa os recursos do cliente\n this.channels = new Channels(this.baseClient);\n }\n\n /**\n * Conecta ao WebSocket do ARI.\n * @returns {Promise<void>} Retorna uma promise resolvida ao conectar com sucesso.\n */\n async connectWebSocket(): Promise<void> {\n try {\n await this.wsClient.connect();\n console.log(\"WebSocket conectado com sucesso!\");\n } catch (err) {\n console.error(\"Erro ao conectar ao WebSocket:\", err);\n throw err;\n }\n }\n\n /**\n * Checks if the WebSocket connection is currently active.\n *\n * This method provides a way to determine the current state of the WebSocket connection\n * to the Asterisk ARI server.\n *\n * @returns {boolean} Returns true if the WebSocket is connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient.isConnected();\n }\n\n /**\n * Registers a callback function for a specific WebSocket event.\n *\n * This method allows you to attach event listeners to WebSocket events\n * from the Asterisk ARI server. When the specified event occurs, the\n * provided callback function will be executed.\n *\n * @param event - The name of the WebSocket event to listen for.\n * @param callback - The function to be called when the event occurs.\n * It receives the event data as its parameter.\n * @returns void\n */\n onWebSocketEvent(event: string, callback: (data: any) => void): void {\n this.wsClient.on(event, callback);\n }\n\n /**\n * Closes the WebSocket connection to the Asterisk ARI server.\n *\n * This method terminates the existing WebSocket connection, if one is active.\n * It's useful for cleaning up resources when the connection is no longer needed.\n */\n closeWebSocket(): void {\n this.wsClient.close();\n }\n\n /**\n * Retrieves a list of all active channels from the Asterisk ARI server.\n *\n * This method makes an asynchronous GET request to the '/channels' endpoint\n * of the Asterisk ARI.\n *\n * @returns {Promise<any>} A promise that resolves with the list of active channels.\n * The exact structure of the returned data depends on the\n * Asterisk ARI specification.\n */\n async listChannels() {\n return this.baseClient.get(\"/channels\");\n }\n\n /**\n * Initiates a new channel on the Asterisk server.\n *\n * This method makes an asynchronous POST request to the '/channels' endpoint\n * of the Asterisk ARI to create a new channel with the specified parameters.\n *\n * @param {any} data - An object containing the parameters for the new channel.\n * The structure of this object should conform to the\n * Asterisk ARI specification for channel origination.\n * @returns {Promise<any>} A promise that resolves with the response from the\n * Asterisk server, typically containing details of\n * the newly created channel.\n */\n async originateChannel(data: any) {\n return this.baseClient.post(\"/channels\", data);\n }\n}\n"],
5
- "mappings": ";AAAA,OAAO,WAAmC;AAEnC,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,SAAiB,UAAkB,UAAkB;AAC/D,SAAK,SAAS,MAAM,OAAO;AAAA,MACzB,SAAS;AAAA,MACT,MAAM,EAAE,UAAU,SAAS;AAAA,IAC7B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAO,MAA0B;AACrC,UAAM,WAAW,MAAM,KAAK,OAAO,IAAO,IAAI;AAC9C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,KAAQ,MAAc,MAA4B;AACtD,UAAM,WAAW,MAAM,KAAK,OAAO,KAAQ,MAAM,IAAI;AACrD,WAAO,SAAS;AAAA,EAClB;AACF;;;AClBO,IAAM,WAAN,MAAe;AAAA,EACpB,YAAoB,QAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA,EAGzC,MAAM,OAA2B;AAC/B,WAAO,KAAK,OAAO,IAAe,WAAW;AAAA,EAC/C;AAAA;AAAA,EAGA,MAAM,UAAU,MAA0C;AACxD,WAAO,KAAK,OAAO,KAAc,aAAa,IAAI;AAAA,EACpD;AAAA;AAAA,EAGA,MAAM,WAAW,WAAqC;AACpD,WAAO,KAAK,OAAO,IAAa,aAAa,SAAS,EAAE;AAAA,EAC1D;AAAA;AAAA,EAGA,MAAM,OAAO,WAAkC;AAC7C,WAAO,KAAK,OAAO,KAAW,aAAa,SAAS,SAAS;AAAA,EAC/D;AAAA;AAAA,EAGA,MAAM,iBACJ,WACA,SACA,WACA,UACA,OACe;AACf,WAAO,KAAK,OAAO,KAAW,aAAa,SAAS,aAAa;AAAA,MAC/D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,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K,WAAW,IAAI,SAAS,KAAK,UAAU;AAAA,EAC9C;AAAA,EA1CQ;AAAA,EACS;AAAA,EAEV;AAAA;AAAA;AAAA;AAAA;AAAA,EA6CP,MAAM,mBAAkC;AACtC,QAAI;AACF,YAAM,KAAK,SAAS,QAAQ;AAC5B,cAAQ,IAAI,kCAAkC;AAAA,IAChD,SAAS,KAAK;AACZ,cAAQ,MAAM,kCAAkC,GAAG;AACnD,YAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,uBAAgC;AAC9B,WAAO,KAAK,SAAS,YAAY;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,iBAAiB,OAAe,UAAqC;AACnE,SAAK,SAAS,GAAG,OAAO,QAAQ;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAuB;AACrB,SAAK,SAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,eAAe;AACnB,WAAO,KAAK,WAAW,IAAI,WAAW;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAM,iBAAiB,MAAW;AAChC,WAAO,KAAK,WAAW,KAAK,aAAa,IAAI;AAAA,EAC/C;AACF;",
4
+ "sourcesContent": ["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 async get<T>(path: string): Promise<T> {\n const response = await this.client.get<T>(path);\n return response.data;\n }\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", "import type { BaseClient } from \"../baseClient.js\";\nimport type {\n Channel,\n OriginateRequest,\n} from \"../interfaces/channels.types.js\";\n\nexport class Channels {\n constructor(private client: BaseClient) {}\n\n // Lista todos os canais ativos\n async list(): Promise<Channel[]> {\n return this.client.get<Channel[]>(\"/channels\");\n }\n\n // Cria um novo canal\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n // Obt\u00E9m detalhes de um canal espec\u00EDfico\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n // Desliga (hangup) um canal\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n // Continua no dialplan\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 // Move o canal para outra aplica\u00E7\u00E3o Stasis\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", "import WebSocket from \"ws\";\n\nexport class WebSocketClient {\n private ws: WebSocket | null = null;\n private isClosedManually = false; // Para evitar reconex\u00F5es autom\u00E1ticas quando fechado manualmente\n\n constructor(private url: string) {}\n\n async connect(retryInterval = 1000): Promise<void> {\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 resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n if (!this.isClosedManually) {\n setTimeout(() => this.reconnect(retryInterval), retryInterval);\n }\n });\n });\n }\n\n private reconnect(retryInterval: number): void {\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.connect(retryInterval).catch((err) => {\n console.error(\"Erro ao tentar reconectar:\", err);\n });\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(event: string, callback: (data: any) => void): 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.on(event, callback);\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", "import { BaseClient } from \"./baseClient.js\";\nimport type { AriClientConfig } from \"./interfaces/requests.js\";\nimport { Channels } from \"./resources/channels.js\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n\n public channels: Channels;\n\n /**\n * Initializes a new instance of the AriClient class.\n *\n * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,\n * including HTTP connections. WebSocket connections are handled dynamically per application.\n *\n * @param config - The configuration object for the ARI client.\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 }\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(app: string): Promise<void> {\n if (!app) {\n throw new Error(\n \"The 'app' parameter is required to connect to the WebSocket.\",\n );\n }\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}`;\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await this.wsClient.connect();\n console.log(`WebSocket connected for app: ${app}`);\n } catch (err) {\n console.error(\"Error connecting to WebSocket:\", err);\n throw err;\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 for a specific WebSocket event.\n *\n * @param event - The WebSocket event to listen for.\n * @param callback - The callback function to execute when the event occurs.\n */\n onWebSocketEvent(event: string, callback: (data: any) => void): void {\n if (!this.wsClient) {\n throw new Error(\"WebSocket is not connected.\");\n }\n this.wsClient.on(event, 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 /**\n * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<any>} A promise resolving to the list of active channels.\n */\n async listChannels() {\n return this.baseClient.get(\"/channels\");\n }\n\n /**\n * Initiates a new channel on the Asterisk server.\n *\n * @param data - The parameters for creating the new channel.\n * @returns {Promise<any>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: any) {\n return this.baseClient.post(\"/channels\", data);\n }\n}\n"],
5
+ "mappings": ";AAAA,OAAO,WAAmC;AAEnC,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,SAAiB,UAAkB,UAAkB;AAC/D,SAAK,SAAS,MAAM,OAAO;AAAA,MACzB,SAAS;AAAA,MACT,MAAM,EAAE,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nD,YAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,uBAAgC;AAC9B,WAAO,KAAK,WAAW,KAAK,SAAS,YAAY,IAAI;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,OAAe,UAAqC;AACnE,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AACA,SAAK,SAAS,GAAG,OAAO,QAAQ;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA,EAKA,iBAAuB;AACrB,QAAI,KAAK,UAAU;AACjB,WAAK,SAAS,MAAM;AACpB,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe;AACnB,WAAO,KAAK,WAAW,IAAI,WAAW;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,MAAW;AAChC,WAAO,KAAK,WAAW,KAAK,aAAa,IAAI;AAAA,EAC/C;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,5 @@
1
- import { Channels } from "./resources/channels";
2
- export interface AriClientConfig {
3
- host: string;
4
- port: number;
5
- username: string;
6
- password: string;
7
- secure?: boolean;
8
- }
1
+ import type { AriClientConfig } from "./interfaces/requests.js";
2
+ import { Channels } from "./resources/channels.js";
9
3
  export declare class AriClient {
10
4
  private config;
11
5
  private wsClient;
@@ -15,73 +9,46 @@ export declare class AriClient {
15
9
  * Initializes a new instance of the AriClient class.
16
10
  *
17
11
  * This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,
18
- * including WebSocket and HTTP connections. It also initializes the channels resource.
12
+ * including HTTP connections. WebSocket connections are handled dynamically per application.
19
13
  *
20
14
  * @param config - The configuration object for the ARI client.
21
- * @param config.host - The hostname or IP address of the Asterisk server.
22
- * @param config.port - The port number on which the Asterisk ARI is listening.
23
- * @param config.username - The username for authentication with the Asterisk ARI.
24
- * @param config.password - The password for authentication with the Asterisk ARI.
25
- * @param config.secure - Optional. If true, uses secure protocols (WSS/HTTPS). Defaults to false.
26
15
  */
27
16
  constructor(config: AriClientConfig);
28
17
  /**
29
- * Conecta ao WebSocket do ARI.
30
- * @returns {Promise<void>} Retorna uma promise resolvida ao conectar com sucesso.
18
+ * Connects to the ARI WebSocket for a specific application.
19
+ *
20
+ * @param app - The application name to connect to.
21
+ * @returns {Promise<void>} Resolves when the WebSocket connects successfully.
31
22
  */
32
- connectWebSocket(): Promise<void>;
23
+ connectWebSocket(app: string): Promise<void>;
33
24
  /**
34
- * Checks if the WebSocket connection is currently active.
25
+ * Checks if the WebSocket connection is active.
35
26
  *
36
- * This method provides a way to determine the current state of the WebSocket connection
37
- * to the Asterisk ARI server.
38
- *
39
- * @returns {boolean} Returns true if the WebSocket is connected, false otherwise.
27
+ * @returns {boolean} True if connected, false otherwise.
40
28
  */
41
29
  isWebSocketConnected(): boolean;
42
30
  /**
43
- * Registers a callback function for a specific WebSocket event.
44
- *
45
- * This method allows you to attach event listeners to WebSocket events
46
- * from the Asterisk ARI server. When the specified event occurs, the
47
- * provided callback function will be executed.
31
+ * Registers a callback for a specific WebSocket event.
48
32
  *
49
- * @param event - The name of the WebSocket event to listen for.
50
- * @param callback - The function to be called when the event occurs.
51
- * It receives the event data as its parameter.
52
- * @returns void
33
+ * @param event - The WebSocket event to listen for.
34
+ * @param callback - The callback function to execute when the event occurs.
53
35
  */
54
36
  onWebSocketEvent(event: string, callback: (data: any) => void): void;
55
37
  /**
56
- * Closes the WebSocket connection to the Asterisk ARI server.
57
- *
58
- * This method terminates the existing WebSocket connection, if one is active.
59
- * It's useful for cleaning up resources when the connection is no longer needed.
38
+ * Closes the WebSocket connection.
60
39
  */
61
40
  closeWebSocket(): void;
62
41
  /**
63
- * Retrieves a list of all active channels from the Asterisk ARI server.
64
- *
65
- * This method makes an asynchronous GET request to the '/channels' endpoint
66
- * of the Asterisk ARI.
42
+ * Retrieves a list of active channels from the Asterisk ARI.
67
43
  *
68
- * @returns {Promise<any>} A promise that resolves with the list of active channels.
69
- * The exact structure of the returned data depends on the
70
- * Asterisk ARI specification.
44
+ * @returns {Promise<any>} A promise resolving to the list of active channels.
71
45
  */
72
46
  listChannels(): Promise<unknown>;
73
47
  /**
74
48
  * Initiates a new channel on the Asterisk server.
75
49
  *
76
- * This method makes an asynchronous POST request to the '/channels' endpoint
77
- * of the Asterisk ARI to create a new channel with the specified parameters.
78
- *
79
- * @param {any} data - An object containing the parameters for the new channel.
80
- * The structure of this object should conform to the
81
- * Asterisk ARI specification for channel origination.
82
- * @returns {Promise<any>} A promise that resolves with the response from the
83
- * Asterisk server, typically containing details of
84
- * the newly created channel.
50
+ * @param data - The parameters for creating the new channel.
51
+ * @returns {Promise<any>} A promise resolving to the new channel's details.
85
52
  */
86
53
  originateChannel(data: any): Promise<unknown>;
87
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ariClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/ariClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,SAAS;IAmBR,OAAO,CAAC,MAAM;IAlB1B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAEjC,QAAQ,EAAE,QAAQ,CAAC;IAE1B;;;;;;;;;;;;OAYG;gBACiB,MAAM,EAAE,eAAe;IA0B3C;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvC;;;;;;;OAOG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIpE;;;;;OAKG;IACH,cAAc,IAAI,IAAI;IAItB;;;;;;;;;OASG;IACG,YAAY;IAIlB;;;;;;;;;;;;OAYG;IACG,gBAAgB,CAAC,IAAI,EAAE,GAAG;CAGjC"}
1
+ {"version":3,"file":"ariClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/ariClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,qBAAa,SAAS;IAcR,OAAO,CAAC,MAAM;IAb1B,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAEjC,QAAQ,EAAE,QAAQ,CAAC;IAE1B;;;;;;;OAOG;gBACiB,MAAM,EAAE,eAAe;IAS3C;;;;;OAKG;IACG,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBlD;;;;OAIG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAOpE;;OAEG;IACH,cAAc,IAAI,IAAI;IAOtB;;;;OAIG;IACG,YAAY;IAIlB;;;;;OAKG;IACG,gBAAgB,CAAC,IAAI,EAAE,GAAG;CAGjC"}
@@ -1,5 +1,5 @@
1
- import type { BaseClient } from "../baseClient";
2
- import type { Channel, OriginateRequest } from "../interfaces/channels.types";
1
+ import type { BaseClient } from "../baseClient.js";
2
+ import type { Channel, OriginateRequest } from "../interfaces/channels.types.js";
3
3
  export declare class Channels {
4
4
  private client;
5
5
  constructor(client: BaseClient);
@@ -1 +1 @@
1
- {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE9E,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAGhC,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAK1B,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAUV,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAMjB"}
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,OAAO,EACP,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AAEzC,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAGhC,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAK1B,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAUV,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAMjB"}
@@ -1,5 +1,5 @@
1
- export { AriClient } from "./ari-client/ariClient";
2
- export { Channels } from "./ari-client/resources/channels";
3
- export type { AriClientConfig } from "./ari-client/ariClient";
4
- export type { Channel } from "./ari-client/interfaces/channels.types";
1
+ export { AriClient } from "./ari-client/ariClient.js";
2
+ export { Channels } from "./ari-client/resources/channels.js";
3
+ export type { AriClientConfig } from "./ari-client/interfaces/requests.js";
4
+ export type { Channel } from "./ari-client/interfaces/channels.types.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG9D,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipcom/asterisk-ari",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "description": "JavaScript client for Asterisk REST Interface.",
6
6
  "homepage": "https://github.com/fabiotheo/ipcom-asterisk-ari",