@ipcom/asterisk-ari 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +3 -3
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/types/ari-client/ariClient.d.ts +2 -8
- package/dist/types/ari-client/ariClient.d.ts.map +1 -1
- package/dist/types/ari-client/interfaces/requests.d.ts +1 -0
- package/dist/types/ari-client/interfaces/requests.d.ts.map +1 -1
- package/dist/types/ari-client/resources/channels.d.ts +2 -2
- package/dist/types/ari-client/resources/channels.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -165,10 +165,10 @@ var AriClient = class {
|
|
|
165
165
|
// Adicionado
|
|
166
166
|
/**
|
|
167
167
|
* Initializes a new instance of the AriClient class.
|
|
168
|
-
*
|
|
168
|
+
*
|
|
169
169
|
* This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,
|
|
170
170
|
* including WebSocket and HTTP connections. It also initializes the channels resource.
|
|
171
|
-
*
|
|
171
|
+
*
|
|
172
172
|
* @param config - The configuration object for the ARI client.
|
|
173
173
|
* @param config.host - The hostname or IP address of the Asterisk server.
|
|
174
174
|
* @param config.port - The port number on which the Asterisk ARI is listening.
|
|
@@ -183,7 +183,7 @@ var AriClient = class {
|
|
|
183
183
|
const encodedUsername = encodeURIComponent(config.username);
|
|
184
184
|
const encodedPassword = encodeURIComponent(config.password);
|
|
185
185
|
const normalizedHost = config.host.replace(/^https?:\/\//, "");
|
|
186
|
-
const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;
|
|
186
|
+
const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events?app=${config.app}`;
|
|
187
187
|
const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
|
|
188
188
|
console.log({ wsUrl, baseUrl });
|
|
189
189
|
this.wsClient = new WebSocketClient(wsUrl);
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -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,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;;;
|
|
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;\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?app=${config.app}`;\n\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,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;;;ACfO,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,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B,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;",
|
|
6
6
|
"names": ["axios", "WebSocket"]
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -128,10 +128,10 @@ var AriClient = class {
|
|
|
128
128
|
// Adicionado
|
|
129
129
|
/**
|
|
130
130
|
* Initializes a new instance of the AriClient class.
|
|
131
|
-
*
|
|
131
|
+
*
|
|
132
132
|
* This constructor sets up the necessary configurations for connecting to an Asterisk ARI server,
|
|
133
133
|
* including WebSocket and HTTP connections. It also initializes the channels resource.
|
|
134
|
-
*
|
|
134
|
+
*
|
|
135
135
|
* @param config - The configuration object for the ARI client.
|
|
136
136
|
* @param config.host - The hostname or IP address of the Asterisk server.
|
|
137
137
|
* @param config.port - The port number on which the Asterisk ARI is listening.
|
|
@@ -146,7 +146,7 @@ var AriClient = class {
|
|
|
146
146
|
const encodedUsername = encodeURIComponent(config.username);
|
|
147
147
|
const encodedPassword = encodeURIComponent(config.password);
|
|
148
148
|
const normalizedHost = config.host.replace(/^https?:\/\//, "");
|
|
149
|
-
const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events`;
|
|
149
|
+
const wsUrl = `${protocol}://${encodedUsername}:${encodedPassword}@${normalizedHost}:${config.port}/ari/events?app=${config.app}`;
|
|
150
150
|
const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
|
|
151
151
|
console.log({ wsUrl, baseUrl });
|
|
152
152
|
this.wsClient = new WebSocketClient(wsUrl);
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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 {
|
|
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;;;
|
|
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;\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?app=${config.app}`;\n\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;;;ACfO,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,S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BAAiB,MAAW;AAChC,WAAO,KAAK,WAAW,KAAK,aAAa,IAAI;AAAA,EAC/C;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ariClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/ariClient.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
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;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;IA2B3C;;;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/requests.ts"],"names":[],"mappings":"AAAA,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;
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/requests.ts"],"names":[],"mappings":"AAAA,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;IACjB,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -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,
|
|
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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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/
|
|
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,
|
|
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"}
|