@ipcom/asterisk-ari 0.0.139 → 0.0.140
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/README.md +254 -0
- package/dist/cjs/index.cjs +990 -267
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/esm/index.js +993 -268
- package/dist/esm/index.js.map +3 -3
- package/dist/types/ari-client/ariClient.d.ts +64 -15
- package/dist/types/ari-client/ariClient.d.ts.map +1 -1
- package/dist/types/ari-client/baseClient.d.ts +55 -22
- package/dist/types/ari-client/baseClient.d.ts.map +1 -1
- package/dist/types/ari-client/resources/channels.d.ts +338 -47
- package/dist/types/ari-client/resources/channels.d.ts.map +1 -1
- package/dist/types/ari-client/resources/playbacks.d.ts +92 -19
- package/dist/types/ari-client/resources/playbacks.d.ts.map +1 -1
- package/dist/types/ari-client/utils.d.ts.map +1 -1
- package/dist/types/ari-client/websocketClient.d.ts +44 -13
- package/dist/types/ari-client/websocketClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +26 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,176 +2,467 @@ import type { AriClient } from "../ariClient";
|
|
|
2
2
|
import type { BaseClient } from "../baseClient.js";
|
|
3
3
|
import type { Channel, ChannelPlayback, ChannelVar, ExternalMediaOptions, OriginateRequest, PlaybackOptions, RTPStats, RecordingOptions, SnoopOptions, WebSocketEvent } from "../interfaces";
|
|
4
4
|
import type { PlaybackInstance } from "./playbacks";
|
|
5
|
+
/**
|
|
6
|
+
* Represents an instance of a communication channel managed by the AriClient.
|
|
7
|
+
*/
|
|
5
8
|
export declare class ChannelInstance {
|
|
6
|
-
private client;
|
|
7
|
-
private baseClient;
|
|
8
|
-
private
|
|
9
|
-
private eventEmitter;
|
|
9
|
+
private readonly client;
|
|
10
|
+
private readonly baseClient;
|
|
11
|
+
private readonly eventEmitter;
|
|
10
12
|
private channelData;
|
|
11
|
-
id: string;
|
|
13
|
+
readonly id: string;
|
|
12
14
|
constructor(client: AriClient, baseClient: BaseClient, channelId?: string);
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Registers an event listener for specific channel events
|
|
15
17
|
*/
|
|
16
18
|
on<T extends WebSocketEvent["type"]>(event: T, listener: (data: Extract<WebSocketEvent, {
|
|
17
19
|
type: T;
|
|
18
20
|
}>) => void): void;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Registers a one-time event listener
|
|
21
23
|
*/
|
|
22
24
|
once<T extends WebSocketEvent["type"]>(event: T, listener: (data: Extract<WebSocketEvent, {
|
|
23
25
|
type: T;
|
|
24
26
|
}>) => void): void;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* Removes event listener(s) for a specific WebSocket event type.
|
|
29
|
+
* If a specific listener is provided, only that listener is removed.
|
|
30
|
+
* Otherwise, all listeners for the given event type are removed.
|
|
31
|
+
*
|
|
32
|
+
* @param {T} event - The type of WebSocket event to remove listener(s) for
|
|
33
|
+
* @param {Function} [listener] - Optional specific listener to remove
|
|
34
|
+
* @throws {Error} If no event type is provided
|
|
27
35
|
*/
|
|
28
36
|
off<T extends WebSocketEvent["type"]>(event: T, listener?: (data: Extract<WebSocketEvent, {
|
|
29
37
|
type: T;
|
|
30
38
|
}>) => void): void;
|
|
31
39
|
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
getListenerCount(event: string): number;
|
|
35
|
-
/**
|
|
36
|
-
* Emite eventos internamente para o canal.
|
|
37
|
-
* Verifica o ID do canal antes de emitir.
|
|
40
|
+
* Emits an event if it matches the current channel
|
|
38
41
|
*/
|
|
39
42
|
emitEvent(event: WebSocketEvent): void;
|
|
40
43
|
/**
|
|
41
|
-
*
|
|
44
|
+
* Removes all event listeners associated with the current instance.
|
|
45
|
+
* This ensures that there are no lingering event handlers for the channel.
|
|
46
|
+
*
|
|
47
|
+
* @return {void} This method does not return a value.
|
|
42
48
|
*/
|
|
43
49
|
removeAllListeners(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Answers the channel
|
|
52
|
+
*/
|
|
44
53
|
answer(): Promise<void>;
|
|
45
54
|
/**
|
|
46
|
-
*
|
|
55
|
+
* Originates a new channel
|
|
56
|
+
*
|
|
57
|
+
* @param data - Channel origination configuration
|
|
58
|
+
* @returns Promise resolving to the created channel
|
|
59
|
+
* @throws Error if channel already exists or origination fails
|
|
47
60
|
*/
|
|
48
61
|
originate(data: OriginateRequest): Promise<Channel>;
|
|
49
62
|
/**
|
|
50
|
-
*
|
|
63
|
+
* Plays media on the channel
|
|
64
|
+
*/
|
|
65
|
+
play(options: {
|
|
66
|
+
media: string;
|
|
67
|
+
lang?: string;
|
|
68
|
+
}, playbackId?: string): Promise<PlaybackInstance>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the current channel details
|
|
51
71
|
*/
|
|
52
72
|
getDetails(): Promise<Channel>;
|
|
53
|
-
getVariable(variable: string): Promise<ChannelVar>;
|
|
54
73
|
/**
|
|
55
|
-
*
|
|
74
|
+
* Checks if the channel has any listeners for a specific event
|
|
56
75
|
*/
|
|
57
|
-
|
|
76
|
+
hasListeners(event: string): boolean;
|
|
58
77
|
/**
|
|
59
|
-
*
|
|
78
|
+
* Gets the count of listeners for a specific event
|
|
60
79
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
getListenerCount(event: string): number;
|
|
81
|
+
/**
|
|
82
|
+
* Fetches a specific channel variable.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} variable - The name of the variable to retrieve. This parameter is required.
|
|
85
|
+
* @return {Promise<ChannelVar>} A promise that resolves with the value of the requested channel variable.
|
|
86
|
+
* @throws {Error} If the 'variable' parameter is not provided.
|
|
87
|
+
*/
|
|
88
|
+
getVariable(variable: string): Promise<ChannelVar>;
|
|
65
89
|
/**
|
|
66
|
-
*
|
|
90
|
+
* Terminates the active call associated with the current channel.
|
|
91
|
+
* This method ensures that channel details are initialized before attempting to hang up.
|
|
92
|
+
* If the channel ID is invalid or cannot be determined, an error is thrown.
|
|
93
|
+
*
|
|
94
|
+
* @return {Promise<void>} A promise that resolves when the call is successfully terminated.
|
|
95
|
+
*/
|
|
96
|
+
hangup(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Plays media on the specified channel using the provided media URL and optional playback options.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} media - The URL or identifier of the media to be played.
|
|
101
|
+
* @param {PlaybackOptions} [options] - Optional playback settings such as volume, playback speed, etc.
|
|
102
|
+
* @return {Promise<ChannelPlayback>} A promise that resolves with the playback details for the channel.
|
|
103
|
+
* @throws {Error} Throws an error if the channel has not been created.
|
|
67
104
|
*/
|
|
68
105
|
playMedia(media: string, options?: PlaybackOptions): Promise<ChannelPlayback>;
|
|
69
106
|
/**
|
|
70
|
-
*
|
|
107
|
+
* Stops the playback for the given playback ID.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} playbackId - The unique identifier for the playback to be stopped.
|
|
110
|
+
* @return {Promise<void>} A promise that resolves when the playback is successfully stopped.
|
|
111
|
+
* @throws {Error} Throws an error if the instance is not associated with a channel.
|
|
71
112
|
*/
|
|
72
113
|
stopPlayback(playbackId: string): Promise<void>;
|
|
73
114
|
/**
|
|
74
|
-
*
|
|
115
|
+
* Pauses the playback of the specified media on a channel.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} playbackId - The unique identifier of the playback to be paused.
|
|
118
|
+
* @return {Promise<void>} A promise that resolves when the playback has been successfully paused.
|
|
119
|
+
* @throws {Error} Throws an error if the channel is not associated with the current instance.
|
|
75
120
|
*/
|
|
76
121
|
pausePlayback(playbackId: string): Promise<void>;
|
|
77
122
|
/**
|
|
78
|
-
*
|
|
123
|
+
* Resumes playback of the specified playback session on the associated channel.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} playbackId - The unique identifier of the playback session to be resumed.
|
|
126
|
+
* @return {Promise<void>} A promise that resolves when the playback has been successfully resumed.
|
|
127
|
+
* @throws {Error} Throws an error if the channel is not associated with this instance.
|
|
79
128
|
*/
|
|
80
129
|
resumePlayback(playbackId: string): Promise<void>;
|
|
81
130
|
/**
|
|
82
|
-
*
|
|
131
|
+
* Rewinds the playback of a media by a specified amount of milliseconds.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} playbackId - The unique identifier for the playback session to be rewound.
|
|
134
|
+
* @param {number} skipMs - The number of milliseconds to rewind the playback.
|
|
135
|
+
* @return {Promise<void>} A promise that resolves when the rewind operation is complete.
|
|
83
136
|
*/
|
|
84
137
|
rewindPlayback(playbackId: string, skipMs: number): Promise<void>;
|
|
85
138
|
/**
|
|
86
|
-
*
|
|
139
|
+
* Fast forwards the playback by a specific duration in milliseconds.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} playbackId - The unique identifier of the playback to be fast-forwarded.
|
|
142
|
+
* @param {number} skipMs - The number of milliseconds to fast forward the playback.
|
|
143
|
+
* @return {Promise<void>} A Promise that resolves when the fast-forward operation is complete.
|
|
144
|
+
* @throws {Error} If no channel is associated with this instance.
|
|
87
145
|
*/
|
|
88
146
|
fastForwardPlayback(playbackId: string, skipMs: number): Promise<void>;
|
|
89
147
|
/**
|
|
90
|
-
*
|
|
148
|
+
* Mutes the specified channel for the given direction.
|
|
149
|
+
*
|
|
150
|
+
* @param {("both" | "in" | "out")} [direction="both"] - The direction to mute the channel. It can be "both" to mute incoming and outgoing, "in" to mute incoming, or "out" to mute outgoing.
|
|
151
|
+
* @return {Promise<void>} A promise that resolves when the channel is successfully muted.
|
|
152
|
+
* @throws {Error} If the channel is not associated with this instance.
|
|
91
153
|
*/
|
|
92
154
|
muteChannel(direction?: "both" | "in" | "out"): Promise<void>;
|
|
93
155
|
/**
|
|
94
|
-
*
|
|
156
|
+
* Unmutes a previously muted channel in the specified direction.
|
|
157
|
+
*
|
|
158
|
+
* @param {"both" | "in" | "out"} direction - The direction in which to unmute the channel.
|
|
159
|
+
* Defaults to "both", which unmutes both incoming and outgoing communication.
|
|
160
|
+
* @return {Promise<void>} A promise that resolves once the channel has been successfully unmuted.
|
|
161
|
+
* @throws {Error} If the channel is not associated with the current instance.
|
|
95
162
|
*/
|
|
96
163
|
unmuteChannel(direction?: "both" | "in" | "out"): Promise<void>;
|
|
97
164
|
/**
|
|
98
|
-
*
|
|
165
|
+
* Places the associated channel on hold if the channel is valid and linked to this instance.
|
|
166
|
+
*
|
|
167
|
+
* @return {Promise<void>} A promise that resolves when the hold action is successfully executed.
|
|
168
|
+
* @throws {Error} Throws an error if the channel is not associated with this instance.
|
|
99
169
|
*/
|
|
100
170
|
holdChannel(): Promise<void>;
|
|
101
171
|
/**
|
|
102
|
-
*
|
|
172
|
+
* Removes the hold status from a specific channel associated with this instance.
|
|
173
|
+
* The method sends a delete request to the server to release the hold on the channel.
|
|
174
|
+
* If no channel is associated with this instance, an error will be thrown.
|
|
175
|
+
*
|
|
176
|
+
* @return {Promise<void>} A promise that resolves when the channel hold has been successfully removed.
|
|
177
|
+
* @throws {Error} If no channel is associated with this instance.
|
|
103
178
|
*/
|
|
104
179
|
unholdChannel(): Promise<void>;
|
|
105
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* The `Channels` class provides a comprehensive interface for managing
|
|
183
|
+
* and interacting with communication channels.
|
|
184
|
+
*/
|
|
106
185
|
export declare class Channels {
|
|
107
|
-
private baseClient;
|
|
108
|
-
private client;
|
|
109
|
-
private channelInstances;
|
|
186
|
+
private readonly baseClient;
|
|
187
|
+
private readonly client;
|
|
188
|
+
private readonly channelInstances;
|
|
110
189
|
constructor(baseClient: BaseClient, client: AriClient);
|
|
190
|
+
/**
|
|
191
|
+
* Creates or retrieves a ChannelInstance based on the provided id.
|
|
192
|
+
*/
|
|
111
193
|
Channel({ id }: {
|
|
112
194
|
id?: string;
|
|
113
195
|
}): ChannelInstance;
|
|
114
196
|
/**
|
|
115
|
-
*
|
|
197
|
+
* Removes a channel instance from the collection.
|
|
116
198
|
*/
|
|
117
199
|
removeChannelInstance(channelId: string): void;
|
|
118
200
|
/**
|
|
119
|
-
*
|
|
201
|
+
* Propagates a WebSocket event to a specific channel.
|
|
120
202
|
*/
|
|
121
203
|
propagateEventToChannel(event: WebSocketEvent): void;
|
|
122
204
|
/**
|
|
123
|
-
*
|
|
205
|
+
* Initiates a new channel.
|
|
124
206
|
*/
|
|
125
207
|
originate(data: OriginateRequest): Promise<Channel>;
|
|
126
208
|
/**
|
|
127
|
-
*
|
|
209
|
+
* Lists all active channels.
|
|
128
210
|
*/
|
|
129
|
-
|
|
211
|
+
list(): Promise<Channel[]>;
|
|
130
212
|
/**
|
|
131
|
-
*
|
|
213
|
+
* Gets the count of active channel instances.
|
|
132
214
|
*/
|
|
133
|
-
|
|
215
|
+
getInstanceCount(): number;
|
|
216
|
+
/**
|
|
217
|
+
* Checks if a channel instance exists.
|
|
218
|
+
*/
|
|
219
|
+
hasInstance(channelId: string): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Gets all active channel instances.
|
|
222
|
+
*/
|
|
223
|
+
getAllInstances(): Map<string, ChannelInstance>;
|
|
134
224
|
/**
|
|
135
|
-
*
|
|
225
|
+
* Terminates an active call on the specified channel.
|
|
226
|
+
*
|
|
227
|
+
* @param {string} channelId - The unique identifier of the channel to hang up.
|
|
228
|
+
* @param {Object} [options] - Optional parameters for the hangup request.
|
|
229
|
+
* @param {string} [options.reason_code] - A code indicating the reason for the hangup.
|
|
230
|
+
* @param {string} [options.reason] - A descriptive reason for the hangup.
|
|
231
|
+
* @return {Promise<void>} A promise that resolves when the call has been successfully terminated.
|
|
136
232
|
*/
|
|
137
233
|
hangup(channelId: string, options?: {
|
|
138
234
|
reason_code?: string;
|
|
139
235
|
reason?: string;
|
|
140
236
|
}): Promise<void>;
|
|
141
237
|
/**
|
|
142
|
-
*
|
|
238
|
+
* Initiates snooping on a specified channel with the provided options.
|
|
239
|
+
*
|
|
240
|
+
* @param {string} channelId - The unique identifier of the channel to snoop on.
|
|
241
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
242
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
143
243
|
*/
|
|
144
244
|
snoopChannel(channelId: string, options: SnoopOptions): Promise<Channel>;
|
|
245
|
+
/**
|
|
246
|
+
* Starts a silence mode for the specified channel.
|
|
247
|
+
*
|
|
248
|
+
* @param {string} channelId - The unique identifier of the channel where silence mode should be started.
|
|
249
|
+
* @return {Promise<void>} A promise that resolves when the silence mode is successfully started.
|
|
250
|
+
*/
|
|
145
251
|
startSilence(channelId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Stops the silence mode for a specific channel.
|
|
254
|
+
*
|
|
255
|
+
* @param {string} channelId - The unique identifier of the channel for which silence mode should be stopped.
|
|
256
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
257
|
+
*/
|
|
146
258
|
stopSilence(channelId: string): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Retrieves the Real-Time Protocol (RTP) statistics for a specific channel.
|
|
261
|
+
*
|
|
262
|
+
* @param {string} channelId - The unique identifier of the channel for which RTP statistics are fetched.
|
|
263
|
+
* @return {Promise<RTPStats>} A promise that resolves to the RTP statistics for the specified channel.
|
|
264
|
+
*/
|
|
147
265
|
getRTPStatistics(channelId: string): Promise<RTPStats>;
|
|
266
|
+
/**
|
|
267
|
+
* Creates an external media channel with the given options.
|
|
268
|
+
*
|
|
269
|
+
* @param {ExternalMediaOptions} options - The configuration options for creating the external media channel.
|
|
270
|
+
* @return {Promise<Channel>} A promise that resolves with the created external media channel.
|
|
271
|
+
*/
|
|
148
272
|
createExternalMedia(options: ExternalMediaOptions): Promise<Channel>;
|
|
273
|
+
/**
|
|
274
|
+
* Initiates playback of a specific media item on a channel using the provided playback ID.
|
|
275
|
+
*
|
|
276
|
+
* @param {string} channelId - The unique identifier of the channel where playback will occur.
|
|
277
|
+
* @param {string} playbackId - The unique identifier for the specific playback session.
|
|
278
|
+
* @param {string} media - The media content to be played.
|
|
279
|
+
* @param {PlaybackOptions} [options] - Optional playback configuration parameters.
|
|
280
|
+
* @return {Promise<ChannelPlayback>} A promise that resolves with the playback details for the channel.
|
|
281
|
+
*/
|
|
149
282
|
playWithId(channelId: string, playbackId: string, media: string, options?: PlaybackOptions): Promise<ChannelPlayback>;
|
|
283
|
+
/**
|
|
284
|
+
* Initiates a snoop operation on a specific channel using the provided channel ID and snoop ID.
|
|
285
|
+
*
|
|
286
|
+
* @param {string} channelId - The unique identifier of the channel to snoop on.
|
|
287
|
+
* @param {string} snoopId - The unique identifier for the snoop operation.
|
|
288
|
+
* @param {SnoopOptions} options - Additional options and parameters for the snoop operation.
|
|
289
|
+
* @return {Promise<Channel>} A promise that resolves to the channel details after the snoop operation is initiated.
|
|
290
|
+
*/
|
|
150
291
|
snoopChannelWithId(channelId: string, snoopId: string, options: SnoopOptions): Promise<Channel>;
|
|
292
|
+
/**
|
|
293
|
+
* Starts Music on Hold for the specified channel with the provided Music on Hold class.
|
|
294
|
+
*
|
|
295
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
296
|
+
* @param {string} mohClass - The Music on Hold class to be applied.
|
|
297
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
298
|
+
*/
|
|
151
299
|
startMohWithClass(channelId: string, mohClass: string): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Retrieves the value of a specified variable for a given channel.
|
|
302
|
+
*
|
|
303
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
304
|
+
* @param {string} variable - The name of the variable to retrieve.
|
|
305
|
+
* @return {Promise<ChannelVar>} A promise that resolves to the value of the channel variable.
|
|
306
|
+
* @throws {Error} Throws an error if the 'variable' parameter is not provided.
|
|
307
|
+
*/
|
|
152
308
|
getChannelVariable(channelId: string, variable: string): Promise<ChannelVar>;
|
|
309
|
+
/**
|
|
310
|
+
* Sets a variable for a specific channel.
|
|
311
|
+
*
|
|
312
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
313
|
+
* @param {string} variable - The name of the variable to be set. This parameter is required.
|
|
314
|
+
* @param {string} [value] - The value of the variable to be set. This parameter is optional.
|
|
315
|
+
* @return {Promise<void>} A promise that resolves when the variable is successfully set.
|
|
316
|
+
* @throws {Error} Throws an error if the `variable` parameter is not provided.
|
|
317
|
+
*/
|
|
153
318
|
setChannelVariable(channelId: string, variable: string, value?: string): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Moves a specified channel to the given application with optional arguments.
|
|
321
|
+
*
|
|
322
|
+
* @param {string} channelId - The unique identifier of the channel to be moved.
|
|
323
|
+
* @param {string} app - The target application to which the channel will be moved.
|
|
324
|
+
* @param {string} [appArgs] - Optional arguments to be passed to the target application.
|
|
325
|
+
* @return {Promise<void>} A promise that resolves when the operation is completed.
|
|
326
|
+
*/
|
|
154
327
|
moveToApplication(channelId: string, app: string, appArgs?: string): Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Continues the execution of a dialplan for a specific channel.
|
|
330
|
+
*
|
|
331
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
332
|
+
* @param {string} [context] - The dialplan context to continue execution in, if specified.
|
|
333
|
+
* @param {string} [extension] - The dialplan extension to proceed with, if provided.
|
|
334
|
+
* @param {number} [priority] - The priority within the dialplan extension to resume at, if specified.
|
|
335
|
+
* @param {string} [label] - The label to start from within the dialplan, if given.
|
|
336
|
+
* @return {Promise<void>} Resolves when the dialplan is successfully continued.
|
|
337
|
+
*/
|
|
155
338
|
continueDialplan(channelId: string, context?: string, extension?: string, priority?: number, label?: string): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* Stops the music on hold for the specified channel.
|
|
341
|
+
*
|
|
342
|
+
* @param {string} channelId - The unique identifier of the channel where music on hold should be stopped.
|
|
343
|
+
* @return {Promise<void>} Resolves when the music on hold is successfully stopped.
|
|
344
|
+
*/
|
|
156
345
|
stopMusicOnHold(channelId: string): Promise<void>;
|
|
346
|
+
/**
|
|
347
|
+
* Initiates the music on hold for the specified channel.
|
|
348
|
+
*
|
|
349
|
+
* @param {string} channelId - The unique identifier of the channel where the music on hold will be started.
|
|
350
|
+
* @return {Promise<void>} A promise that resolves when the operation has been successfully invoked.
|
|
351
|
+
*/
|
|
157
352
|
startMusicOnHold(channelId: string): Promise<void>;
|
|
353
|
+
/**
|
|
354
|
+
* Starts recording for a specific channel based on the provided options.
|
|
355
|
+
*
|
|
356
|
+
* @param {string} channelId - The unique identifier of the channel to start recording.
|
|
357
|
+
* @param {RecordingOptions} options - The recording options to configure the recording process.
|
|
358
|
+
* @return {Promise<Channel>} A promise that resolves to the channel object with updated recording state.
|
|
359
|
+
*/
|
|
158
360
|
record(channelId: string, options: RecordingOptions): Promise<Channel>;
|
|
361
|
+
/**
|
|
362
|
+
* Initiates a call on the specified channel with optional parameters for caller identification and timeout duration.
|
|
363
|
+
*
|
|
364
|
+
* @param {string} channelId - The ID of the channel where the call will be initiated.
|
|
365
|
+
* @param {string} [caller] - Optional parameter specifying the name or identifier of the caller.
|
|
366
|
+
* @param {number} [timeout] - Optional parameter defining the timeout duration for the call in seconds.
|
|
367
|
+
* @return {Promise<void>} A promise that resolves when the call has been successfully initiated.
|
|
368
|
+
*/
|
|
159
369
|
dial(channelId: string, caller?: string, timeout?: number): Promise<void>;
|
|
370
|
+
/**
|
|
371
|
+
* Redirects a channel to the specified endpoint.
|
|
372
|
+
*
|
|
373
|
+
* This method sends a POST request to update the redirect endpoint for the given channel.
|
|
374
|
+
*
|
|
375
|
+
* @param {string} channelId - The unique identifier of the channel to be redirected.
|
|
376
|
+
* @param {string} endpoint - The new endpoint to redirect the channel to.
|
|
377
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
378
|
+
*/
|
|
160
379
|
redirectChannel(channelId: string, endpoint: string): Promise<void>;
|
|
380
|
+
/**
|
|
381
|
+
* Answers a specified channel by sending a POST request to the corresponding endpoint.
|
|
382
|
+
*
|
|
383
|
+
* @param {string} channelId - The unique identifier of the channel to be answered.
|
|
384
|
+
* @return {Promise<void>} A promise that resolves when the channel has been successfully answered.
|
|
385
|
+
*/
|
|
161
386
|
answerChannel(channelId: string): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Rings the specified channel by sending a POST request to the appropriate endpoint.
|
|
389
|
+
*
|
|
390
|
+
* @param {string} channelId - The unique identifier of the channel to be rung.
|
|
391
|
+
* @return {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
392
|
+
*/
|
|
162
393
|
ringChannel(channelId: string): Promise<void>;
|
|
394
|
+
/**
|
|
395
|
+
* Stops the ring channel for the specified channel ID.
|
|
396
|
+
*
|
|
397
|
+
* This method sends a DELETE request to the server to stop the ring action
|
|
398
|
+
* associated with the provided channel ID.
|
|
399
|
+
*
|
|
400
|
+
* @param {string} channelId - The unique identifier of the channel for which the ring action should be stopped.
|
|
401
|
+
* @return {Promise<void>} A promise that resolves when the ring channel is successfully stopped.
|
|
402
|
+
*/
|
|
163
403
|
stopRingChannel(channelId: string): Promise<void>;
|
|
404
|
+
/**
|
|
405
|
+
* Sends DTMF (Dual-Tone Multi-Frequency) signals to a specified channel.
|
|
406
|
+
*
|
|
407
|
+
* @param {string} channelId - The ID of the channel to which the DTMF signals should be sent.
|
|
408
|
+
* @param {string} dtmf - The DTMF tones to be sent, represented as a string. Each character corresponds to a specific tone.
|
|
409
|
+
* @param {Object} [options] - Optional configuration for the DTMF signal timing.
|
|
410
|
+
* @param {number} [options.before] - Time in milliseconds to wait before sending the first DTMF tone.
|
|
411
|
+
* @param {number} [options.between] - Time in milliseconds to wait between sending successive DTMF tones.
|
|
412
|
+
* @param {number} [options.duration] - Duration in milliseconds for each DTMF tone.
|
|
413
|
+
* @param {number} [options.after] - Time in milliseconds to wait after sending the last DTMF tone.
|
|
414
|
+
* @return {Promise<void>} A promise that resolves when the DTMF signals are successfully sent.
|
|
415
|
+
*/
|
|
164
416
|
sendDTMF(channelId: string, dtmf: string, options?: {
|
|
165
417
|
before?: number;
|
|
166
418
|
between?: number;
|
|
167
419
|
duration?: number;
|
|
168
420
|
after?: number;
|
|
169
421
|
}): Promise<void>;
|
|
422
|
+
/**
|
|
423
|
+
* Mutes a specified channel in the given direction.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} channelId - The unique identifier of the channel to be muted.
|
|
426
|
+
* @param {"both" | "in" | "out"} [direction="both"] - The direction for muting, can be "both", "in", or "out". Default is "both".
|
|
427
|
+
* @return {Promise<void>} A promise that resolves when the channel is successfully muted.
|
|
428
|
+
*/
|
|
170
429
|
muteChannel(channelId: string, direction?: "both" | "in" | "out"): Promise<void>;
|
|
430
|
+
/**
|
|
431
|
+
* Unmutes a previously muted channel, allowing communication in the specified direction(s).
|
|
432
|
+
*
|
|
433
|
+
* @param {string} channelId - The unique identifier of the channel to be unmuted.
|
|
434
|
+
* @param {"both" | "in" | "out"} [direction="both"] - The direction of communication to unmute. Valid options are "both", "in" (incoming messages), or "out" (outgoing messages). Defaults to "both".
|
|
435
|
+
* @return {Promise<void>} A promise that resolves when the channel is successfully unmuted.
|
|
436
|
+
*/
|
|
171
437
|
unmuteChannel(channelId: string, direction?: "both" | "in" | "out"): Promise<void>;
|
|
438
|
+
/**
|
|
439
|
+
* Places a specific channel on hold by sending a POST request to the server.
|
|
440
|
+
*
|
|
441
|
+
* @param {string} channelId - The unique identifier of the channel to be placed on hold.
|
|
442
|
+
* @return {Promise<void>} A promise that resolves when the channel hold operation is completed.
|
|
443
|
+
*/
|
|
172
444
|
holdChannel(channelId: string): Promise<void>;
|
|
445
|
+
/**
|
|
446
|
+
* Removes the hold status from a specific channel by its ID.
|
|
447
|
+
*
|
|
448
|
+
* @param {string} channelId - The unique identifier of the channel to unhold.
|
|
449
|
+
* @return {Promise<void>} A promise that resolves when the channel hold is successfully removed.
|
|
450
|
+
*/
|
|
173
451
|
unholdChannel(channelId: string): Promise<void>;
|
|
452
|
+
/**
|
|
453
|
+
* Creates a new communication channel with the specified configuration.
|
|
454
|
+
*
|
|
455
|
+
* @param {OriginateRequest} data - The configuration data required to create the channel, including relevant details such as endpoint and channel variables.
|
|
456
|
+
* @return {Promise<Channel>} A promise that resolves with the details of the created channel.
|
|
457
|
+
*/
|
|
174
458
|
createChannel(data: OriginateRequest): Promise<Channel>;
|
|
459
|
+
/**
|
|
460
|
+
* Initiates a new channel with the specified channel ID and originates a call using the provided data.
|
|
461
|
+
*
|
|
462
|
+
* @param {string} channelId - The unique identifier of the channel to be created.
|
|
463
|
+
* @param {OriginateRequest} data - The data required to originate the call, including details such as endpoint and caller information.
|
|
464
|
+
* @return {Promise<Channel>} A promise that resolves to the created Channel object.
|
|
465
|
+
*/
|
|
175
466
|
originateWithId(channelId: string, data: OriginateRequest): Promise<Channel>;
|
|
176
467
|
}
|
|
177
468
|
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACf,MAAM,eAAe,C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