@ipcom/asterisk-ari 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +204 -49
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/esm/index.js +203 -49
- package/dist/esm/index.js.map +2 -2
- package/dist/types/ari-client/ariClient.d.ts +172 -33
- package/dist/types/ari-client/ariClient.d.ts.map +1 -1
- package/dist/types/ari-client/interfaces/applications.types.d.ts +3 -4
- package/dist/types/ari-client/interfaces/applications.types.d.ts.map +1 -1
- package/dist/types/ari-client/interfaces/events.types.d.ts +58 -0
- package/dist/types/ari-client/interfaces/events.types.d.ts.map +1 -0
- package/dist/types/ari-client/interfaces/index.d.ts +1 -0
- package/dist/types/ari-client/interfaces/index.d.ts.map +1 -1
- package/dist/types/ari-client/resources/applications.d.ts +12 -7
- package/dist/types/ari-client/resources/applications.d.ts.map +1 -1
- package/dist/types/ari-client/websocketClient.d.ts +4 -1
- package/dist/types/ari-client/websocketClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -581,6 +581,7 @@ var src_exports = {};
|
|
|
581
581
|
__export(src_exports, {
|
|
582
582
|
Applications: () => Applications,
|
|
583
583
|
AriClient: () => AriClient,
|
|
584
|
+
Asterisk: () => Asterisk,
|
|
584
585
|
Channels: () => Channels,
|
|
585
586
|
Endpoints: () => Endpoints,
|
|
586
587
|
Playbacks: () => Playbacks,
|
|
@@ -644,8 +645,8 @@ var Applications = class {
|
|
|
644
645
|
}
|
|
645
646
|
/**
|
|
646
647
|
* Lists all applications.
|
|
647
|
-
*
|
|
648
|
-
* @returns A promise that resolves to an array of Application objects
|
|
648
|
+
*
|
|
649
|
+
* @returns A promise that resolves to an array of Application objects.
|
|
649
650
|
* @throws {Error} If the API response is not an array.
|
|
650
651
|
*/
|
|
651
652
|
async list() {
|
|
@@ -657,19 +658,27 @@ var Applications = class {
|
|
|
657
658
|
}
|
|
658
659
|
/**
|
|
659
660
|
* Retrieves details of a specific application.
|
|
660
|
-
*
|
|
661
|
-
* @param appName - The
|
|
662
|
-
* @returns A promise that resolves to an ApplicationDetails object
|
|
661
|
+
*
|
|
662
|
+
* @param appName - The name of the application to retrieve details for.
|
|
663
|
+
* @returns A promise that resolves to an ApplicationDetails object.
|
|
664
|
+
* @throws {Error} If there's an error fetching the application details.
|
|
663
665
|
*/
|
|
664
666
|
async getDetails(appName) {
|
|
665
|
-
|
|
667
|
+
try {
|
|
668
|
+
return await this.client.get(
|
|
669
|
+
`/applications/${appName}`
|
|
670
|
+
);
|
|
671
|
+
} catch (error) {
|
|
672
|
+
console.error(`Erro ao obter detalhes do aplicativo ${appName}:`, error);
|
|
673
|
+
throw error;
|
|
674
|
+
}
|
|
666
675
|
}
|
|
667
676
|
/**
|
|
668
677
|
* Sends a message to a specific application.
|
|
669
|
-
*
|
|
670
|
-
* @param appName - The
|
|
671
|
-
* @param body - The message
|
|
672
|
-
* @returns A promise that resolves when the message is sent
|
|
678
|
+
*
|
|
679
|
+
* @param appName - The name of the application to send the message to.
|
|
680
|
+
* @param body - The message to be sent, containing an event and optional data.
|
|
681
|
+
* @returns A promise that resolves when the message is successfully sent.
|
|
673
682
|
*/
|
|
674
683
|
async sendMessage(appName, body) {
|
|
675
684
|
await this.client.post(`/applications/${appName}/messages`, body);
|
|
@@ -1206,13 +1215,17 @@ var WebSocketClient = class {
|
|
|
1206
1215
|
throw new Error("WebSocket n\xE3o est\xE1 conectado.");
|
|
1207
1216
|
}
|
|
1208
1217
|
if (event === "message") {
|
|
1209
|
-
this.ws.on(event, (
|
|
1218
|
+
this.ws.on(event, (rawData) => {
|
|
1210
1219
|
try {
|
|
1211
|
-
const decodedData = JSON.parse(
|
|
1212
|
-
|
|
1220
|
+
const decodedData = JSON.parse(rawData.toString());
|
|
1221
|
+
if (decodedData?.type) {
|
|
1222
|
+
const matchedEvent = decodedData;
|
|
1223
|
+
callback(matchedEvent);
|
|
1224
|
+
} else {
|
|
1225
|
+
console.warn("Mensagem sem tipo:", decodedData);
|
|
1226
|
+
}
|
|
1213
1227
|
} catch (err) {
|
|
1214
1228
|
console.error("Erro ao decodificar mensagem do WebSocket:", err);
|
|
1215
|
-
callback(data);
|
|
1216
1229
|
}
|
|
1217
1230
|
});
|
|
1218
1231
|
} else {
|
|
@@ -1268,7 +1281,7 @@ var AriClient = class {
|
|
|
1268
1281
|
* @param app - The application name to connect to.
|
|
1269
1282
|
* @returns {Promise<void>} Resolves when the WebSocket connects successfully.
|
|
1270
1283
|
*/
|
|
1271
|
-
async connectWebSocket(app) {
|
|
1284
|
+
async connectWebSocket(app, subscribedEvents) {
|
|
1272
1285
|
if (!app) {
|
|
1273
1286
|
throw new Error(
|
|
1274
1287
|
"The 'app' parameter is required to connect to the WebSocket."
|
|
@@ -1279,8 +1292,9 @@ var AriClient = class {
|
|
|
1279
1292
|
return;
|
|
1280
1293
|
}
|
|
1281
1294
|
this.isReconnecting = true;
|
|
1295
|
+
const eventsParam = subscribedEvents && subscribedEvents.length > 0 ? `&event=${subscribedEvents.join(",")}` : "&subscribeAll=true";
|
|
1282
1296
|
const protocol = this.config.secure ? "wss" : "ws";
|
|
1283
|
-
const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${this.config.host}:${this.config.port}/ari/events?app=${app}`;
|
|
1297
|
+
const wsUrl = `${protocol}://${encodeURIComponent(this.config.username)}:${encodeURIComponent(this.config.password)}@${this.config.host}:${this.config.port}/ari/events?app=${app}${eventsParam}`;
|
|
1284
1298
|
const backoffOptions = {
|
|
1285
1299
|
delayFirstAttempt: false,
|
|
1286
1300
|
startingDelay: 1e3,
|
|
@@ -1344,16 +1358,22 @@ var AriClient = class {
|
|
|
1344
1358
|
return this.wsClient ? this.wsClient.isConnected() : false;
|
|
1345
1359
|
}
|
|
1346
1360
|
/**
|
|
1347
|
-
* Registers a callback for
|
|
1361
|
+
* Registers a callback function for WebSocket events.
|
|
1362
|
+
* This method allows you to listen for and respond to WebSocket messages
|
|
1363
|
+
* and process specific event types.
|
|
1348
1364
|
*
|
|
1349
|
-
* @param
|
|
1350
|
-
*
|
|
1365
|
+
* @param callback - The callback function to execute when a WebSocket message is received.
|
|
1366
|
+
* The function will receive the parsed event data as its parameter.
|
|
1367
|
+
* @throws {Error} Throws an error if the WebSocket is not connected when trying to register the event.
|
|
1368
|
+
* @returns {void}
|
|
1351
1369
|
*/
|
|
1352
|
-
onWebSocketEvent(
|
|
1370
|
+
onWebSocketEvent(callback) {
|
|
1353
1371
|
if (!this.wsClient) {
|
|
1354
1372
|
throw new Error("WebSocket is not connected.");
|
|
1355
1373
|
}
|
|
1356
|
-
this.wsClient.on(
|
|
1374
|
+
this.wsClient.on("message", (data) => {
|
|
1375
|
+
callback(data);
|
|
1376
|
+
});
|
|
1357
1377
|
}
|
|
1358
1378
|
/**
|
|
1359
1379
|
* Closes the WebSocket connection.
|
|
@@ -1496,7 +1516,14 @@ var AriClient = class {
|
|
|
1496
1516
|
return this.channels.snoopChannelWithId(channelId, snoopId, options);
|
|
1497
1517
|
}
|
|
1498
1518
|
/**
|
|
1499
|
-
*
|
|
1519
|
+
* Initiates a dial operation on a previously created channel.
|
|
1520
|
+
* This function attempts to connect the specified channel to its configured destination.
|
|
1521
|
+
*
|
|
1522
|
+
* @param channelId - The unique identifier of the channel to dial.
|
|
1523
|
+
* @param caller - Optional. The caller ID to use for the outgoing call. If not provided, the default caller ID for the channel will be used.
|
|
1524
|
+
* @param timeout - Optional. The maximum time in seconds to wait for the dial operation to complete. If not specified, the system's default timeout will be used.
|
|
1525
|
+
* @returns A Promise that resolves when the dial operation has been initiated successfully. Note that this does not guarantee that the call was answered, only that dialing has begun.
|
|
1526
|
+
* @throws Will throw an error if the dial operation fails, e.g., if the channel doesn't exist or is in an invalid state.
|
|
1500
1527
|
*/
|
|
1501
1528
|
async dialChannel(channelId, caller, timeout) {
|
|
1502
1529
|
return this.channels.dial(channelId, caller, timeout);
|
|
@@ -1532,46 +1559,139 @@ var AriClient = class {
|
|
|
1532
1559
|
return this.channels.ringChannel(channelId);
|
|
1533
1560
|
}
|
|
1534
1561
|
/**
|
|
1535
|
-
* Stops ringing indication on a channel.
|
|
1562
|
+
* Stops the ringing indication on a specified channel in the Asterisk system.
|
|
1563
|
+
*
|
|
1564
|
+
* This function sends a request to the Asterisk server to cease the ringing
|
|
1565
|
+
* indication on a particular channel. This is typically used when you want to
|
|
1566
|
+
* stop the ringing sound on a channel without answering or hanging up the call.
|
|
1567
|
+
*
|
|
1568
|
+
* @param channelId - The unique identifier of the channel on which to stop the ringing.
|
|
1569
|
+
* This should be a string that uniquely identifies the channel in the Asterisk system.
|
|
1570
|
+
*
|
|
1571
|
+
* @returns A Promise that resolves when the ringing has been successfully stopped on the specified channel.
|
|
1572
|
+
* The promise resolves to void, indicating no specific return value.
|
|
1573
|
+
* If an error occurs during the operation, the promise will be rejected with an error object.
|
|
1536
1574
|
*/
|
|
1537
1575
|
async stopRingChannel(channelId) {
|
|
1538
1576
|
return this.channels.stopRingChannel(channelId);
|
|
1539
1577
|
}
|
|
1540
1578
|
/**
|
|
1541
|
-
* Sends DTMF to a channel.
|
|
1579
|
+
* Sends DTMF (Dual-Tone Multi-Frequency) tones to a specified channel.
|
|
1580
|
+
*
|
|
1581
|
+
* This function allows sending DTMF tones to a channel, which can be used for various purposes
|
|
1582
|
+
* such as interacting with IVR systems or sending signals during a call.
|
|
1583
|
+
*
|
|
1584
|
+
* @param channelId - The unique identifier of the channel to send DTMF tones to.
|
|
1585
|
+
* @param dtmf - A string representing the DTMF tones to send (e.g., "123#").
|
|
1586
|
+
* @param options - Optional parameters to control the timing of DTMF tones.
|
|
1587
|
+
* @param options.before - The time (in milliseconds) to wait before sending DTMF.
|
|
1588
|
+
* @param options.between - The time (in milliseconds) to wait between each DTMF tone.
|
|
1589
|
+
* @param options.duration - The duration (in milliseconds) of each DTMF tone.
|
|
1590
|
+
* @param options.after - The time (in milliseconds) to wait after sending all DTMF tones.
|
|
1591
|
+
* @returns A Promise that resolves when the DTMF tones have been successfully sent.
|
|
1542
1592
|
*/
|
|
1543
1593
|
async sendDTMF(channelId, dtmf, options) {
|
|
1544
1594
|
return this.channels.sendDTMF(channelId, dtmf, options);
|
|
1545
1595
|
}
|
|
1546
1596
|
/**
|
|
1547
|
-
* Mutes a channel.
|
|
1597
|
+
* Mutes a channel in the Asterisk system.
|
|
1598
|
+
*
|
|
1599
|
+
* This function initiates a mute operation on the specified channel, preventing
|
|
1600
|
+
* audio transmission in the specified direction(s).
|
|
1601
|
+
*
|
|
1602
|
+
* @param channelId - The unique identifier of the channel to be muted.
|
|
1603
|
+
* This should be a string that uniquely identifies the channel in the Asterisk system.
|
|
1604
|
+
* @param direction - The direction of audio to mute. Can be one of:
|
|
1605
|
+
* - "both": Mute both incoming and outgoing audio (default)
|
|
1606
|
+
* - "in": Mute only incoming audio
|
|
1607
|
+
* - "out": Mute only outgoing audio
|
|
1608
|
+
*
|
|
1609
|
+
* @returns A Promise that resolves when the mute operation has been successfully completed.
|
|
1610
|
+
* The promise resolves to void, indicating no specific return value.
|
|
1611
|
+
* If an error occurs during the operation, the promise will be rejected with an error object.
|
|
1548
1612
|
*/
|
|
1549
1613
|
async muteChannel(channelId, direction = "both") {
|
|
1550
1614
|
return this.channels.muteChannel(channelId, direction);
|
|
1551
1615
|
}
|
|
1552
1616
|
/**
|
|
1553
|
-
* Unmutes a channel.
|
|
1617
|
+
* Unmutes a channel in the Asterisk system.
|
|
1618
|
+
*
|
|
1619
|
+
* This function removes the mute status from a specified channel, allowing audio
|
|
1620
|
+
* transmission to resume in the specified direction(s).
|
|
1621
|
+
*
|
|
1622
|
+
* @param channelId - The unique identifier of the channel to be unmuted.
|
|
1623
|
+
* This should be a string that uniquely identifies the channel in the Asterisk system.
|
|
1624
|
+
* @param direction - The direction of audio to unmute. Can be one of:
|
|
1625
|
+
* - "both": Unmute both incoming and outgoing audio (default)
|
|
1626
|
+
* - "in": Unmute only incoming audio
|
|
1627
|
+
* - "out": Unmute only outgoing audio
|
|
1628
|
+
*
|
|
1629
|
+
* @returns A Promise that resolves when the unmute operation has been successfully completed.
|
|
1630
|
+
* The promise resolves to void, indicating no specific return value.
|
|
1631
|
+
* If an error occurs during the operation, the promise will be rejected with an error object.
|
|
1554
1632
|
*/
|
|
1555
1633
|
async unmuteChannel(channelId, direction = "both") {
|
|
1556
1634
|
return this.channels.unmuteChannel(channelId, direction);
|
|
1557
1635
|
}
|
|
1558
1636
|
/**
|
|
1559
|
-
* Puts a channel on hold.
|
|
1637
|
+
* Puts a specified channel on hold.
|
|
1638
|
+
*
|
|
1639
|
+
* This function initiates a hold operation on the specified channel in the Asterisk system.
|
|
1640
|
+
* When a channel is put on hold, typically the audio is muted or replaced with hold music,
|
|
1641
|
+
* depending on the system configuration.
|
|
1642
|
+
*
|
|
1643
|
+
* @param channelId - The unique identifier of the channel to be put on hold.
|
|
1644
|
+
* This should be a string that uniquely identifies the channel in the Asterisk system.
|
|
1645
|
+
*
|
|
1646
|
+
* @returns A Promise that resolves when the hold operation has been successfully initiated.
|
|
1647
|
+
* The promise resolves to void, indicating no specific return value.
|
|
1648
|
+
* If an error occurs during the operation, the promise will be rejected with an error object.
|
|
1560
1649
|
*/
|
|
1561
1650
|
async holdChannel(channelId) {
|
|
1562
1651
|
return this.channels.holdChannel(channelId);
|
|
1563
1652
|
}
|
|
1564
1653
|
/**
|
|
1565
|
-
* Removes a channel from hold.
|
|
1654
|
+
* Removes a specified channel from hold.
|
|
1655
|
+
*
|
|
1656
|
+
* This function initiates an unhold operation on the specified channel in the Asterisk system.
|
|
1657
|
+
* When a channel is taken off hold, it typically resumes normal audio transmission,
|
|
1658
|
+
* allowing the parties to continue their conversation.
|
|
1659
|
+
*
|
|
1660
|
+
* @param channelId - The unique identifier of the channel to be taken off hold.
|
|
1661
|
+
* This should be a string that uniquely identifies the channel in the Asterisk system.
|
|
1662
|
+
*
|
|
1663
|
+
* @returns A Promise that resolves when the unhold operation has been successfully initiated.
|
|
1664
|
+
* The promise resolves to void, indicating no specific return value.
|
|
1665
|
+
* If an error occurs during the operation, the promise will be rejected with an error object.
|
|
1566
1666
|
*/
|
|
1567
1667
|
async unholdChannel(channelId) {
|
|
1568
1668
|
return this.channels.unholdChannel(channelId);
|
|
1569
1669
|
}
|
|
1570
1670
|
/**
|
|
1571
|
-
* Creates a new channel using the provided originate request data.
|
|
1671
|
+
* Creates a new channel in the Asterisk system using the provided originate request data.
|
|
1672
|
+
* This function initiates a new communication channel based on the specified parameters.
|
|
1572
1673
|
*
|
|
1573
|
-
* @param data -
|
|
1574
|
-
*
|
|
1674
|
+
* @param data - An object containing the originate request data for channel creation.
|
|
1675
|
+
* This includes details such as the endpoint to call, the context to use,
|
|
1676
|
+
* and any variables to set on the new channel.
|
|
1677
|
+
* @param data.endpoint - The endpoint to call (e.g., "SIP/1234").
|
|
1678
|
+
* @param data.extension - The extension to dial after the channel is created.
|
|
1679
|
+
* @param data.context - The dialplan context to use for the new channel.
|
|
1680
|
+
* @param data.priority - The priority to start at in the dialplan.
|
|
1681
|
+
* @param data.app - The application to execute on the channel (alternative to extension/context/priority).
|
|
1682
|
+
* @param data.appArgs - The arguments to pass to the application, if 'app' is specified.
|
|
1683
|
+
* @param data.callerId - The caller ID to set on the new channel.
|
|
1684
|
+
* @param data.timeout - The timeout (in seconds) to wait for the channel to be answered.
|
|
1685
|
+
* @param data.variables - An object containing key-value pairs of channel variables to set.
|
|
1686
|
+
* @param data.channelId - An optional ID to assign to the new channel.
|
|
1687
|
+
* @param data.otherChannelId - The ID of another channel to bridge with after creation.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns A Promise that resolves to the created Channel object.
|
|
1690
|
+
* The Channel object contains details about the newly created channel,
|
|
1691
|
+
* such as its unique identifier, state, and other relevant information.
|
|
1692
|
+
*
|
|
1693
|
+
* @throws Will throw an error if the channel creation fails for any reason,
|
|
1694
|
+
* such as invalid parameters or system issues.
|
|
1575
1695
|
*/
|
|
1576
1696
|
async createChannel(data) {
|
|
1577
1697
|
return this.channels.createChannel(data);
|
|
@@ -1667,68 +1787,85 @@ var AriClient = class {
|
|
|
1667
1787
|
return this.playbacks.getDetails(playbackId);
|
|
1668
1788
|
}
|
|
1669
1789
|
/**
|
|
1670
|
-
* Controls a specific playback.
|
|
1790
|
+
* Controls a specific playback in the Asterisk server.
|
|
1671
1791
|
*
|
|
1672
|
-
* @param playbackId - The unique identifier of the playback.
|
|
1673
|
-
* @param controlRequest -
|
|
1674
|
-
* @returns
|
|
1792
|
+
* @param playbackId - The unique identifier of the playback to control.
|
|
1793
|
+
* @param controlRequest - An object containing the control operation details.
|
|
1794
|
+
* @returns A Promise that resolves when the control operation is successfully executed.
|
|
1675
1795
|
*/
|
|
1676
1796
|
async controlPlayback(playbackId, controlRequest) {
|
|
1677
1797
|
return this.playbacks.control(playbackId, controlRequest);
|
|
1678
1798
|
}
|
|
1679
1799
|
/**
|
|
1680
|
-
* Stops a specific playback.
|
|
1800
|
+
* Stops a specific playback in the Asterisk server.
|
|
1681
1801
|
*
|
|
1682
|
-
* @param playbackId - The unique identifier of the playback.
|
|
1683
|
-
* @returns
|
|
1802
|
+
* @param playbackId - The unique identifier of the playback to stop.
|
|
1803
|
+
* @returns A Promise that resolves when the playback is successfully stopped.
|
|
1684
1804
|
*/
|
|
1685
1805
|
async stopPlayback(playbackId) {
|
|
1686
1806
|
return this.playbacks.stop(playbackId);
|
|
1687
1807
|
}
|
|
1688
1808
|
/**
|
|
1689
|
-
*
|
|
1809
|
+
* Retrieves a list of all available sounds in the Asterisk server.
|
|
1690
1810
|
*
|
|
1691
1811
|
* @param params - Optional parameters to filter the list of sounds.
|
|
1692
|
-
* @returns
|
|
1812
|
+
* @returns A Promise that resolves to an array of Sound objects representing the available sounds.
|
|
1693
1813
|
*/
|
|
1694
1814
|
async listSounds(params) {
|
|
1695
1815
|
return this.sounds.list(params);
|
|
1696
1816
|
}
|
|
1697
1817
|
/**
|
|
1698
|
-
* Retrieves
|
|
1818
|
+
* Retrieves detailed information about a specific sound in the Asterisk server.
|
|
1699
1819
|
*
|
|
1700
|
-
* @param soundId - The unique identifier of the sound.
|
|
1701
|
-
* @returns
|
|
1820
|
+
* @param soundId - The unique identifier of the sound to retrieve details for.
|
|
1821
|
+
* @returns A Promise that resolves to a Sound object containing the details of the specified sound.
|
|
1702
1822
|
*/
|
|
1703
1823
|
async getSoundDetails(soundId) {
|
|
1704
1824
|
return this.sounds.getDetails(soundId);
|
|
1705
1825
|
}
|
|
1706
1826
|
/**
|
|
1707
|
-
* Retrieves information about the Asterisk server.
|
|
1827
|
+
* Retrieves general information about the Asterisk server.
|
|
1828
|
+
*
|
|
1829
|
+
* @returns A Promise that resolves to an AsteriskInfo object containing server information.
|
|
1708
1830
|
*/
|
|
1709
1831
|
async getAsteriskInfo() {
|
|
1710
1832
|
return this.asterisk.getInfo();
|
|
1711
1833
|
}
|
|
1712
1834
|
/**
|
|
1713
|
-
*
|
|
1835
|
+
* Retrieves a list of all loaded modules in the Asterisk server.
|
|
1836
|
+
*
|
|
1837
|
+
* @returns A Promise that resolves to an array of Module objects representing the loaded modules.
|
|
1714
1838
|
*/
|
|
1715
1839
|
async listModules() {
|
|
1716
1840
|
return this.asterisk.listModules();
|
|
1717
1841
|
}
|
|
1718
1842
|
/**
|
|
1719
|
-
* Manages a specific module in the Asterisk server.
|
|
1843
|
+
* Manages a specific module in the Asterisk server by loading, unloading, or reloading it.
|
|
1844
|
+
*
|
|
1845
|
+
* @param moduleName - The name of the module to manage.
|
|
1846
|
+
* @param action - The action to perform on the module: "load", "unload", or "reload".
|
|
1847
|
+
* @returns A Promise that resolves when the module management action is completed successfully.
|
|
1720
1848
|
*/
|
|
1721
1849
|
async manageModule(moduleName, action) {
|
|
1722
1850
|
return this.asterisk.manageModule(moduleName, action);
|
|
1723
1851
|
}
|
|
1724
1852
|
/**
|
|
1725
|
-
* Retrieves all configured logging channels.
|
|
1853
|
+
* Retrieves a list of all configured logging channels in the Asterisk server.
|
|
1854
|
+
*
|
|
1855
|
+
* @returns A Promise that resolves to an array of Logging objects representing the configured logging channels.
|
|
1726
1856
|
*/
|
|
1727
1857
|
async listLoggingChannels() {
|
|
1728
1858
|
return this.asterisk.listLoggingChannels();
|
|
1729
1859
|
}
|
|
1730
1860
|
/**
|
|
1731
1861
|
* Adds or removes a log channel in the Asterisk server.
|
|
1862
|
+
*
|
|
1863
|
+
* @param logChannelName - The name of the log channel to manage.
|
|
1864
|
+
* @param action - The action to perform: "add" to create a new log channel or "remove" to delete an existing one.
|
|
1865
|
+
* @param configuration - Optional configuration object for adding a log channel. Ignored when removing a channel.
|
|
1866
|
+
* @param configuration.type - The type of the log channel.
|
|
1867
|
+
* @param configuration.configuration - Additional configuration details for the log channel.
|
|
1868
|
+
* @returns A Promise that resolves when the log channel management action is completed successfully.
|
|
1732
1869
|
*/
|
|
1733
1870
|
async manageLogChannel(logChannelName, action, configuration) {
|
|
1734
1871
|
return this.asterisk.manageLogChannel(
|
|
@@ -1738,13 +1875,30 @@ var AriClient = class {
|
|
|
1738
1875
|
);
|
|
1739
1876
|
}
|
|
1740
1877
|
/**
|
|
1741
|
-
* Retrieves the value of a global variable.
|
|
1878
|
+
* Retrieves the value of a global variable from the Asterisk server.
|
|
1879
|
+
*
|
|
1880
|
+
* @param variableName - The name of the global variable to retrieve.
|
|
1881
|
+
* @returns A Promise that resolves to a Variable object containing the name and value of the global variable.
|
|
1742
1882
|
*/
|
|
1743
1883
|
async getGlobalVariable(variableName) {
|
|
1744
1884
|
return this.asterisk.getGlobalVariable(variableName);
|
|
1745
1885
|
}
|
|
1746
1886
|
/**
|
|
1747
|
-
* Sets a global variable.
|
|
1887
|
+
* Sets a global variable in the Asterisk server.
|
|
1888
|
+
*
|
|
1889
|
+
* This function allows you to set or update the value of a global variable
|
|
1890
|
+
* in the Asterisk server. Global variables are accessible throughout the
|
|
1891
|
+
* entire Asterisk system and can be used for various purposes such as
|
|
1892
|
+
* configuration settings or sharing data between different parts of the system.
|
|
1893
|
+
*
|
|
1894
|
+
* @param variableName - The name of the global variable to set or update.
|
|
1895
|
+
* This should be a string identifying the variable uniquely.
|
|
1896
|
+
* @param value - The value to assign to the global variable. This can be any
|
|
1897
|
+
* string value, including empty strings.
|
|
1898
|
+
* @returns A Promise that resolves when the global variable has been successfully
|
|
1899
|
+
* set. The promise resolves to void, indicating no specific return value.
|
|
1900
|
+
* If an error occurs during the operation, the promise will be rejected
|
|
1901
|
+
* with an error object.
|
|
1748
1902
|
*/
|
|
1749
1903
|
async setGlobalVariable(variableName, value) {
|
|
1750
1904
|
return this.asterisk.setGlobalVariable(variableName, value);
|
|
@@ -1754,6 +1908,7 @@ var AriClient = class {
|
|
|
1754
1908
|
0 && (module.exports = {
|
|
1755
1909
|
Applications,
|
|
1756
1910
|
AriClient,
|
|
1911
|
+
Asterisk,
|
|
1757
1912
|
Channels,
|
|
1758
1913
|
Endpoints,
|
|
1759
1914
|
Playbacks,
|