@ipcom/asterisk-ari 0.0.159 → 0.0.161
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 +210 -0
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/package.json +3 -0
- package/dist/esm/index.js +210 -0
- package/dist/esm/index.js.map +3 -3
- package/dist/types/ari-client/ariClient.d.ts +14 -12
- package/dist/types/ari-client/ariClient.d.ts.map +1 -1
- package/dist/types/ari-client/baseClient.d.ts +1 -1
- package/dist/types/ari-client/interfaces/applications.types.d.ts +2 -2
- package/dist/types/ari-client/interfaces/bridges.types.d.ts +5 -5
- package/dist/types/ari-client/interfaces/channels.types.d.ts +4 -4
- package/dist/types/ari-client/interfaces/events.types.d.ts +41 -41
- package/dist/types/ari-client/interfaces/events.types.d.ts.map +1 -1
- package/dist/types/ari-client/interfaces/index.d.ts +10 -9
- package/dist/types/ari-client/interfaces/index.d.ts.map +1 -1
- package/dist/types/ari-client/interfaces/playbacks.types.d.ts +2 -2
- package/dist/types/ari-client/interfaces/recordings.types.d.ts +50 -0
- package/dist/types/ari-client/interfaces/recordings.types.d.ts.map +1 -0
- package/dist/types/ari-client/interfaces/websocket.types.d.ts +2 -2
- package/dist/types/ari-client/resources/applications.d.ts +2 -2
- package/dist/types/ari-client/resources/asterisk.d.ts +4 -4
- package/dist/types/ari-client/resources/baseResource.d.ts +1 -1
- package/dist/types/ari-client/resources/baseResource.d.ts.map +1 -1
- package/dist/types/ari-client/resources/bridges.d.ts +6 -6
- package/dist/types/ari-client/resources/channels.d.ts +39 -11
- package/dist/types/ari-client/resources/channels.d.ts.map +1 -1
- package/dist/types/ari-client/resources/endpoints.d.ts +2 -2
- package/dist/types/ari-client/resources/playbacks.d.ts +8 -8
- package/dist/types/ari-client/resources/playbacks.d.ts.map +1 -1
- package/dist/types/ari-client/resources/recordings.d.ts +77 -0
- package/dist/types/ari-client/resources/recordings.d.ts.map +1 -1
- package/dist/types/ari-client/resources/sounds.d.ts +2 -2
- package/dist/types/ari-client/utils.d.ts +1 -1
- package/dist/types/ari-client/websocketClient.d.ts +4 -4
- package/dist/types/index.d.ts +17 -17
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +24 -10
package/dist/esm/index.js
CHANGED
|
@@ -1834,6 +1834,7 @@ var ChannelInstance = class {
|
|
|
1834
1834
|
listeners.forEach((listener) => {
|
|
1835
1835
|
this.eventEmitter.off(
|
|
1836
1836
|
event,
|
|
1837
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
1837
1838
|
listener
|
|
1838
1839
|
);
|
|
1839
1840
|
});
|
|
@@ -1876,6 +1877,81 @@ var ChannelInstance = class {
|
|
|
1876
1877
|
throw new Error(`Failed to originate channel: ${message}`);
|
|
1877
1878
|
}
|
|
1878
1879
|
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Continues the execution of a dialplan for the current channel.
|
|
1882
|
+
*
|
|
1883
|
+
* @param {string} [context] - The dialplan context to continue execution in, if specified.
|
|
1884
|
+
* @param {string} [extension] - The dialplan extension to proceed with, if provided.
|
|
1885
|
+
* @param {number} [priority] - The priority within the dialplan extension to resume at, if specified.
|
|
1886
|
+
* @param {string} [label] - The label to start from within the dialplan, if given.
|
|
1887
|
+
* @return {Promise<void>} Resolves when the dialplan is successfully continued.
|
|
1888
|
+
*/
|
|
1889
|
+
async continueDialplan(context, extension, priority, label) {
|
|
1890
|
+
try {
|
|
1891
|
+
if (!this.channelData) {
|
|
1892
|
+
this.channelData = await this.getDetails();
|
|
1893
|
+
}
|
|
1894
|
+
await this.baseClient.post(`/channels/${this.id}/continue`, {
|
|
1895
|
+
context,
|
|
1896
|
+
extension,
|
|
1897
|
+
priority,
|
|
1898
|
+
label
|
|
1899
|
+
});
|
|
1900
|
+
} catch (error) {
|
|
1901
|
+
const message = getErrorMessage2(error);
|
|
1902
|
+
console.error(
|
|
1903
|
+
`Error continuing dialplan for channel ${this.id}:`,
|
|
1904
|
+
message
|
|
1905
|
+
);
|
|
1906
|
+
throw new Error(`Failed to continue dialplan: ${message}`);
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Initiates a snoop operation on this channel with the provided options.
|
|
1911
|
+
* Snooping allows you to listen in or interact with an existing call.
|
|
1912
|
+
*
|
|
1913
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
1914
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
1915
|
+
* @throws {Error} If the channel is not initialized or if snooping fails.
|
|
1916
|
+
*/
|
|
1917
|
+
async snoop(options) {
|
|
1918
|
+
try {
|
|
1919
|
+
if (!this.channelData) {
|
|
1920
|
+
this.channelData = await this.getDetails();
|
|
1921
|
+
}
|
|
1922
|
+
const queryParams = toQueryParams2(options);
|
|
1923
|
+
return await this.baseClient.post(
|
|
1924
|
+
`/channels/${this.id}/snoop?${queryParams}`
|
|
1925
|
+
);
|
|
1926
|
+
} catch (error) {
|
|
1927
|
+
const message = getErrorMessage2(error);
|
|
1928
|
+
console.error(`Error snooping on channel ${this.id}:`, message);
|
|
1929
|
+
throw new Error(`Failed to snoop channel: ${message}`);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Initiates a snoop operation on this channel with a specific snoop ID.
|
|
1934
|
+
*
|
|
1935
|
+
* @param {string} snoopId - The unique identifier for the snoop operation.
|
|
1936
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
1937
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
1938
|
+
* @throws {Error} If the channel is not initialized or if snooping fails.
|
|
1939
|
+
*/
|
|
1940
|
+
async snoopWithId(snoopId, options) {
|
|
1941
|
+
try {
|
|
1942
|
+
if (!this.channelData) {
|
|
1943
|
+
this.channelData = await this.getDetails();
|
|
1944
|
+
}
|
|
1945
|
+
const queryParams = toQueryParams2(options);
|
|
1946
|
+
return await this.baseClient.post(
|
|
1947
|
+
`/channels/${this.id}/snoop/${snoopId}?${queryParams}`
|
|
1948
|
+
);
|
|
1949
|
+
} catch (error) {
|
|
1950
|
+
const message = getErrorMessage2(error);
|
|
1951
|
+
console.error(`Error snooping with ID on channel ${this.id}:`, message);
|
|
1952
|
+
throw new Error(`Failed to snoop channel with ID: ${message}`);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1879
1955
|
/**
|
|
1880
1956
|
* Plays media on the channel
|
|
1881
1957
|
*/
|
|
@@ -3597,6 +3673,137 @@ var WebSocketClient = class extends EventEmitter4 {
|
|
|
3597
3673
|
}
|
|
3598
3674
|
};
|
|
3599
3675
|
|
|
3676
|
+
// src/ari-client/resources/recordings.ts
|
|
3677
|
+
var Recordings = class {
|
|
3678
|
+
constructor(baseClient) {
|
|
3679
|
+
this.baseClient = baseClient;
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* List recordings that are complete.
|
|
3683
|
+
* @returns Promise<StoredRecording[]>
|
|
3684
|
+
*/
|
|
3685
|
+
async listStored() {
|
|
3686
|
+
return this.baseClient.get("/recordings/stored");
|
|
3687
|
+
}
|
|
3688
|
+
/**
|
|
3689
|
+
* Get a stored recording's details.
|
|
3690
|
+
* @param params - The parameters for getting a stored recording
|
|
3691
|
+
* @returns Promise<StoredRecording>
|
|
3692
|
+
*/
|
|
3693
|
+
async getStored(params) {
|
|
3694
|
+
return this.baseClient.get(
|
|
3695
|
+
`/recordings/stored/${params.recordingName}`
|
|
3696
|
+
);
|
|
3697
|
+
}
|
|
3698
|
+
/**
|
|
3699
|
+
* Delete a stored recording.
|
|
3700
|
+
* @param params - The parameters for deleting a stored recording
|
|
3701
|
+
* @returns Promise<void>
|
|
3702
|
+
*/
|
|
3703
|
+
async deleteStored(params) {
|
|
3704
|
+
return this.baseClient.delete(
|
|
3705
|
+
`/recordings/stored/${params.recordingName}`
|
|
3706
|
+
);
|
|
3707
|
+
}
|
|
3708
|
+
/**
|
|
3709
|
+
* Get the file associated with the stored recording.
|
|
3710
|
+
* @param params - The parameters for getting a stored recording file
|
|
3711
|
+
* @returns Promise<ArrayBuffer>
|
|
3712
|
+
*/
|
|
3713
|
+
async getStoredFile(params) {
|
|
3714
|
+
return this.baseClient.get(
|
|
3715
|
+
`/recordings/stored/${params.recordingName}/file`,
|
|
3716
|
+
{ responseType: "arraybuffer" }
|
|
3717
|
+
);
|
|
3718
|
+
}
|
|
3719
|
+
/**
|
|
3720
|
+
* Copy a stored recording.
|
|
3721
|
+
* @param params - The parameters for copying a stored recording
|
|
3722
|
+
* @returns Promise<StoredRecording>
|
|
3723
|
+
*/
|
|
3724
|
+
async copyStored(params) {
|
|
3725
|
+
return this.baseClient.post(
|
|
3726
|
+
`/recordings/stored/${params.recordingName}/copy`,
|
|
3727
|
+
void 0,
|
|
3728
|
+
{
|
|
3729
|
+
params: {
|
|
3730
|
+
destinationRecordingName: params.destinationRecordingName
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
);
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3736
|
+
* List live recordings.
|
|
3737
|
+
* @param params - The parameters for getting a live recording
|
|
3738
|
+
* @returns Promise<LiveRecording>
|
|
3739
|
+
*/
|
|
3740
|
+
async getLive(params) {
|
|
3741
|
+
return this.baseClient.get(
|
|
3742
|
+
`/recordings/live/${params.recordingName}`
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Stop a live recording and discard it.
|
|
3747
|
+
* @param params - The parameters for canceling a recording
|
|
3748
|
+
* @returns Promise<void>
|
|
3749
|
+
*/
|
|
3750
|
+
async cancel(params) {
|
|
3751
|
+
return this.baseClient.delete(
|
|
3752
|
+
`/recordings/live/${params.recordingName}`
|
|
3753
|
+
);
|
|
3754
|
+
}
|
|
3755
|
+
/**
|
|
3756
|
+
* Stop a live recording and store it.
|
|
3757
|
+
* @param params - The parameters for stopping a recording
|
|
3758
|
+
* @returns Promise<void>
|
|
3759
|
+
*/
|
|
3760
|
+
async stop(params) {
|
|
3761
|
+
return this.baseClient.post(
|
|
3762
|
+
`/recordings/live/${params.recordingName}/stop`
|
|
3763
|
+
);
|
|
3764
|
+
}
|
|
3765
|
+
/**
|
|
3766
|
+
* Pause a live recording.
|
|
3767
|
+
* @param params - The parameters for pausing a recording
|
|
3768
|
+
* @returns Promise<void>
|
|
3769
|
+
*/
|
|
3770
|
+
async pause(params) {
|
|
3771
|
+
return this.baseClient.post(
|
|
3772
|
+
`/recordings/live/${params.recordingName}/pause`
|
|
3773
|
+
);
|
|
3774
|
+
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Unpause a live recording.
|
|
3777
|
+
* @param params - The parameters for unpausing a recording
|
|
3778
|
+
* @returns Promise<void>
|
|
3779
|
+
*/
|
|
3780
|
+
async unpause(params) {
|
|
3781
|
+
return this.baseClient.delete(
|
|
3782
|
+
`/recordings/live/${params.recordingName}/pause`
|
|
3783
|
+
);
|
|
3784
|
+
}
|
|
3785
|
+
/**
|
|
3786
|
+
* Mute a live recording.
|
|
3787
|
+
* @param params - The parameters for muting a recording
|
|
3788
|
+
* @returns Promise<void>
|
|
3789
|
+
*/
|
|
3790
|
+
async mute(params) {
|
|
3791
|
+
return this.baseClient.post(
|
|
3792
|
+
`/recordings/live/${params.recordingName}/mute`
|
|
3793
|
+
);
|
|
3794
|
+
}
|
|
3795
|
+
/**
|
|
3796
|
+
* Unmute a live recording.
|
|
3797
|
+
* @param params - The parameters for unmuting a recording
|
|
3798
|
+
* @returns Promise<void>
|
|
3799
|
+
*/
|
|
3800
|
+
async unmute(params) {
|
|
3801
|
+
return this.baseClient.delete(
|
|
3802
|
+
`/recordings/live/${params.recordingName}/mute`
|
|
3803
|
+
);
|
|
3804
|
+
}
|
|
3805
|
+
};
|
|
3806
|
+
|
|
3600
3807
|
// src/ari-client/ariClient.ts
|
|
3601
3808
|
var AriClient = class {
|
|
3602
3809
|
/**
|
|
@@ -3621,6 +3828,7 @@ var AriClient = class {
|
|
|
3621
3828
|
this.applications = new Applications(this.baseClient);
|
|
3622
3829
|
this.sounds = new Sounds(this.baseClient);
|
|
3623
3830
|
this.asterisk = new Asterisk(this.baseClient);
|
|
3831
|
+
this.recordings = new Recordings(this.baseClient);
|
|
3624
3832
|
console.log(`ARI Client initialized with base URL: ${baseUrl}`);
|
|
3625
3833
|
}
|
|
3626
3834
|
baseClient;
|
|
@@ -3633,6 +3841,7 @@ var AriClient = class {
|
|
|
3633
3841
|
sounds;
|
|
3634
3842
|
asterisk;
|
|
3635
3843
|
bridges;
|
|
3844
|
+
recordings;
|
|
3636
3845
|
async cleanup() {
|
|
3637
3846
|
try {
|
|
3638
3847
|
console.log("Starting ARI Client cleanup...");
|
|
@@ -3744,6 +3953,7 @@ var AriClient = class {
|
|
|
3744
3953
|
this.applications = null;
|
|
3745
3954
|
this.sounds = null;
|
|
3746
3955
|
this.asterisk = null;
|
|
3956
|
+
this.recordings = null;
|
|
3747
3957
|
console.log("ARI Client destroyed successfully");
|
|
3748
3958
|
} catch (error) {
|
|
3749
3959
|
console.error("Error destroying ARI Client:", error);
|