@ipcom/asterisk-ari 0.0.15 → 0.0.17

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.
@@ -607,6 +607,45 @@ var BaseClient = class {
607
607
  }
608
608
  };
609
609
 
610
+ // src/ari-client/resources/applications.ts
611
+ var Applications = class {
612
+ constructor(client) {
613
+ this.client = client;
614
+ }
615
+ /**
616
+ * Lists all applications.
617
+ *
618
+ * @returns A promise that resolves to an array of Application objects representing all registered applications.
619
+ * @throws {Error} If the API response is not an array.
620
+ */
621
+ async list() {
622
+ const applications = await this.client.get("/applications");
623
+ if (!Array.isArray(applications)) {
624
+ throw new Error("Resposta da API /applications n\xE3o \xE9 um array.");
625
+ }
626
+ return applications;
627
+ }
628
+ /**
629
+ * Retrieves details of a specific application.
630
+ *
631
+ * @param appName - The unique name of the application.
632
+ * @returns A promise that resolves to an ApplicationDetails object containing the details of the specified application.
633
+ */
634
+ async getDetails(appName) {
635
+ return this.client.get(`/applications/${appName}`);
636
+ }
637
+ /**
638
+ * Sends a message to a specific application.
639
+ *
640
+ * @param appName - The unique name of the application.
641
+ * @param body - The message body to send.
642
+ * @returns A promise that resolves when the message is sent successfully.
643
+ */
644
+ async sendMessage(appName, body) {
645
+ await this.client.post(`/applications/${appName}/messages`, body);
646
+ }
647
+ };
648
+
610
649
  // src/ari-client/resources/channels.ts
611
650
  var Channels = class {
612
651
  constructor(client) {
@@ -686,6 +725,52 @@ var Channels = class {
686
725
  }
687
726
  };
688
727
 
728
+ // src/ari-client/resources/endpoints.ts
729
+ var Endpoints = class {
730
+ constructor(client) {
731
+ this.client = client;
732
+ }
733
+ /**
734
+ * Lists all available endpoints.
735
+ *
736
+ * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.
737
+ * @throws {Error} If the API response is not an array.
738
+ */
739
+ async list() {
740
+ const endpoints = await this.client.get("/endpoints");
741
+ if (!Array.isArray(endpoints)) {
742
+ throw new Error("Resposta da API /endpoints n\xE3o \xE9 um array.");
743
+ }
744
+ return endpoints;
745
+ }
746
+ /**
747
+ * Retrieves details of a specific endpoint.
748
+ *
749
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
750
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
751
+ * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.
752
+ */
753
+ async getDetails(technology, resource) {
754
+ return this.client.get(
755
+ `/endpoints/${technology}/${resource}`
756
+ );
757
+ }
758
+ /**
759
+ * Sends a message to a specific endpoint.
760
+ *
761
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
762
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
763
+ * @param message - The message payload to send to the endpoint.
764
+ * @returns A promise that resolves when the message has been successfully sent.
765
+ */
766
+ async sendMessage(technology, resource, message) {
767
+ await this.client.post(
768
+ `/endpoints/${technology}/${resource}/sendMessage`,
769
+ message
770
+ );
771
+ }
772
+ };
773
+
689
774
  // src/ari-client/websocketClient.ts
690
775
  var import_ws = __toESM(require("ws"), 1);
691
776
  var WebSocketClient = class {
@@ -779,11 +864,15 @@ var AriClient = class {
779
864
  const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
780
865
  this.baseClient = new BaseClient(baseUrl, config.username, config.password);
781
866
  this.channels = new Channels(this.baseClient);
867
+ this.endpoints = new Endpoints(this.baseClient);
868
+ this.applications = new Applications(this.baseClient);
782
869
  }
783
870
  wsClient = null;
784
871
  baseClient;
785
872
  isReconnecting = false;
786
873
  channels;
874
+ endpoints;
875
+ applications;
787
876
  /**
788
877
  * Connects to the ARI WebSocket for a specific application.
789
878
  *
@@ -951,6 +1040,64 @@ var AriClient = class {
951
1040
  async moveChannelToApplication(channelId, app, appArgs) {
952
1041
  return this.channels.moveToApplication(channelId, app, appArgs);
953
1042
  }
1043
+ // Métodos relacionados a endpoints:
1044
+ /**
1045
+ * Lists all endpoints.
1046
+ *
1047
+ * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.
1048
+ */
1049
+ async listEndpoints() {
1050
+ return this.endpoints.list();
1051
+ }
1052
+ /**
1053
+ * Retrieves details of a specific endpoint.
1054
+ *
1055
+ * @param technology - The technology of the endpoint.
1056
+ * @param resource - The resource name of the endpoint.
1057
+ * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.
1058
+ */
1059
+ async getEndpointDetails(technology, resource) {
1060
+ return this.endpoints.getDetails(technology, resource);
1061
+ }
1062
+ /**
1063
+ * Sends a message to an endpoint.
1064
+ *
1065
+ * @param technology - The technology of the endpoint.
1066
+ * @param resource - The resource name of the endpoint.
1067
+ * @param body - The message body to send.
1068
+ * @returns {Promise<void>} A promise resolving when the message is sent.
1069
+ */
1070
+ async sendMessageToEndpoint(technology, resource, body) {
1071
+ return this.endpoints.sendMessage(technology, resource, body);
1072
+ }
1073
+ // Métodos relacionados a applications
1074
+ /**
1075
+ * Lists all applications.
1076
+ *
1077
+ * @returns {Promise<Application[]>} A promise resolving to the list of applications.
1078
+ */
1079
+ async listApplications() {
1080
+ return this.applications.list();
1081
+ }
1082
+ /**
1083
+ * Retrieves details of a specific application.
1084
+ *
1085
+ * @param appName - The name of the application.
1086
+ * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.
1087
+ */
1088
+ async getApplicationDetails(appName) {
1089
+ return this.applications.getDetails(appName);
1090
+ }
1091
+ /**
1092
+ * Sends a message to a specific application.
1093
+ *
1094
+ * @param appName - The name of the application.
1095
+ * @param body - The message body to send.
1096
+ * @returns {Promise<void>} A promise resolving when the message is sent successfully.
1097
+ */
1098
+ async sendMessageToApplication(appName, body) {
1099
+ return this.applications.sendMessage(appName, body);
1100
+ }
954
1101
  };
955
1102
  // Annotate the CommonJS export names for ESM import in node:
956
1103
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/index.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/websocketClient.ts"],
4
- "sourcesContent": [null, null, null, null, null, null, null, null, null, "// Exporta a classe principal AriClient\nexport { AriClient } from \"./ari-client/ariClient.js\";\n\n// Exporta as classes dos recursos, caso o usu\u00E1rio precise us\u00E1-las diretamente\nexport { Channels } from \"./ari-client/resources/channels.js\";\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 { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type { Channel, OriginateRequest } from \"./interfaces/channels.types\";\nimport type { AriApplication, 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 private isReconnecting = false;\n\n public channels: Channels;\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 if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback 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 * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\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<Channel>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @returns {Promise<Channel>} A promise resolving to the details of the channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @returns {Promise<void>}\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns {Promise<void>}\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n *\n * @param channelId - The unique identifier of the channel.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional arguments for the Stasis application.\n * @returns {Promise<void>}\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n}\n", "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 /**\n * Lists all active channels.\n * \n * @returns A promise that resolves to an array of Channel objects representing all active channels.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n * \n * @param data - The OriginateRequest object containing the necessary data to create a new channel.\n * @returns A promise that resolves to a Channel object representing the newly created channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @returns A promise that resolves to a Channel object containing the details of the specified channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n * \n * @param channelId - The unique identifier of the channel to be hung up.\n * @returns A promise that resolves when the channel has been successfully hung up.\n */\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns A promise that resolves when the dialplan continuation has been successfully initiated.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n * \n * @param channelId - The unique identifier of the channel to be moved.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional. Arguments to be passed to the Stasis application.\n * @returns A promise that resolves when the channel has been successfully moved to the new application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n}\n", "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 private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(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 if (event === \"message\") {\n this.ws.on(event, (data) => {\n try {\n const decodedData = JSON.parse(data.toString());\n callback(decodedData); // Retorna o JSON j\u00E1 decodificado\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n callback(data); // Retorna o buffer original em caso de erro\n }\n });\n } else {\n this.ws.on(event, callback);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log(\"WebSocket fechado manualmente.\");\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,QAAM,iBAAkC;MACtC,mBAAmB;MACnB,QAAQ;MACR,UAAU;MACV,eAAe;MACf,OAAO,WAAA;AAAM,eAAA;MAAA;MACb,eAAe;MACf,cAAc;;AAGhB,aAAgB,oBAAoB,SAAuB;AACzD,UAAM,YAAS,SAAA,SAAA,CAAA,GAAyB,cAAc,GAAK,OAAO;AAElE,UAAI,UAAU,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AAA,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,EAMA,MAAM,eAAmC;AACvC,WAAO,KAAK,SAAS,KAAK;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,MAA0C;AAC/D,WAAO,KAAK,SAAS,UAAU,IAAI;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,kBAAkB,WAAqC;AAC3D,WAAO,KAAK,SAAS,WAAW,SAAS;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,cAAc,WAAkC;AACpD,WAAO,KAAK,SAAS,OAAO,SAAS;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,wBACJ,WACA,SACA,WACA,UACA,OACe;AACf,WAAO,KAAK,SAAS;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,yBACJ,WACA,KACA,SACe;AACf,WAAO,KAAK,SAAS,kBAAkB,WAAW,KAAK,OAAO;AAAA,EAChE;AACF;",
3
+ "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/index.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/applications.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/resources/endpoints.ts", "../../src/ari-client/websocketClient.ts"],
4
+ "sourcesContent": [null, null, null, null, null, null, null, null, null, "// Exporta a classe principal AriClient\nexport { AriClient } from \"./ari-client/ariClient.js\";\n\n// Exporta as classes dos recursos, caso o usu\u00E1rio precise us\u00E1-las diretamente\nexport { Channels } from \"./ari-client/resources/channels.js\";\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 { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n} from \"./interfaces/applications.types\";\nimport type { Channel, OriginateRequest } from \"./interfaces/channels.types\";\nimport type {\n Endpoint,\n EndpointDetails,\n} from \"./interfaces/endpoints.types.js\";\nimport type { AriApplication, AriClientConfig } from \"./interfaces/requests.js\";\nimport { Applications } from \"./resources/applications.js\";\nimport { Channels } from \"./resources/channels.js\";\nimport { Endpoints } from \"./resources/endpoints\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n private isReconnecting = false;\n\n public channels: Channels;\n public endpoints: Endpoints;\n public applications: Applications;\n\n constructor(private config: AriClientConfig) {\n const httpProtocol = config.secure ? \"https\" : \"http\";\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n this.channels = new Channels(this.baseClient);\n this.endpoints = new Endpoints(this.baseClient);\n this.applications = new Applications(this.baseClient);\n }\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 if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback 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 * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\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<Channel>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @returns {Promise<Channel>} A promise resolving to the details of the channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @returns {Promise<void>}\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns {Promise<void>}\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n *\n * @param channelId - The unique identifier of the channel.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional arguments for the Stasis application.\n * @returns {Promise<void>}\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n\n // M\u00E9todos relacionados a endpoints:\n\n /**\n * Lists all endpoints.\n *\n * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.\n */\n async listEndpoints(): Promise<Endpoint[]> {\n return this.endpoints.list();\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.\n */\n async getEndpointDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.endpoints.getDetails(technology, resource);\n }\n\n /**\n * Sends a message to an endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent.\n */\n async sendMessageToEndpoint(\n technology: string,\n resource: string,\n body: any,\n ): Promise<void> {\n return this.endpoints.sendMessage(technology, resource, body);\n }\n\n // M\u00E9todos relacionados a applications\n /**\n * Lists all applications.\n *\n * @returns {Promise<Application[]>} A promise resolving to the list of applications.\n */\n async listApplications(): Promise<Application[]> {\n return this.applications.list();\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The name of the application.\n * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.\n */\n async getApplicationDetails(appName: string): Promise<ApplicationDetails> {\n return this.applications.getDetails(appName);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The name of the application.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent successfully.\n */\n async sendMessageToApplication(appName: string, body: any): Promise<void> {\n return this.applications.sendMessage(appName, body);\n }\n}\n", "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 Application,\n ApplicationDetails,\n} from \"../interfaces/applications.types.js\";\n\nexport class Applications {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all applications.\n *\n * @returns A promise that resolves to an array of Application objects representing all registered applications.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Application[]> {\n const applications = await this.client.get<unknown>(\"/applications\");\n\n if (!Array.isArray(applications)) {\n throw new Error(\"Resposta da API /applications n\u00E3o \u00E9 um array.\");\n }\n\n return applications as Application[];\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The unique name of the application.\n * @returns A promise that resolves to an ApplicationDetails object containing the details of the specified application.\n */\n async getDetails(appName: string): Promise<ApplicationDetails> {\n return this.client.get<ApplicationDetails>(`/applications/${appName}`);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The unique name of the application.\n * @param body - The message body to send.\n * @returns A promise that resolves when the message is sent successfully.\n */\n async sendMessage(appName: string, body: any): Promise<void> {\n await this.client.post<void>(`/applications/${appName}/messages`, body);\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 /**\n * Lists all active channels.\n * \n * @returns A promise that resolves to an array of Channel objects representing all active channels.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n * \n * @param data - The OriginateRequest object containing the necessary data to create a new channel.\n * @returns A promise that resolves to a Channel object representing the newly created channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @returns A promise that resolves to a Channel object containing the details of the specified channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n * \n * @param channelId - The unique identifier of the channel to be hung up.\n * @returns A promise that resolves when the channel has been successfully hung up.\n */\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns A promise that resolves when the dialplan continuation has been successfully initiated.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n * \n * @param channelId - The unique identifier of the channel to be moved.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional. Arguments to be passed to the Stasis application.\n * @returns A promise that resolves when the channel has been successfully moved to the new application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Endpoint, EndpointDetails } from \"../interfaces/endpoints.types\";\n\nexport class Endpoints {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available endpoints.\n *\n * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Endpoint[]> {\n const endpoints = await this.client.get<unknown>(\"/endpoints\");\n\n if (!Array.isArray(endpoints)) {\n throw new Error(\"Resposta da API /endpoints n\u00E3o \u00E9 um array.\");\n }\n\n return endpoints as Endpoint[];\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.\n */\n async getDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.client.get<EndpointDetails>(\n `/endpoints/${technology}/${resource}`,\n );\n }\n\n /**\n * Sends a message to a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @param message - The message payload to send to the endpoint.\n * @returns A promise that resolves when the message has been successfully sent.\n */\n async sendMessage(\n technology: string,\n resource: string,\n message: Record<string, unknown>,\n ): Promise<void> {\n await this.client.post<void>(\n `/endpoints/${technology}/${resource}/sendMessage`,\n message,\n );\n }\n}\n", "import 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 private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(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 if (event === \"message\") {\n this.ws.on(event, (data) => {\n try {\n const decodedData = JSON.parse(data.toString());\n callback(decodedData); // Retorna o JSON j\u00E1 decodificado\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n callback(data); // Retorna o buffer original em caso de erro\n }\n });\n } else {\n this.ws.on(event, callback);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log(\"WebSocket fechado manualmente.\");\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,QAAM,iBAAkC;MAC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,kBAAkB,WAAW,KAAK,OAAO;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAqC;AACzC,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,mBACJ,YACA,UAC0B;AAC1B,WAAO,KAAK,UAAU,WAAW,YAAY,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,sBACJ,YACA,UACA,MACe;AACf,WAAO,KAAK,UAAU,YAAY,YAAY,UAAU,IAAI;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAA2C;AAC/C,WAAO,KAAK,aAAa,KAAK;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,sBAAsB,SAA8C;AACxE,WAAO,KAAK,aAAa,WAAW,OAAO;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,yBAAyB,SAAiB,MAA0B;AACxE,WAAO,KAAK,aAAa,YAAY,SAAS,IAAI;AAAA,EACpD;AACF;",
6
6
  "names": ["exports", "exports", "exports", "exports", "Delay", "exports", "SkipFirstDelay", "exports", "AlwaysDelay", "exports", "exports", "backOff", "exports", "BackOff", "axios", "WebSocket"]
7
7
  }
package/dist/esm/index.js CHANGED
@@ -593,6 +593,45 @@ var BaseClient = class {
593
593
  }
594
594
  };
595
595
 
596
+ // src/ari-client/resources/applications.ts
597
+ var Applications = class {
598
+ constructor(client) {
599
+ this.client = client;
600
+ }
601
+ /**
602
+ * Lists all applications.
603
+ *
604
+ * @returns A promise that resolves to an array of Application objects representing all registered applications.
605
+ * @throws {Error} If the API response is not an array.
606
+ */
607
+ async list() {
608
+ const applications = await this.client.get("/applications");
609
+ if (!Array.isArray(applications)) {
610
+ throw new Error("Resposta da API /applications n\xE3o \xE9 um array.");
611
+ }
612
+ return applications;
613
+ }
614
+ /**
615
+ * Retrieves details of a specific application.
616
+ *
617
+ * @param appName - The unique name of the application.
618
+ * @returns A promise that resolves to an ApplicationDetails object containing the details of the specified application.
619
+ */
620
+ async getDetails(appName) {
621
+ return this.client.get(`/applications/${appName}`);
622
+ }
623
+ /**
624
+ * Sends a message to a specific application.
625
+ *
626
+ * @param appName - The unique name of the application.
627
+ * @param body - The message body to send.
628
+ * @returns A promise that resolves when the message is sent successfully.
629
+ */
630
+ async sendMessage(appName, body) {
631
+ await this.client.post(`/applications/${appName}/messages`, body);
632
+ }
633
+ };
634
+
596
635
  // src/ari-client/resources/channels.ts
597
636
  var Channels = class {
598
637
  constructor(client) {
@@ -672,6 +711,52 @@ var Channels = class {
672
711
  }
673
712
  };
674
713
 
714
+ // src/ari-client/resources/endpoints.ts
715
+ var Endpoints = class {
716
+ constructor(client) {
717
+ this.client = client;
718
+ }
719
+ /**
720
+ * Lists all available endpoints.
721
+ *
722
+ * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.
723
+ * @throws {Error} If the API response is not an array.
724
+ */
725
+ async list() {
726
+ const endpoints = await this.client.get("/endpoints");
727
+ if (!Array.isArray(endpoints)) {
728
+ throw new Error("Resposta da API /endpoints n\xE3o \xE9 um array.");
729
+ }
730
+ return endpoints;
731
+ }
732
+ /**
733
+ * Retrieves details of a specific endpoint.
734
+ *
735
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
736
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
737
+ * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.
738
+ */
739
+ async getDetails(technology, resource) {
740
+ return this.client.get(
741
+ `/endpoints/${technology}/${resource}`
742
+ );
743
+ }
744
+ /**
745
+ * Sends a message to a specific endpoint.
746
+ *
747
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
748
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
749
+ * @param message - The message payload to send to the endpoint.
750
+ * @returns A promise that resolves when the message has been successfully sent.
751
+ */
752
+ async sendMessage(technology, resource, message) {
753
+ await this.client.post(
754
+ `/endpoints/${technology}/${resource}/sendMessage`,
755
+ message
756
+ );
757
+ }
758
+ };
759
+
675
760
  // src/ari-client/websocketClient.ts
676
761
  import WebSocket from "ws";
677
762
  var WebSocketClient = class {
@@ -765,11 +850,15 @@ var AriClient = class {
765
850
  const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;
766
851
  this.baseClient = new BaseClient(baseUrl, config.username, config.password);
767
852
  this.channels = new Channels(this.baseClient);
853
+ this.endpoints = new Endpoints(this.baseClient);
854
+ this.applications = new Applications(this.baseClient);
768
855
  }
769
856
  wsClient = null;
770
857
  baseClient;
771
858
  isReconnecting = false;
772
859
  channels;
860
+ endpoints;
861
+ applications;
773
862
  /**
774
863
  * Connects to the ARI WebSocket for a specific application.
775
864
  *
@@ -937,6 +1026,64 @@ var AriClient = class {
937
1026
  async moveChannelToApplication(channelId, app, appArgs) {
938
1027
  return this.channels.moveToApplication(channelId, app, appArgs);
939
1028
  }
1029
+ // Métodos relacionados a endpoints:
1030
+ /**
1031
+ * Lists all endpoints.
1032
+ *
1033
+ * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.
1034
+ */
1035
+ async listEndpoints() {
1036
+ return this.endpoints.list();
1037
+ }
1038
+ /**
1039
+ * Retrieves details of a specific endpoint.
1040
+ *
1041
+ * @param technology - The technology of the endpoint.
1042
+ * @param resource - The resource name of the endpoint.
1043
+ * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.
1044
+ */
1045
+ async getEndpointDetails(technology, resource) {
1046
+ return this.endpoints.getDetails(technology, resource);
1047
+ }
1048
+ /**
1049
+ * Sends a message to an endpoint.
1050
+ *
1051
+ * @param technology - The technology of the endpoint.
1052
+ * @param resource - The resource name of the endpoint.
1053
+ * @param body - The message body to send.
1054
+ * @returns {Promise<void>} A promise resolving when the message is sent.
1055
+ */
1056
+ async sendMessageToEndpoint(technology, resource, body) {
1057
+ return this.endpoints.sendMessage(technology, resource, body);
1058
+ }
1059
+ // Métodos relacionados a applications
1060
+ /**
1061
+ * Lists all applications.
1062
+ *
1063
+ * @returns {Promise<Application[]>} A promise resolving to the list of applications.
1064
+ */
1065
+ async listApplications() {
1066
+ return this.applications.list();
1067
+ }
1068
+ /**
1069
+ * Retrieves details of a specific application.
1070
+ *
1071
+ * @param appName - The name of the application.
1072
+ * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.
1073
+ */
1074
+ async getApplicationDetails(appName) {
1075
+ return this.applications.getDetails(appName);
1076
+ }
1077
+ /**
1078
+ * Sends a message to a specific application.
1079
+ *
1080
+ * @param appName - The name of the application.
1081
+ * @param body - The message body to send.
1082
+ * @returns {Promise<void>} A promise resolving when the message is sent successfully.
1083
+ */
1084
+ async sendMessageToApplication(appName, body) {
1085
+ return this.applications.sendMessage(appName, body);
1086
+ }
940
1087
  };
941
1088
  export {
942
1089
  AriClient,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/websocketClient.ts"],
4
- "sourcesContent": [null, null, null, null, null, null, null, null, null, "import { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type { Channel, OriginateRequest } from \"./interfaces/channels.types\";\nimport type { AriApplication, 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 private isReconnecting = false;\n\n public channels: Channels;\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 if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback 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 * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\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<Channel>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @returns {Promise<Channel>} A promise resolving to the details of the channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @returns {Promise<void>}\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns {Promise<void>}\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n *\n * @param channelId - The unique identifier of the channel.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional arguments for the Stasis application.\n * @returns {Promise<void>}\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n}\n", "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 /**\n * Lists all active channels.\n * \n * @returns A promise that resolves to an array of Channel objects representing all active channels.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n * \n * @param data - The OriginateRequest object containing the necessary data to create a new channel.\n * @returns A promise that resolves to a Channel object representing the newly created channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @returns A promise that resolves to a Channel object containing the details of the specified channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n * \n * @param channelId - The unique identifier of the channel to be hung up.\n * @returns A promise that resolves when the channel has been successfully hung up.\n */\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns A promise that resolves when the dialplan continuation has been successfully initiated.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n * \n * @param channelId - The unique identifier of the channel to be moved.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional. Arguments to be passed to the Stasis application.\n * @returns A promise that resolves when the channel has been successfully moved to the new application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n}\n", "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 private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(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 if (event === \"message\") {\n this.ws.on(event, (data) => {\n try {\n const decodedData = JSON.parse(data.toString());\n callback(decodedData); // Retorna o JSON j\u00E1 decodificado\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n callback(data); // Retorna o buffer original em caso de erro\n }\n });\n } else {\n this.ws.on(event, callback);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log(\"WebSocket fechado manualmente.\");\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,QAAM,iBAAkC;MACtC,mBAAmB;MACnB,QAAQ;MACR,UAAU;MACV,eAAe;MACf,OAAO,WAAA;AAAM,eAAA;MAAA;MACb,eAAe;MACf,cAAc;;AAGhB,aAAgB,oBAAoB,SAAuB;AACzD,UAAM,YAAS,SAAA,SAAA,CAAA,GAAyB,cAAc,GAAK,OAAO;AAElE,UAAI,UAAU,gBAAgB,GAAG;AAC/B,kBAAU,gBAAgB;;AAG5B,aAAO;IACT;AARA,YAAA,sBAAA;;;;;;;;;ACxBA,aAAgB,WAAW,OAAa;AACpC,UAAM,gBAAgB,KAAK,OAAM,IAAK;AACtC,aAAO,KAAK,MAAM,aAAa;IACnC;AAHA,YAAA,aAAA;;;;;;;;;ACAA,aAAgB,SAAS,OAAa;AAClC,aAAO;IACX;AAFA,YAAA,WAAA;;;;;;;;;ACCA,QAAA,gBAAA;AACA,QAAA,cAAA;AAIA,aAAgB,cAAc,SAAwB;AACpD,cAAQ,QAAQ,QAAQ;QACtB,KAAK;AACH,iBAAO,cAAA;QAET,KAAK;QACL;AACE,iBAAO,YAAA;;IAEb;AATA,YAAA,gBAAA;;;;;;;;;ACJA,QAAA,mBAAA;AAEA,QAAA;;MAAA,WAAA;AAEE,iBAAAA,OAAoB,SAAwB;AAAxB,eAAA,UAAA;AADV,eAAA,UAAU;QAC2B;AAExC,QAAAA,OAAA,UAAA,QAAP,WAAA;AAAA,cAAA,QAAA;AACE,iBAAO,IAAI,QAAQ,SAAA,SAAO;AAAI,mBAAA,WAAW,SAAS,MAAK,a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AAA;AAAA,EAUA,MAAM,yBACJ,WACA,KACA,SACe;AACf,WAAO,KAAK,SAAS,kBAAkB,WAAW,KAAK,OAAO;AAAA,EAChE;AACF;",
3
+ "sources": ["../../node_modules/exponential-backoff/src/options.ts", "../../node_modules/exponential-backoff/src/jitter/full/full.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/no/no.jitter.ts", "../../node_modules/exponential-backoff/src/jitter/jitter.factory.ts", "../../node_modules/exponential-backoff/src/delay/delay.base.ts", "../../node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts", "../../node_modules/exponential-backoff/src/delay/always/always.delay.ts", "../../node_modules/exponential-backoff/src/delay/delay.factory.ts", "../../node_modules/exponential-backoff/src/backoff.ts", "../../src/ari-client/ariClient.ts", "../../src/ari-client/baseClient.ts", "../../src/ari-client/resources/applications.ts", "../../src/ari-client/resources/channels.ts", "../../src/ari-client/resources/endpoints.ts", "../../src/ari-client/websocketClient.ts"],
4
+ "sourcesContent": [null, null, null, null, null, null, null, null, null, "import { type IBackOffOptions, backOff } from \"exponential-backoff\";\nimport { BaseClient } from \"./baseClient.js\";\nimport type {\n Application,\n ApplicationDetails,\n} from \"./interfaces/applications.types\";\nimport type { Channel, OriginateRequest } from \"./interfaces/channels.types\";\nimport type {\n Endpoint,\n EndpointDetails,\n} from \"./interfaces/endpoints.types.js\";\nimport type { AriApplication, AriClientConfig } from \"./interfaces/requests.js\";\nimport { Applications } from \"./resources/applications.js\";\nimport { Channels } from \"./resources/channels.js\";\nimport { Endpoints } from \"./resources/endpoints\";\nimport { WebSocketClient } from \"./websocketClient.js\";\n\nexport class AriClient {\n private wsClient: WebSocketClient | null = null;\n private readonly baseClient: BaseClient;\n private isReconnecting = false;\n\n public channels: Channels;\n public endpoints: Endpoints;\n public applications: Applications;\n\n constructor(private config: AriClientConfig) {\n const httpProtocol = config.secure ? \"https\" : \"http\";\n const normalizedHost = config.host.replace(/^https?:\\/\\//, \"\");\n const baseUrl = `${httpProtocol}://${normalizedHost}:${config.port}/ari`;\n\n this.baseClient = new BaseClient(baseUrl, config.username, config.password);\n this.channels = new Channels(this.baseClient);\n this.endpoints = new Endpoints(this.baseClient);\n this.applications = new Applications(this.baseClient);\n }\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 if (this.isReconnecting) {\n console.warn(\"Already attempting to reconnect. Skipping this attempt.\");\n return;\n }\n\n this.isReconnecting = true;\n\n const protocol = this.config.secure ? \"wss\" : \"ws\";\n const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${\n this.config.host\n }:${this.config.port}/ari/events?app=${app}`;\n\n const backoffOptions: IBackOffOptions = {\n delayFirstAttempt: false,\n startingDelay: 1000,\n timeMultiple: 2,\n maxDelay: 30000,\n numOfAttempts: 10,\n jitter: \"full\",\n retry: (error: any, attemptNumber: number) => {\n console.warn(`Tentativa ${attemptNumber} falhou: ${error.message}`);\n return !this.wsClient?.isConnected();\n },\n };\n\n this.wsClient = new WebSocketClient(wsUrl);\n\n try {\n await backOff(async () => {\n if (!this.wsClient) {\n throw new Error(\"WebSocketClient instance is null.\");\n }\n await this.wsClient.connect();\n console.log(`WebSocket conectado para o app: ${app}`);\n await this.ensureAppRegistered(app); // Verifica e registra o aplicativo\n }, backoffOptions);\n } catch (err) {\n console.error(\n \"N\u00E3o foi poss\u00EDvel conectar ao WebSocket ap\u00F3s m\u00FAltiplas tentativas:\",\n err,\n );\n throw err;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Ensures the ARI application is registered.\n *\n * @param app - The application name to ensure is registered.\n * @returns {Promise<void>}\n */\n async ensureAppRegistered(app: string): Promise<void> {\n try {\n const apps = await this.baseClient.get<AriApplication[]>(\"/applications\");\n const appExists = apps.some((a: { name: string }) => a.name === app);\n\n if (!appExists) {\n console.log(`Registrando o aplicativo ARI: ${app}`);\n await this.baseClient.post(\"/applications\", { app });\n console.log(`Aplicativo ${app} registrado com sucesso.`);\n } else {\n console.log(`Aplicativo ${app} j\u00E1 est\u00E1 registrado.`);\n }\n } catch (error) {\n console.error(`Erro ao garantir o registro do aplicativo ${app}:`, error);\n throw error;\n }\n }\n\n /**\n * Checks if the WebSocket connection is active.\n *\n * @returns {boolean} True if connected, false otherwise.\n */\n isWebSocketConnected(): boolean {\n return this.wsClient ? this.wsClient.isConnected() : false;\n }\n\n /**\n * Registers a callback 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 * Retrieves a list of active channels from the Asterisk ARI.\n *\n * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.\n */\n async listChannels(): Promise<Channel[]> {\n return this.channels.list();\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<Channel>} A promise resolving to the new channel's details.\n */\n async originateChannel(data: OriginateRequest): Promise<Channel> {\n return this.channels.originate(data);\n }\n\n /**\n * Retrieves details of a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @returns {Promise<Channel>} A promise resolving to the details of the channel.\n */\n async getChannelDetails(channelId: string): Promise<Channel> {\n return this.channels.getDetails(channelId);\n }\n\n /**\n * Hangs up a specific channel.\n *\n * @param channelId - The unique identifier of the channel to hang up.\n * @returns {Promise<void>}\n */\n async hangupChannel(channelId: string): Promise<void> {\n return this.channels.hangup(channelId);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n *\n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns {Promise<void>}\n */\n async continueChannelDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.channels.continueDialplan(\n channelId,\n context,\n extension,\n priority,\n label,\n );\n }\n\n /**\n * Moves a channel to another Stasis application.\n *\n * @param channelId - The unique identifier of the channel.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional arguments for the Stasis application.\n * @returns {Promise<void>}\n */\n async moveChannelToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.channels.moveToApplication(channelId, app, appArgs);\n }\n\n // M\u00E9todos relacionados a endpoints:\n\n /**\n * Lists all endpoints.\n *\n * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.\n */\n async listEndpoints(): Promise<Endpoint[]> {\n return this.endpoints.list();\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.\n */\n async getEndpointDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.endpoints.getDetails(technology, resource);\n }\n\n /**\n * Sends a message to an endpoint.\n *\n * @param technology - The technology of the endpoint.\n * @param resource - The resource name of the endpoint.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent.\n */\n async sendMessageToEndpoint(\n technology: string,\n resource: string,\n body: any,\n ): Promise<void> {\n return this.endpoints.sendMessage(technology, resource, body);\n }\n\n // M\u00E9todos relacionados a applications\n /**\n * Lists all applications.\n *\n * @returns {Promise<Application[]>} A promise resolving to the list of applications.\n */\n async listApplications(): Promise<Application[]> {\n return this.applications.list();\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The name of the application.\n * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.\n */\n async getApplicationDetails(appName: string): Promise<ApplicationDetails> {\n return this.applications.getDetails(appName);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The name of the application.\n * @param body - The message body to send.\n * @returns {Promise<void>} A promise resolving when the message is sent successfully.\n */\n async sendMessageToApplication(appName: string, body: any): Promise<void> {\n return this.applications.sendMessage(appName, body);\n }\n}\n", "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 Application,\n ApplicationDetails,\n} from \"../interfaces/applications.types.js\";\n\nexport class Applications {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all applications.\n *\n * @returns A promise that resolves to an array of Application objects representing all registered applications.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Application[]> {\n const applications = await this.client.get<unknown>(\"/applications\");\n\n if (!Array.isArray(applications)) {\n throw new Error(\"Resposta da API /applications n\u00E3o \u00E9 um array.\");\n }\n\n return applications as Application[];\n }\n\n /**\n * Retrieves details of a specific application.\n *\n * @param appName - The unique name of the application.\n * @returns A promise that resolves to an ApplicationDetails object containing the details of the specified application.\n */\n async getDetails(appName: string): Promise<ApplicationDetails> {\n return this.client.get<ApplicationDetails>(`/applications/${appName}`);\n }\n\n /**\n * Sends a message to a specific application.\n *\n * @param appName - The unique name of the application.\n * @param body - The message body to send.\n * @returns A promise that resolves when the message is sent successfully.\n */\n async sendMessage(appName: string, body: any): Promise<void> {\n await this.client.post<void>(`/applications/${appName}/messages`, body);\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 /**\n * Lists all active channels.\n * \n * @returns A promise that resolves to an array of Channel objects representing all active channels.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Channel[]> {\n const channels = await this.client.get<unknown>(\"/channels\");\n\n if (!Array.isArray(channels)) {\n throw new Error(\"Resposta da API /channels n\u00E3o \u00E9 um array.\");\n }\n\n return channels as Channel[];\n }\n\n /**\n * Creates a new channel.\n * \n * @param data - The OriginateRequest object containing the necessary data to create a new channel.\n * @returns A promise that resolves to a Channel object representing the newly created channel.\n */\n async originate(data: OriginateRequest): Promise<Channel> {\n return this.client.post<Channel>(\"/channels\", data);\n }\n\n /**\n * Retrieves details of a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @returns A promise that resolves to a Channel object containing the details of the specified channel.\n */\n async getDetails(channelId: string): Promise<Channel> {\n return this.client.get<Channel>(`/channels/${channelId}`);\n }\n\n /**\n * Hangs up (terminates) a specific channel.\n * \n * @param channelId - The unique identifier of the channel to be hung up.\n * @returns A promise that resolves when the channel has been successfully hung up.\n */\n async hangup(channelId: string): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/hangup`);\n }\n\n /**\n * Continues the dialplan for a specific channel.\n * \n * @param channelId - The unique identifier of the channel.\n * @param context - Optional. The context to continue in the dialplan.\n * @param extension - Optional. The extension to continue in the dialplan.\n * @param priority - Optional. The priority to continue in the dialplan.\n * @param label - Optional. The label to continue in the dialplan.\n * @returns A promise that resolves when the dialplan continuation has been successfully initiated.\n */\n async continueDialplan(\n channelId: string,\n context?: string,\n extension?: string,\n priority?: number,\n label?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/continue`, {\n context,\n extension,\n priority,\n label,\n });\n }\n\n /**\n * Moves the channel to another Stasis application.\n * \n * @param channelId - The unique identifier of the channel to be moved.\n * @param app - The name of the Stasis application to move the channel to.\n * @param appArgs - Optional. Arguments to be passed to the Stasis application.\n * @returns A promise that resolves when the channel has been successfully moved to the new application.\n */\n async moveToApplication(\n channelId: string,\n app: string,\n appArgs?: string,\n ): Promise<void> {\n return this.client.post<void>(`/channels/${channelId}/move`, {\n app,\n appArgs,\n });\n }\n}\n", "import type { BaseClient } from \"../baseClient.js\";\nimport type { Endpoint, EndpointDetails } from \"../interfaces/endpoints.types\";\n\nexport class Endpoints {\n constructor(private client: BaseClient) {}\n\n /**\n * Lists all available endpoints.\n *\n * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.\n * @throws {Error} If the API response is not an array.\n */\n async list(): Promise<Endpoint[]> {\n const endpoints = await this.client.get<unknown>(\"/endpoints\");\n\n if (!Array.isArray(endpoints)) {\n throw new Error(\"Resposta da API /endpoints n\u00E3o \u00E9 um array.\");\n }\n\n return endpoints as Endpoint[];\n }\n\n /**\n * Retrieves details of a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.\n */\n async getDetails(\n technology: string,\n resource: string,\n ): Promise<EndpointDetails> {\n return this.client.get<EndpointDetails>(\n `/endpoints/${technology}/${resource}`,\n );\n }\n\n /**\n * Sends a message to a specific endpoint.\n *\n * @param technology - The technology of the endpoint (e.g., \"PJSIP\").\n * @param resource - The specific resource name of the endpoint (e.g., \"9001\").\n * @param message - The message payload to send to the endpoint.\n * @returns A promise that resolves when the message has been successfully sent.\n */\n async sendMessage(\n technology: string,\n resource: string,\n message: Record<string, unknown>,\n ): Promise<void> {\n await this.client.post<void>(\n `/endpoints/${technology}/${resource}/sendMessage`,\n message,\n );\n }\n}\n", "import 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 private isReconnecting = false; // Para evitar reconex\u00F5es paralelas\n\n constructor(private url: string) {}\n\n async connect(): Promise<void> {\n if (this.isReconnecting) return; // Evita m\u00FAltiplas reconex\u00F5es simult\u00E2neas\n\n return new Promise((resolve, reject) => {\n this.ws = new WebSocket(this.url);\n\n this.ws.on(\"open\", () => {\n console.log(\"WebSocket conectado.\");\n this.isClosedManually = false;\n this.isReconnecting = false;\n resolve();\n });\n\n this.ws.on(\"error\", (err) => {\n console.error(\"Erro na conex\u00E3o WebSocket:\", err);\n reject(err);\n });\n\n this.ws.on(\"close\", (code, reason) => {\n console.warn(`WebSocket desconectado: ${code} - ${reason}`);\n this.isReconnecting = false; // Libera novas reconex\u00F5es\n });\n });\n }\n\n async reconnect(): Promise<void> {\n if (this.isClosedManually || this.isReconnecting) return;\n\n console.log(\"Tentando reconectar ao WebSocket...\");\n this.isReconnecting = true;\n try {\n await this.connect();\n console.log(\"Reconex\u00E3o bem-sucedida.\");\n } catch (err) {\n console.error(\"Erro ao tentar reconectar:\", err);\n } finally {\n this.isReconnecting = false;\n }\n }\n\n isConnected(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n\n on(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 if (event === \"message\") {\n this.ws.on(event, (data) => {\n try {\n const decodedData = JSON.parse(data.toString());\n callback(decodedData); // Retorna o JSON j\u00E1 decodificado\n } catch (err) {\n console.error(\"Erro ao decodificar mensagem do WebSocket:\", err);\n callback(data); // Retorna o buffer original em caso de erro\n }\n });\n } else {\n this.ws.on(event, callback);\n }\n }\n\n send(data: any): void {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket n\u00E3o est\u00E1 conectado.\");\n }\n\n this.ws.send(data, (err) => {\n if (err) {\n console.error(\"Erro ao enviar dados pelo WebSocket:\", err);\n }\n });\n }\n\n close(): void {\n if (this.ws) {\n this.isClosedManually = true;\n this.ws.close();\n console.log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B,WAAW,KAAK,OAAO;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAqC;AACzC,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,mBACJ,YACA,UAC0B;AAC1B,WAAO,KAAK,UAAU,WAAW,YAAY,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,sBACJ,YACA,UACA,MACe;AACf,WAAO,KAAK,UAAU,YAAY,YAAY,UAAU,IAAI;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAA2C;AAC/C,WAAO,KAAK,aAAa,KAAK;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,sBAAsB,SAA8C;AACxE,WAAO,KAAK,aAAa,WAAW,OAAO;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,yBAAyB,SAAiB,MAA0B;AACxE,WAAO,KAAK,aAAa,YAAY,SAAS,IAAI;AAAA,EACpD;AACF;",
6
6
  "names": ["Delay", "SkipFirstDelay", "AlwaysDelay", "backOff", "BackOff"]
7
7
  }
@@ -1,12 +1,18 @@
1
+ import type { Application, ApplicationDetails } from "./interfaces/applications.types";
1
2
  import type { Channel, OriginateRequest } from "./interfaces/channels.types";
3
+ import type { Endpoint, EndpointDetails } from "./interfaces/endpoints.types.js";
2
4
  import type { AriClientConfig } from "./interfaces/requests.js";
5
+ import { Applications } from "./resources/applications.js";
3
6
  import { Channels } from "./resources/channels.js";
7
+ import { Endpoints } from "./resources/endpoints";
4
8
  export declare class AriClient {
5
9
  private config;
6
10
  private wsClient;
7
11
  private readonly baseClient;
8
12
  private isReconnecting;
9
13
  channels: Channels;
14
+ endpoints: Endpoints;
15
+ applications: Applications;
10
16
  constructor(config: AriClientConfig);
11
17
  /**
12
18
  * Connects to the ARI WebSocket for a specific application.
@@ -86,5 +92,49 @@ export declare class AriClient {
86
92
  * @returns {Promise<void>}
87
93
  */
88
94
  moveChannelToApplication(channelId: string, app: string, appArgs?: string): Promise<void>;
95
+ /**
96
+ * Lists all endpoints.
97
+ *
98
+ * @returns {Promise<Endpoint[]>} A promise resolving to the list of endpoints.
99
+ */
100
+ listEndpoints(): Promise<Endpoint[]>;
101
+ /**
102
+ * Retrieves details of a specific endpoint.
103
+ *
104
+ * @param technology - The technology of the endpoint.
105
+ * @param resource - The resource name of the endpoint.
106
+ * @returns {Promise<EndpointDetails>} A promise resolving to the details of the endpoint.
107
+ */
108
+ getEndpointDetails(technology: string, resource: string): Promise<EndpointDetails>;
109
+ /**
110
+ * Sends a message to an endpoint.
111
+ *
112
+ * @param technology - The technology of the endpoint.
113
+ * @param resource - The resource name of the endpoint.
114
+ * @param body - The message body to send.
115
+ * @returns {Promise<void>} A promise resolving when the message is sent.
116
+ */
117
+ sendMessageToEndpoint(technology: string, resource: string, body: any): Promise<void>;
118
+ /**
119
+ * Lists all applications.
120
+ *
121
+ * @returns {Promise<Application[]>} A promise resolving to the list of applications.
122
+ */
123
+ listApplications(): Promise<Application[]>;
124
+ /**
125
+ * Retrieves details of a specific application.
126
+ *
127
+ * @param appName - The name of the application.
128
+ * @returns {Promise<ApplicationDetails>} A promise resolving to the application details.
129
+ */
130
+ getApplicationDetails(appName: string): Promise<ApplicationDetails>;
131
+ /**
132
+ * Sends a message to a specific application.
133
+ *
134
+ * @param appName - The name of the application.
135
+ * @param body - The message body to send.
136
+ * @returns {Promise<void>} A promise resolving when the message is sent successfully.
137
+ */
138
+ sendMessageToApplication(appName: string, body: any): Promise<void>;
89
139
  }
90
140
  //# sourceMappingURL=ariClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ariClient.d.ts","sourceRoot":"","sources":["../../../src/ari-client/ariClient.ts"],"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EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIzE;;;;;;OAMG;IACG,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1E"}
@@ -0,0 +1,10 @@
1
+ export interface Application {
2
+ name: string;
3
+ description?: string;
4
+ }
5
+ export interface ApplicationDetails {
6
+ name: string;
7
+ description?: string;
8
+ subscribedEvents?: string[];
9
+ }
10
+ //# sourceMappingURL=applications.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applications.types.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/applications.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Represents a basic endpoint.
3
+ */
4
+ export interface Endpoint {
5
+ technology: string;
6
+ resource: string;
7
+ state: string;
8
+ }
9
+ /**
10
+ * Represents detailed information about an endpoint.
11
+ */
12
+ export interface EndpointDetails {
13
+ technology: string;
14
+ resource: string;
15
+ state: string;
16
+ channel_ids: string[];
17
+ variables?: Record<string, string>;
18
+ }
19
+ //# sourceMappingURL=endpoints.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.types.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/interfaces/endpoints.types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC"}
@@ -1 +1,29 @@
1
+ import type { BaseClient } from "../baseClient.js";
2
+ import type { Application, ApplicationDetails } from "../interfaces/applications.types.js";
3
+ export declare class Applications {
4
+ private client;
5
+ constructor(client: BaseClient);
6
+ /**
7
+ * Lists all applications.
8
+ *
9
+ * @returns A promise that resolves to an array of Application objects representing all registered applications.
10
+ * @throws {Error} If the API response is not an array.
11
+ */
12
+ list(): Promise<Application[]>;
13
+ /**
14
+ * Retrieves details of a specific application.
15
+ *
16
+ * @param appName - The unique name of the application.
17
+ * @returns A promise that resolves to an ApplicationDetails object containing the details of the specified application.
18
+ */
19
+ getDetails(appName: string): Promise<ApplicationDetails>;
20
+ /**
21
+ * Sends a message to a specific application.
22
+ *
23
+ * @param appName - The unique name of the application.
24
+ * @param body - The message body to send.
25
+ * @returns A promise that resolves when the message is sent successfully.
26
+ */
27
+ sendMessage(appName: string, body: any): Promise<void>;
28
+ }
1
29
  //# sourceMappingURL=applications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/applications.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/applications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,qCAAqC,CAAC;AAE7C,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAUpC;;;;;OAKG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI9D;;;;;;OAMG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7D"}
@@ -1 +1,31 @@
1
+ import type { BaseClient } from "../baseClient.js";
2
+ import type { Endpoint, EndpointDetails } from "../interfaces/endpoints.types";
3
+ export declare class Endpoints {
4
+ private client;
5
+ constructor(client: BaseClient);
6
+ /**
7
+ * Lists all available endpoints.
8
+ *
9
+ * @returns A promise that resolves to an array of Endpoint objects representing all available endpoints.
10
+ * @throws {Error} If the API response is not an array.
11
+ */
12
+ list(): Promise<Endpoint[]>;
13
+ /**
14
+ * Retrieves details of a specific endpoint.
15
+ *
16
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
17
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
18
+ * @returns A promise that resolves to an EndpointDetails object containing the details of the specified endpoint.
19
+ */
20
+ getDetails(technology: string, resource: string): Promise<EndpointDetails>;
21
+ /**
22
+ * Sends a message to a specific endpoint.
23
+ *
24
+ * @param technology - The technology of the endpoint (e.g., "PJSIP").
25
+ * @param resource - The specific resource name of the endpoint (e.g., "9001").
26
+ * @param message - The message payload to send to the endpoint.
27
+ * @returns A promise that resolves when the message has been successfully sent.
28
+ */
29
+ sendMessage(technology: string, resource: string, message: Record<string, unknown>): Promise<void>;
30
+ }
1
31
  //# sourceMappingURL=endpoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/endpoints.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE/E,qBAAa,SAAS;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUjC;;;;;;OAMG;IACG,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC;IAM3B;;;;;;;OAOG;IACG,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;CAMjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipcom/asterisk-ari",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "description": "JavaScript client for Asterisk REST Interface.",
6
6
  "homepage": "https://github.com/fabiotheo/ipcom-asterisk-ari",