@ipcom/asterisk-ari 0.0.159 → 0.0.160
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 +72 -0
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/package.json +3 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/types/ari-client/resources/channels.d.ts +28 -0
- package/dist/types/ari-client/resources/channels.d.ts.map +1 -1
- package/package.json +6 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -1897,6 +1897,78 @@ var ChannelInstance = class {
|
|
|
1897
1897
|
throw new Error(`Failed to originate channel: ${message}`);
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Continues the execution of a dialplan for the current channel.
|
|
1902
|
+
*
|
|
1903
|
+
* @param {string} [context] - The dialplan context to continue execution in, if specified.
|
|
1904
|
+
* @param {string} [extension] - The dialplan extension to proceed with, if provided.
|
|
1905
|
+
* @param {number} [priority] - The priority within the dialplan extension to resume at, if specified.
|
|
1906
|
+
* @param {string} [label] - The label to start from within the dialplan, if given.
|
|
1907
|
+
* @return {Promise<void>} Resolves when the dialplan is successfully continued.
|
|
1908
|
+
*/
|
|
1909
|
+
async continueDialplan(context, extension, priority, label) {
|
|
1910
|
+
try {
|
|
1911
|
+
if (!this.channelData) {
|
|
1912
|
+
this.channelData = await this.getDetails();
|
|
1913
|
+
}
|
|
1914
|
+
await this.baseClient.post(`/channels/${this.id}/continue`, {
|
|
1915
|
+
context,
|
|
1916
|
+
extension,
|
|
1917
|
+
priority,
|
|
1918
|
+
label
|
|
1919
|
+
});
|
|
1920
|
+
} catch (error) {
|
|
1921
|
+
const message = getErrorMessage2(error);
|
|
1922
|
+
console.error(`Error continuing dialplan for channel ${this.id}:`, message);
|
|
1923
|
+
throw new Error(`Failed to continue dialplan: ${message}`);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Initiates a snoop operation on this channel with the provided options.
|
|
1928
|
+
* Snooping allows you to listen in or interact with an existing call.
|
|
1929
|
+
*
|
|
1930
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
1931
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
1932
|
+
* @throws {Error} If the channel is not initialized or if snooping fails.
|
|
1933
|
+
*/
|
|
1934
|
+
async snoop(options) {
|
|
1935
|
+
try {
|
|
1936
|
+
if (!this.channelData) {
|
|
1937
|
+
this.channelData = await this.getDetails();
|
|
1938
|
+
}
|
|
1939
|
+
const queryParams = toQueryParams2(options);
|
|
1940
|
+
return await this.baseClient.post(
|
|
1941
|
+
`/channels/${this.id}/snoop?${queryParams}`
|
|
1942
|
+
);
|
|
1943
|
+
} catch (error) {
|
|
1944
|
+
const message = getErrorMessage2(error);
|
|
1945
|
+
console.error(`Error snooping on channel ${this.id}:`, message);
|
|
1946
|
+
throw new Error(`Failed to snoop channel: ${message}`);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Initiates a snoop operation on this channel with a specific snoop ID.
|
|
1951
|
+
*
|
|
1952
|
+
* @param {string} snoopId - The unique identifier for the snoop operation.
|
|
1953
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
1954
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
1955
|
+
* @throws {Error} If the channel is not initialized or if snooping fails.
|
|
1956
|
+
*/
|
|
1957
|
+
async snoopWithId(snoopId, options) {
|
|
1958
|
+
try {
|
|
1959
|
+
if (!this.channelData) {
|
|
1960
|
+
this.channelData = await this.getDetails();
|
|
1961
|
+
}
|
|
1962
|
+
const queryParams = toQueryParams2(options);
|
|
1963
|
+
return await this.baseClient.post(
|
|
1964
|
+
`/channels/${this.id}/snoop/${snoopId}?${queryParams}`
|
|
1965
|
+
);
|
|
1966
|
+
} catch (error) {
|
|
1967
|
+
const message = getErrorMessage2(error);
|
|
1968
|
+
console.error(`Error snooping with ID on channel ${this.id}:`, message);
|
|
1969
|
+
throw new Error(`Failed to snoop channel with ID: ${message}`);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1900
1972
|
/**
|
|
1901
1973
|
* Plays media on the channel
|
|
1902
1974
|
*/
|