@ipcom/asterisk-ari 0.0.17 → 0.0.18

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/esm/index.js CHANGED
@@ -583,14 +583,40 @@ var BaseClient = class {
583
583
  auth: { username, password }
584
584
  });
585
585
  }
586
+ /**
587
+ * Executes a GET request.
588
+ * @param path - The API endpoint path.
589
+ */
586
590
  async get(path) {
587
591
  const response = await this.client.get(path);
588
592
  return response.data;
589
593
  }
594
+ /**
595
+ * Executes a POST request.
596
+ * @param path - The API endpoint path.
597
+ * @param data - Optional payload to send with the request.
598
+ */
590
599
  async post(path, data) {
591
600
  const response = await this.client.post(path, data);
592
601
  return response.data;
593
602
  }
603
+ /**
604
+ * Executes a PUT request.
605
+ * @param path - The API endpoint path.
606
+ * @param data - Payload to send with the request.
607
+ */
608
+ async put(path, data) {
609
+ const response = await this.client.put(path, data);
610
+ return response.data;
611
+ }
612
+ /**
613
+ * Executes a DELETE request.
614
+ * @param path - The API endpoint path.
615
+ */
616
+ async delete(path) {
617
+ const response = await this.client.delete(path);
618
+ return response.data;
619
+ }
594
620
  };
595
621
 
596
622
  // src/ari-client/resources/applications.ts
@@ -633,15 +659,18 @@ var Applications = class {
633
659
  };
634
660
 
635
661
  // src/ari-client/resources/channels.ts
662
+ function toQueryParams(options) {
663
+ return new URLSearchParams(
664
+ Object.entries(options).filter(([, value]) => value !== void 0).map(([key, value]) => [key, value])
665
+ // Garante que value é string
666
+ ).toString();
667
+ }
636
668
  var Channels = class {
637
669
  constructor(client) {
638
670
  this.client = client;
639
671
  }
640
672
  /**
641
673
  * Lists all active channels.
642
- *
643
- * @returns A promise that resolves to an array of Channel objects representing all active channels.
644
- * @throws {Error} If the API response is not an array.
645
674
  */
646
675
  async list() {
647
676
  const channels = await this.client.get("/channels");
@@ -652,40 +681,45 @@ var Channels = class {
652
681
  }
653
682
  /**
654
683
  * Creates a new channel.
655
- *
656
- * @param data - The OriginateRequest object containing the necessary data to create a new channel.
657
- * @returns A promise that resolves to a Channel object representing the newly created channel.
658
684
  */
659
685
  async originate(data) {
660
686
  return this.client.post("/channels", data);
661
687
  }
662
688
  /**
663
689
  * Retrieves details of a specific channel.
664
- *
665
- * @param channelId - The unique identifier of the channel.
666
- * @returns A promise that resolves to a Channel object containing the details of the specified channel.
667
690
  */
668
691
  async getDetails(channelId) {
669
692
  return this.client.get(`/channels/${channelId}`);
670
693
  }
694
+ /**
695
+ * Creates a channel and places it in a Stasis app without dialing it.
696
+ */
697
+ async createChannel(data) {
698
+ return this.client.post("/channels/create", data);
699
+ }
700
+ /**
701
+ * Creates a new channel with a specific ID and originates a call.
702
+ */
703
+ async originateWithId(channelId, data) {
704
+ return this.client.post(`/channels/${channelId}`, data);
705
+ }
671
706
  /**
672
707
  * Hangs up (terminates) a specific channel.
673
- *
674
- * @param channelId - The unique identifier of the channel to be hung up.
675
- * @returns A promise that resolves when the channel has been successfully hung up.
676
708
  */
677
- async hangup(channelId) {
678
- return this.client.post(`/channels/${channelId}/hangup`);
709
+ /**
710
+ * Hangs up a specific channel with optional reason or reason code.
711
+ */
712
+ async hangup(channelId, options) {
713
+ const queryParams = new URLSearchParams({
714
+ ...options?.reason_code && { reason_code: options.reason_code },
715
+ ...options?.reason && { reason: options.reason }
716
+ });
717
+ return this.client.delete(
718
+ `/channels/${channelId}?${queryParams.toString()}`
719
+ );
679
720
  }
680
721
  /**
681
722
  * Continues the dialplan for a specific channel.
682
- *
683
- * @param channelId - The unique identifier of the channel.
684
- * @param context - Optional. The context to continue in the dialplan.
685
- * @param extension - Optional. The extension to continue in the dialplan.
686
- * @param priority - Optional. The priority to continue in the dialplan.
687
- * @param label - Optional. The label to continue in the dialplan.
688
- * @returns A promise that resolves when the dialplan continuation has been successfully initiated.
689
723
  */
690
724
  async continueDialplan(channelId, context, extension, priority, label) {
691
725
  return this.client.post(`/channels/${channelId}/continue`, {
@@ -697,11 +731,6 @@ var Channels = class {
697
731
  }
698
732
  /**
699
733
  * Moves the channel to another Stasis application.
700
- *
701
- * @param channelId - The unique identifier of the channel to be moved.
702
- * @param app - The name of the Stasis application to move the channel to.
703
- * @param appArgs - Optional. Arguments to be passed to the Stasis application.
704
- * @returns A promise that resolves when the channel has been successfully moved to the new application.
705
734
  */
706
735
  async moveToApplication(channelId, app, appArgs) {
707
736
  return this.client.post(`/channels/${channelId}/move`, {
@@ -709,6 +738,224 @@ var Channels = class {
709
738
  appArgs
710
739
  });
711
740
  }
741
+ /**
742
+ * Sets a channel variable.
743
+ */
744
+ async setVariable(channelId, variable, value) {
745
+ return this.client.post(`/channels/${channelId}/variable`, {
746
+ variable,
747
+ value
748
+ });
749
+ }
750
+ /**
751
+ * Gets a channel variable.
752
+ */
753
+ async getVariable(channelId, variable) {
754
+ return this.client.get(
755
+ `/channels/${channelId}/variable?variable=${encodeURIComponent(variable)}`
756
+ );
757
+ }
758
+ /**
759
+ * Plays a media file to a channel.
760
+ */
761
+ async playMedia(channelId, media, options) {
762
+ const queryParams = options ? `?${new URLSearchParams(options).toString()}` : "";
763
+ return this.client.post(
764
+ `/channels/${channelId}/play${queryParams}`,
765
+ { media }
766
+ );
767
+ }
768
+ /**
769
+ * Starts music on hold (MOH) for a channel.
770
+ */
771
+ async startMusicOnHold(channelId) {
772
+ return this.client.post(`/channels/${channelId}/moh`);
773
+ }
774
+ /**
775
+ * Stops music on hold (MOH) for a channel.
776
+ */
777
+ async stopMusicOnHold(channelId) {
778
+ return this.client.delete(`/channels/${channelId}/moh`);
779
+ }
780
+ /**
781
+ * Starts playback of a media file on a channel.
782
+ */
783
+ async startPlayback(channelId, media, options) {
784
+ const queryParams = options ? `?${new URLSearchParams(options).toString()}` : "";
785
+ return this.client.post(
786
+ `/channels/${channelId}/play${queryParams}`,
787
+ { media }
788
+ );
789
+ }
790
+ /**
791
+ * Stops playback of a media file on a channel.
792
+ */
793
+ async stopPlayback(channelId, playbackId) {
794
+ return this.client.delete(
795
+ `/channels/${channelId}/play/${playbackId}`
796
+ );
797
+ }
798
+ /**
799
+ * Pauses playback of a media file on a channel.
800
+ */
801
+ async pausePlayback(channelId, playbackId) {
802
+ return this.client.post(
803
+ `/channels/${channelId}/play/${playbackId}/pause`
804
+ );
805
+ }
806
+ /**
807
+ * Resumes playback of a media file on a channel.
808
+ */
809
+ async resumePlayback(channelId, playbackId) {
810
+ return this.client.delete(
811
+ `/channels/${channelId}/play/${playbackId}/pause`
812
+ );
813
+ }
814
+ /**
815
+ * Rewinds playback of a media file on a channel.
816
+ */
817
+ async rewindPlayback(channelId, playbackId, skipMs) {
818
+ return this.client.post(
819
+ `/channels/${channelId}/play/${playbackId}/rewind`,
820
+ { skipMs }
821
+ );
822
+ }
823
+ /**
824
+ * Fast-forwards playback of a media file on a channel.
825
+ */
826
+ async fastForwardPlayback(channelId, playbackId, skipMs) {
827
+ return this.client.post(
828
+ `/channels/${channelId}/play/${playbackId}/forward`,
829
+ { skipMs }
830
+ );
831
+ }
832
+ /**
833
+ * Records audio from a channel.
834
+ */
835
+ async record(channelId, options) {
836
+ const queryParams = new URLSearchParams(
837
+ Object.entries(options).filter(
838
+ ([, value]) => value !== void 0
839
+ )
840
+ );
841
+ return this.client.post(
842
+ `/channels/${channelId}/record?${queryParams.toString()}`
843
+ );
844
+ }
845
+ /**
846
+ * Starts snooping on a channel.
847
+ */
848
+ async snoopChannel(channelId, options) {
849
+ const queryParams = toQueryParams(options);
850
+ return this.client.post(
851
+ `/channels/${channelId}/snoop?${queryParams}`
852
+ );
853
+ }
854
+ /**
855
+ * Starts snooping on a channel with a specific snoop ID.
856
+ */
857
+ async snoopChannelWithId(channelId, snoopId, options) {
858
+ const queryParams = new URLSearchParams(options);
859
+ return this.client.post(
860
+ `/channels/${channelId}/snoop/${snoopId}?${queryParams.toString()}`
861
+ );
862
+ }
863
+ /**
864
+ * Dials a created channel.
865
+ */
866
+ async dial(channelId, caller, timeout) {
867
+ const queryParams = new URLSearchParams({
868
+ ...caller && { caller },
869
+ ...timeout && { timeout: timeout.toString() }
870
+ });
871
+ return this.client.post(
872
+ `/channels/${channelId}/dial?${queryParams.toString()}`
873
+ );
874
+ }
875
+ /**
876
+ * Retrieves RTP statistics for a channel.
877
+ */
878
+ async getRTPStatistics(channelId) {
879
+ return this.client.get(`/channels/${channelId}/rtp_statistics`);
880
+ }
881
+ /**
882
+ * Creates a channel to an external media source/sink.
883
+ */
884
+ async createExternalMedia(options) {
885
+ const queryParams = new URLSearchParams(options);
886
+ return this.client.post(
887
+ `/channels/externalMedia?${queryParams.toString()}`
888
+ );
889
+ }
890
+ /**
891
+ * Redirects the channel to a different location.
892
+ */
893
+ async redirectChannel(channelId, endpoint) {
894
+ return this.client.post(
895
+ `/channels/${channelId}/redirect?endpoint=${encodeURIComponent(endpoint)}`
896
+ );
897
+ }
898
+ /**
899
+ * Answers a channel.
900
+ */
901
+ async answerChannel(channelId) {
902
+ return this.client.post(`/channels/${channelId}/answer`);
903
+ }
904
+ /**
905
+ * Sends a ringing indication to a channel.
906
+ */
907
+ async ringChannel(channelId) {
908
+ return this.client.post(`/channels/${channelId}/ring`);
909
+ }
910
+ /**
911
+ * Stops ringing indication on a channel.
912
+ */
913
+ async stopRingChannel(channelId) {
914
+ return this.client.delete(`/channels/${channelId}/ring`);
915
+ }
916
+ /**
917
+ * Sends DTMF to a channel.
918
+ */
919
+ async sendDTMF(channelId, dtmf, options) {
920
+ const queryParams = new URLSearchParams({
921
+ dtmf,
922
+ ...options?.before && { before: options.before.toString() },
923
+ ...options?.between && { between: options.between.toString() },
924
+ ...options?.duration && { duration: options.duration.toString() },
925
+ ...options?.after && { after: options.after.toString() }
926
+ });
927
+ return this.client.post(
928
+ `/channels/${channelId}/dtmf?${queryParams.toString()}`
929
+ );
930
+ }
931
+ /**
932
+ * Mutes a channel.
933
+ */
934
+ async muteChannel(channelId, direction = "both") {
935
+ return this.client.post(
936
+ `/channels/${channelId}/mute?direction=${direction}`
937
+ );
938
+ }
939
+ /**
940
+ * Unmutes a channel.
941
+ */
942
+ async unmuteChannel(channelId, direction = "both") {
943
+ return this.client.delete(
944
+ `/channels/${channelId}/mute?direction=${direction}`
945
+ );
946
+ }
947
+ /**
948
+ * Puts a channel on hold.
949
+ */
950
+ async holdChannel(channelId) {
951
+ return this.client.post(`/channels/${channelId}/hold`);
952
+ }
953
+ /**
954
+ * Removes a channel from hold.
955
+ */
956
+ async unholdChannel(channelId) {
957
+ return this.client.delete(`/channels/${channelId}/hold`);
958
+ }
712
959
  };
713
960
 
714
961
  // src/ari-client/resources/endpoints.ts
@@ -757,6 +1004,75 @@ var Endpoints = class {
757
1004
  }
758
1005
  };
759
1006
 
1007
+ // src/ari-client/resources/playbacks.ts
1008
+ var Playbacks = class {
1009
+ constructor(client) {
1010
+ this.client = client;
1011
+ }
1012
+ /**
1013
+ * Retrieves details of a specific playback.
1014
+ *
1015
+ * @param playbackId - The unique identifier of the playback.
1016
+ * @returns A promise that resolves to a Playback object containing the details of the specified playback.
1017
+ */
1018
+ async getDetails(playbackId) {
1019
+ return this.client.get(`/playbacks/${playbackId}`);
1020
+ }
1021
+ /**
1022
+ * Controls a specific playback (e.g., pause, resume, rewind, forward, stop).
1023
+ *
1024
+ * @param playbackId - The unique identifier of the playback to control.
1025
+ * @param controlRequest - The PlaybackControlRequest containing the control operation.
1026
+ * @returns A promise that resolves when the control operation is successfully executed.
1027
+ */
1028
+ async control(playbackId, controlRequest) {
1029
+ await this.client.post(
1030
+ `/playbacks/${playbackId}/control`,
1031
+ controlRequest
1032
+ );
1033
+ }
1034
+ /**
1035
+ * Stops a specific playback.
1036
+ *
1037
+ * @param playbackId - The unique identifier of the playback to stop.
1038
+ * @returns A promise that resolves when the playback is successfully stopped.
1039
+ */
1040
+ async stop(playbackId) {
1041
+ await this.client.post(`/playbacks/${playbackId}/stop`);
1042
+ }
1043
+ };
1044
+
1045
+ // src/ari-client/resources/sounds.ts
1046
+ var Sounds = class {
1047
+ constructor(client) {
1048
+ this.client = client;
1049
+ }
1050
+ /**
1051
+ * Lists all available sounds.
1052
+ *
1053
+ * @param params - Optional parameters to filter the list of sounds.
1054
+ * @returns A promise that resolves to an array of Sound objects.
1055
+ * @throws {Error} If the API response is not an array.
1056
+ */
1057
+ async list(params) {
1058
+ const query = params ? `?${new URLSearchParams(params).toString()}` : "";
1059
+ const sounds = await this.client.get(`/sounds${query}`);
1060
+ if (!Array.isArray(sounds)) {
1061
+ throw new Error("Resposta da API /sounds n\xE3o \xE9 um array.");
1062
+ }
1063
+ return sounds;
1064
+ }
1065
+ /**
1066
+ * Retrieves details of a specific sound.
1067
+ *
1068
+ * @param soundId - The unique identifier of the sound.
1069
+ * @returns A promise that resolves to a Sound object containing the details of the specified sound.
1070
+ */
1071
+ async getDetails(soundId) {
1072
+ return this.client.get(`/sounds/${soundId}`);
1073
+ }
1074
+ };
1075
+
760
1076
  // src/ari-client/websocketClient.ts
761
1077
  import WebSocket from "ws";
762
1078
  var WebSocketClient = class {
@@ -852,6 +1168,8 @@ var AriClient = class {
852
1168
  this.channels = new Channels(this.baseClient);
853
1169
  this.endpoints = new Endpoints(this.baseClient);
854
1170
  this.applications = new Applications(this.baseClient);
1171
+ this.playbacks = new Playbacks(this.baseClient);
1172
+ this.sounds = new Sounds(this.baseClient);
855
1173
  }
856
1174
  wsClient = null;
857
1175
  baseClient;
@@ -859,6 +1177,8 @@ var AriClient = class {
859
1177
  channels;
860
1178
  endpoints;
861
1179
  applications;
1180
+ playbacks;
1181
+ sounds;
862
1182
  /**
863
1183
  * Connects to the ARI WebSocket for a specific application.
864
1184
  *
@@ -966,45 +1286,32 @@ var AriClient = class {
966
1286
  *
967
1287
  * @returns {Promise<Channel[]>} A promise resolving to the list of active channels.
968
1288
  */
1289
+ /**
1290
+ * Lists all active channels.
1291
+ */
969
1292
  async listChannels() {
970
1293
  return this.channels.list();
971
1294
  }
972
1295
  /**
973
- * Initiates a new channel on the Asterisk server.
974
- *
975
- * @param data - The parameters for creating the new channel.
976
- * @returns {Promise<Channel>} A promise resolving to the new channel's details.
1296
+ * Creates a new channel.
977
1297
  */
978
1298
  async originateChannel(data) {
979
1299
  return this.channels.originate(data);
980
1300
  }
981
1301
  /**
982
1302
  * Retrieves details of a specific channel.
983
- *
984
- * @param channelId - The unique identifier of the channel.
985
- * @returns {Promise<Channel>} A promise resolving to the details of the channel.
986
1303
  */
987
1304
  async getChannelDetails(channelId) {
988
1305
  return this.channels.getDetails(channelId);
989
1306
  }
990
1307
  /**
991
1308
  * Hangs up a specific channel.
992
- *
993
- * @param channelId - The unique identifier of the channel to hang up.
994
- * @returns {Promise<void>}
995
1309
  */
996
1310
  async hangupChannel(channelId) {
997
1311
  return this.channels.hangup(channelId);
998
1312
  }
999
1313
  /**
1000
1314
  * Continues the dialplan for a specific channel.
1001
- *
1002
- * @param channelId - The unique identifier of the channel.
1003
- * @param context - Optional. The context to continue in the dialplan.
1004
- * @param extension - Optional. The extension to continue in the dialplan.
1005
- * @param priority - Optional. The priority to continue in the dialplan.
1006
- * @param label - Optional. The label to continue in the dialplan.
1007
- * @returns {Promise<void>}
1008
1315
  */
1009
1316
  async continueChannelDialplan(channelId, context, extension, priority, label) {
1010
1317
  return this.channels.continueDialplan(
@@ -1017,15 +1324,197 @@ var AriClient = class {
1017
1324
  }
1018
1325
  /**
1019
1326
  * Moves a channel to another Stasis application.
1020
- *
1021
- * @param channelId - The unique identifier of the channel.
1022
- * @param app - The name of the Stasis application to move the channel to.
1023
- * @param appArgs - Optional arguments for the Stasis application.
1024
- * @returns {Promise<void>}
1025
1327
  */
1026
1328
  async moveChannelToApplication(channelId, app, appArgs) {
1027
1329
  return this.channels.moveToApplication(channelId, app, appArgs);
1028
1330
  }
1331
+ /**
1332
+ * Sets a channel variable.
1333
+ */
1334
+ async setChannelVariable(channelId, variable, value) {
1335
+ return this.channels.setVariable(channelId, variable, value);
1336
+ }
1337
+ /**
1338
+ * Gets a channel variable.
1339
+ */
1340
+ async getChannelVariable(channelId, variable) {
1341
+ return this.channels.getVariable(channelId, variable);
1342
+ }
1343
+ /**
1344
+ * Plays a media file to a channel.
1345
+ */
1346
+ async playMediaToChannel(channelId, media, options) {
1347
+ return this.channels.playMedia(channelId, media, options);
1348
+ }
1349
+ /**
1350
+ * Starts music on hold for a channel.
1351
+ */
1352
+ async startChannelMusicOnHold(channelId) {
1353
+ return this.channels.startMusicOnHold(channelId);
1354
+ }
1355
+ /**
1356
+ * Stops music on hold for a channel.
1357
+ */
1358
+ async stopChannelMusicOnHold(channelId) {
1359
+ return this.channels.stopMusicOnHold(channelId);
1360
+ }
1361
+ /**
1362
+ * Starts playback of a media file on a channel.
1363
+ */
1364
+ async startChannelPlayback(channelId, media, options) {
1365
+ return this.channels.startPlayback(channelId, media, options);
1366
+ }
1367
+ /**
1368
+ * Stops playback of a media file on a channel.
1369
+ */
1370
+ async stopChannelPlayback(channelId, playbackId) {
1371
+ return this.channels.stopPlayback(channelId, playbackId);
1372
+ }
1373
+ /**
1374
+ * Pauses playback of a media file on a channel.
1375
+ */
1376
+ async pauseChannelPlayback(channelId, playbackId) {
1377
+ return this.channels.pausePlayback(channelId, playbackId);
1378
+ }
1379
+ /**
1380
+ * Resumes playback of a media file on a channel.
1381
+ */
1382
+ async resumeChannelPlayback(channelId, playbackId) {
1383
+ return this.channels.resumePlayback(channelId, playbackId);
1384
+ }
1385
+ /**
1386
+ * Rewinds playback of a media file on a channel.
1387
+ */
1388
+ async rewindChannelPlayback(channelId, playbackId, skipMs) {
1389
+ return this.channels.rewindPlayback(channelId, playbackId, skipMs);
1390
+ }
1391
+ /**
1392
+ * Fast-forwards playback of a media file on a channel.
1393
+ */
1394
+ async fastForwardChannelPlayback(channelId, playbackId, skipMs) {
1395
+ return this.channels.fastForwardPlayback(channelId, playbackId, skipMs);
1396
+ }
1397
+ /**
1398
+ * Records audio from a channel.
1399
+ */
1400
+ async recordAudio(channelId, options) {
1401
+ return this.channels.record(channelId, options);
1402
+ }
1403
+ /**
1404
+ * Starts snooping on a channel.
1405
+ */
1406
+ async snoopChannel(channelId, options) {
1407
+ return this.channels.snoopChannel(channelId, options);
1408
+ }
1409
+ /**
1410
+ * Starts snooping on a channel with a specific snoop ID.
1411
+ */
1412
+ async snoopChannelWithId(channelId, snoopId, options) {
1413
+ return this.channels.snoopChannelWithId(channelId, snoopId, options);
1414
+ }
1415
+ /**
1416
+ * Dials a created channel.
1417
+ */
1418
+ async dialChannel(channelId, caller, timeout) {
1419
+ return this.channels.dial(channelId, caller, timeout);
1420
+ }
1421
+ /**
1422
+ * Retrieves RTP statistics for a channel.
1423
+ */
1424
+ async getRTPStatistics(channelId) {
1425
+ return this.channels.getRTPStatistics(channelId);
1426
+ }
1427
+ /**
1428
+ * Creates a channel to an external media source/sink.
1429
+ */
1430
+ async createExternalMedia(options) {
1431
+ return this.channels.createExternalMedia(options);
1432
+ }
1433
+ /**
1434
+ * Redirects a channel to a different location.
1435
+ */
1436
+ async redirectChannel(channelId, endpoint) {
1437
+ return this.channels.redirectChannel(channelId, endpoint);
1438
+ }
1439
+ /**
1440
+ * Answers a channel.
1441
+ */
1442
+ async answerChannel(channelId) {
1443
+ return this.channels.answerChannel(channelId);
1444
+ }
1445
+ /**
1446
+ * Sends a ringing indication to a channel.
1447
+ */
1448
+ async ringChannel(channelId) {
1449
+ return this.channels.ringChannel(channelId);
1450
+ }
1451
+ /**
1452
+ * Stops ringing indication on a channel.
1453
+ */
1454
+ async stopRingChannel(channelId) {
1455
+ return this.channels.stopRingChannel(channelId);
1456
+ }
1457
+ /**
1458
+ * Sends DTMF to a channel.
1459
+ */
1460
+ async sendDTMF(channelId, dtmf, options) {
1461
+ return this.channels.sendDTMF(channelId, dtmf, options);
1462
+ }
1463
+ /**
1464
+ * Mutes a channel.
1465
+ */
1466
+ async muteChannel(channelId, direction = "both") {
1467
+ return this.channels.muteChannel(channelId, direction);
1468
+ }
1469
+ /**
1470
+ * Unmutes a channel.
1471
+ */
1472
+ async unmuteChannel(channelId, direction = "both") {
1473
+ return this.channels.unmuteChannel(channelId, direction);
1474
+ }
1475
+ /**
1476
+ * Puts a channel on hold.
1477
+ */
1478
+ async holdChannel(channelId) {
1479
+ return this.channels.holdChannel(channelId);
1480
+ }
1481
+ /**
1482
+ * Removes a channel from hold.
1483
+ */
1484
+ async unholdChannel(channelId) {
1485
+ return this.channels.unholdChannel(channelId);
1486
+ }
1487
+ /**
1488
+ * Creates a new channel using the provided originate request data.
1489
+ *
1490
+ * @param data - The originate request data containing channel creation parameters.
1491
+ * @returns A promise that resolves to the created Channel object.
1492
+ */
1493
+ async createChannel(data) {
1494
+ return this.channels.createChannel(data);
1495
+ }
1496
+ /**
1497
+ * Hangs up a specific channel.
1498
+ *
1499
+ * @param channelId - The unique identifier of the channel to hang up.
1500
+ * @param options - Optional parameters for the hangup operation.
1501
+ * @param options.reason_code - An optional reason code for the hangup.
1502
+ * @param options.reason - An optional textual reason for the hangup.
1503
+ * @returns A promise that resolves when the hangup operation is complete.
1504
+ */
1505
+ async hangup(channelId, options) {
1506
+ return this.channels.hangup(channelId, options);
1507
+ }
1508
+ /**
1509
+ * Originates a new channel with a specified ID using the provided originate request data.
1510
+ *
1511
+ * @param channelId - The desired unique identifier for the new channel.
1512
+ * @param data - The originate request data containing channel creation parameters.
1513
+ * @returns A promise that resolves to the created Channel object.
1514
+ */
1515
+ async originateWithId(channelId, data) {
1516
+ return this.channels.originateWithId(channelId, data);
1517
+ }
1029
1518
  // Métodos relacionados a endpoints:
1030
1519
  /**
1031
1520
  * Lists all endpoints.
@@ -1084,9 +1573,60 @@ var AriClient = class {
1084
1573
  async sendMessageToApplication(appName, body) {
1085
1574
  return this.applications.sendMessage(appName, body);
1086
1575
  }
1576
+ // Métodos relacionados a playbacks
1577
+ /**
1578
+ * Retrieves details of a specific playback.
1579
+ *
1580
+ * @param playbackId - The unique identifier of the playback.
1581
+ * @returns {Promise<Playback>} A promise resolving to the playback details.
1582
+ */
1583
+ async getPlaybackDetails(playbackId) {
1584
+ return this.playbacks.getDetails(playbackId);
1585
+ }
1586
+ /**
1587
+ * Controls a specific playback.
1588
+ *
1589
+ * @param playbackId - The unique identifier of the playback.
1590
+ * @param controlRequest - The PlaybackControlRequest containing the control operation.
1591
+ * @returns {Promise<void>} A promise resolving when the control operation is successfully executed.
1592
+ */
1593
+ async controlPlayback(playbackId, controlRequest) {
1594
+ return this.playbacks.control(playbackId, controlRequest);
1595
+ }
1596
+ /**
1597
+ * Stops a specific playback.
1598
+ *
1599
+ * @param playbackId - The unique identifier of the playback.
1600
+ * @returns {Promise<void>} A promise resolving when the playback is successfully stopped.
1601
+ */
1602
+ async stopPlayback(playbackId) {
1603
+ return this.playbacks.stop(playbackId);
1604
+ }
1605
+ /**
1606
+ * Lists all available sounds.
1607
+ *
1608
+ * @param params - Optional parameters to filter the list of sounds.
1609
+ * @returns {Promise<Sound[]>} A promise resolving to the list of sounds.
1610
+ */
1611
+ async listSounds(params) {
1612
+ return this.sounds.list(params);
1613
+ }
1614
+ /**
1615
+ * Retrieves details of a specific sound.
1616
+ *
1617
+ * @param soundId - The unique identifier of the sound.
1618
+ * @returns {Promise<Sound>} A promise resolving to the sound details.
1619
+ */
1620
+ async getSoundDetails(soundId) {
1621
+ return this.sounds.getDetails(soundId);
1622
+ }
1087
1623
  };
1088
1624
  export {
1625
+ Applications,
1089
1626
  AriClient,
1090
- Channels
1627
+ Channels,
1628
+ Endpoints,
1629
+ Playbacks,
1630
+ Sounds
1091
1631
  };
1092
1632
  //# sourceMappingURL=index.js.map