@ipcom/asterisk-ari 0.0.139 → 0.0.141
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 +311 -0
- package/dist/cjs/index.cjs +1032 -269
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/esm/index.js +1035 -270
- 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 +351 -48
- package/dist/types/ari-client/resources/channels.d.ts.map +1 -1
- package/dist/types/ari-client/resources/playbacks.d.ts +93 -20
- 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,479 @@ 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);
|
|
111
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Creates or retrieves a ChannelInstance.
|
|
192
|
+
*
|
|
193
|
+
* @param {Object} [params] - Optional parameters for getting/creating a channel instance
|
|
194
|
+
* @param {string} [params.id] - Optional ID of an existing channel
|
|
195
|
+
* @returns {ChannelInstance} The requested or new channel instance
|
|
196
|
+
* @throws {Error} If channel creation/retrieval fails
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* // Create new channel without ID
|
|
200
|
+
* const channel1 = client.channels.Channel();
|
|
201
|
+
*
|
|
202
|
+
* // Create/retrieve channel with specific ID
|
|
203
|
+
* const channel2 = client.channels.Channel({ id: 'some-id' });
|
|
204
|
+
*/
|
|
205
|
+
Channel(params?: {
|
|
112
206
|
id?: string;
|
|
113
207
|
}): ChannelInstance;
|
|
114
208
|
/**
|
|
115
|
-
*
|
|
209
|
+
* Removes a channel instance from the collection.
|
|
116
210
|
*/
|
|
117
211
|
removeChannelInstance(channelId: string): void;
|
|
118
212
|
/**
|
|
119
|
-
*
|
|
213
|
+
* Propagates a WebSocket event to a specific channel.
|
|
120
214
|
*/
|
|
121
215
|
propagateEventToChannel(event: WebSocketEvent): void;
|
|
122
216
|
/**
|
|
123
|
-
*
|
|
217
|
+
* Initiates a new channel.
|
|
124
218
|
*/
|
|
125
219
|
originate(data: OriginateRequest): Promise<Channel>;
|
|
126
220
|
/**
|
|
127
|
-
*
|
|
221
|
+
* Lists all active channels.
|
|
128
222
|
*/
|
|
129
|
-
|
|
223
|
+
list(): Promise<Channel[]>;
|
|
130
224
|
/**
|
|
131
|
-
*
|
|
225
|
+
* Gets the count of active channel instances.
|
|
132
226
|
*/
|
|
133
|
-
|
|
227
|
+
getInstanceCount(): number;
|
|
228
|
+
/**
|
|
229
|
+
* Checks if a channel instance exists.
|
|
230
|
+
*/
|
|
231
|
+
hasInstance(channelId: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Gets all active channel instances.
|
|
234
|
+
*/
|
|
235
|
+
getAllInstances(): Map<string, ChannelInstance>;
|
|
134
236
|
/**
|
|
135
|
-
*
|
|
237
|
+
* Terminates an active call on the specified channel.
|
|
238
|
+
*
|
|
239
|
+
* @param {string} channelId - The unique identifier of the channel to hang up.
|
|
240
|
+
* @param {Object} [options] - Optional parameters for the hangup request.
|
|
241
|
+
* @param {string} [options.reason_code] - A code indicating the reason for the hangup.
|
|
242
|
+
* @param {string} [options.reason] - A descriptive reason for the hangup.
|
|
243
|
+
* @return {Promise<void>} A promise that resolves when the call has been successfully terminated.
|
|
136
244
|
*/
|
|
137
245
|
hangup(channelId: string, options?: {
|
|
138
246
|
reason_code?: string;
|
|
139
247
|
reason?: string;
|
|
140
248
|
}): Promise<void>;
|
|
141
249
|
/**
|
|
142
|
-
*
|
|
250
|
+
* Initiates snooping on a specified channel with the provided options.
|
|
251
|
+
*
|
|
252
|
+
* @param {string} channelId - The unique identifier of the channel to snoop on.
|
|
253
|
+
* @param {SnoopOptions} options - Configuration options for the snooping operation.
|
|
254
|
+
* @return {Promise<Channel>} A promise that resolves to the snooped channel data.
|
|
143
255
|
*/
|
|
144
256
|
snoopChannel(channelId: string, options: SnoopOptions): Promise<Channel>;
|
|
257
|
+
/**
|
|
258
|
+
* Starts a silence mode for the specified channel.
|
|
259
|
+
*
|
|
260
|
+
* @param {string} channelId - The unique identifier of the channel where silence mode should be started.
|
|
261
|
+
* @return {Promise<void>} A promise that resolves when the silence mode is successfully started.
|
|
262
|
+
*/
|
|
145
263
|
startSilence(channelId: string): Promise<void>;
|
|
264
|
+
/**
|
|
265
|
+
* Stops the silence mode for a specific channel.
|
|
266
|
+
*
|
|
267
|
+
* @param {string} channelId - The unique identifier of the channel for which silence mode should be stopped.
|
|
268
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
269
|
+
*/
|
|
146
270
|
stopSilence(channelId: string): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Retrieves the Real-Time Protocol (RTP) statistics for a specific channel.
|
|
273
|
+
*
|
|
274
|
+
* @param {string} channelId - The unique identifier of the channel for which RTP statistics are fetched.
|
|
275
|
+
* @return {Promise<RTPStats>} A promise that resolves to the RTP statistics for the specified channel.
|
|
276
|
+
*/
|
|
147
277
|
getRTPStatistics(channelId: string): Promise<RTPStats>;
|
|
278
|
+
/**
|
|
279
|
+
* Creates an external media channel with the given options.
|
|
280
|
+
*
|
|
281
|
+
* @param {ExternalMediaOptions} options - The configuration options for creating the external media channel.
|
|
282
|
+
* @return {Promise<Channel>} A promise that resolves with the created external media channel.
|
|
283
|
+
*/
|
|
148
284
|
createExternalMedia(options: ExternalMediaOptions): Promise<Channel>;
|
|
285
|
+
/**
|
|
286
|
+
* Initiates playback of a specific media item on a channel using the provided playback ID.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} channelId - The unique identifier of the channel where playback will occur.
|
|
289
|
+
* @param {string} playbackId - The unique identifier for the specific playback session.
|
|
290
|
+
* @param {string} media - The media content to be played.
|
|
291
|
+
* @param {PlaybackOptions} [options] - Optional playback configuration parameters.
|
|
292
|
+
* @return {Promise<ChannelPlayback>} A promise that resolves with the playback details for the channel.
|
|
293
|
+
*/
|
|
149
294
|
playWithId(channelId: string, playbackId: string, media: string, options?: PlaybackOptions): Promise<ChannelPlayback>;
|
|
295
|
+
/**
|
|
296
|
+
* Initiates a snoop operation on a specific channel using the provided channel ID and snoop ID.
|
|
297
|
+
*
|
|
298
|
+
* @param {string} channelId - The unique identifier of the channel to snoop on.
|
|
299
|
+
* @param {string} snoopId - The unique identifier for the snoop operation.
|
|
300
|
+
* @param {SnoopOptions} options - Additional options and parameters for the snoop operation.
|
|
301
|
+
* @return {Promise<Channel>} A promise that resolves to the channel details after the snoop operation is initiated.
|
|
302
|
+
*/
|
|
150
303
|
snoopChannelWithId(channelId: string, snoopId: string, options: SnoopOptions): Promise<Channel>;
|
|
304
|
+
/**
|
|
305
|
+
* Starts Music on Hold for the specified channel with the provided Music on Hold class.
|
|
306
|
+
*
|
|
307
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
308
|
+
* @param {string} mohClass - The Music on Hold class to be applied.
|
|
309
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
310
|
+
*/
|
|
151
311
|
startMohWithClass(channelId: string, mohClass: string): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Retrieves the value of a specified variable for a given channel.
|
|
314
|
+
*
|
|
315
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
316
|
+
* @param {string} variable - The name of the variable to retrieve.
|
|
317
|
+
* @return {Promise<ChannelVar>} A promise that resolves to the value of the channel variable.
|
|
318
|
+
* @throws {Error} Throws an error if the 'variable' parameter is not provided.
|
|
319
|
+
*/
|
|
152
320
|
getChannelVariable(channelId: string, variable: string): Promise<ChannelVar>;
|
|
321
|
+
/**
|
|
322
|
+
* Sets a variable for a specific channel.
|
|
323
|
+
*
|
|
324
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
325
|
+
* @param {string} variable - The name of the variable to be set. This parameter is required.
|
|
326
|
+
* @param {string} [value] - The value of the variable to be set. This parameter is optional.
|
|
327
|
+
* @return {Promise<void>} A promise that resolves when the variable is successfully set.
|
|
328
|
+
* @throws {Error} Throws an error if the `variable` parameter is not provided.
|
|
329
|
+
*/
|
|
153
330
|
setChannelVariable(channelId: string, variable: string, value?: string): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Moves a specified channel to the given application with optional arguments.
|
|
333
|
+
*
|
|
334
|
+
* @param {string} channelId - The unique identifier of the channel to be moved.
|
|
335
|
+
* @param {string} app - The target application to which the channel will be moved.
|
|
336
|
+
* @param {string} [appArgs] - Optional arguments to be passed to the target application.
|
|
337
|
+
* @return {Promise<void>} A promise that resolves when the operation is completed.
|
|
338
|
+
*/
|
|
154
339
|
moveToApplication(channelId: string, app: string, appArgs?: string): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* Continues the execution of a dialplan for a specific channel.
|
|
342
|
+
*
|
|
343
|
+
* @param {string} channelId - The unique identifier of the channel.
|
|
344
|
+
* @param {string} [context] - The dialplan context to continue execution in, if specified.
|
|
345
|
+
* @param {string} [extension] - The dialplan extension to proceed with, if provided.
|
|
346
|
+
* @param {number} [priority] - The priority within the dialplan extension to resume at, if specified.
|
|
347
|
+
* @param {string} [label] - The label to start from within the dialplan, if given.
|
|
348
|
+
* @return {Promise<void>} Resolves when the dialplan is successfully continued.
|
|
349
|
+
*/
|
|
155
350
|
continueDialplan(channelId: string, context?: string, extension?: string, priority?: number, label?: string): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Stops the music on hold for the specified channel.
|
|
353
|
+
*
|
|
354
|
+
* @param {string} channelId - The unique identifier of the channel where music on hold should be stopped.
|
|
355
|
+
* @return {Promise<void>} Resolves when the music on hold is successfully stopped.
|
|
356
|
+
*/
|
|
156
357
|
stopMusicOnHold(channelId: string): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* Initiates the music on hold for the specified channel.
|
|
360
|
+
*
|
|
361
|
+
* @param {string} channelId - The unique identifier of the channel where the music on hold will be started.
|
|
362
|
+
* @return {Promise<void>} A promise that resolves when the operation has been successfully invoked.
|
|
363
|
+
*/
|
|
157
364
|
startMusicOnHold(channelId: string): Promise<void>;
|
|
365
|
+
/**
|
|
366
|
+
* Starts recording for a specific channel based on the provided options.
|
|
367
|
+
*
|
|
368
|
+
* @param {string} channelId - The unique identifier of the channel to start recording.
|
|
369
|
+
* @param {RecordingOptions} options - The recording options to configure the recording process.
|
|
370
|
+
* @return {Promise<Channel>} A promise that resolves to the channel object with updated recording state.
|
|
371
|
+
*/
|
|
158
372
|
record(channelId: string, options: RecordingOptions): Promise<Channel>;
|
|
373
|
+
/**
|
|
374
|
+
* Initiates a call on the specified channel with optional parameters for caller identification and timeout duration.
|
|
375
|
+
*
|
|
376
|
+
* @param {string} channelId - The ID of the channel where the call will be initiated.
|
|
377
|
+
* @param {string} [caller] - Optional parameter specifying the name or identifier of the caller.
|
|
378
|
+
* @param {number} [timeout] - Optional parameter defining the timeout duration for the call in seconds.
|
|
379
|
+
* @return {Promise<void>} A promise that resolves when the call has been successfully initiated.
|
|
380
|
+
*/
|
|
159
381
|
dial(channelId: string, caller?: string, timeout?: number): Promise<void>;
|
|
382
|
+
/**
|
|
383
|
+
* Redirects a channel to the specified endpoint.
|
|
384
|
+
*
|
|
385
|
+
* This method sends a POST request to update the redirect endpoint for the given channel.
|
|
386
|
+
*
|
|
387
|
+
* @param {string} channelId - The unique identifier of the channel to be redirected.
|
|
388
|
+
* @param {string} endpoint - The new endpoint to redirect the channel to.
|
|
389
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
390
|
+
*/
|
|
160
391
|
redirectChannel(channelId: string, endpoint: string): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* Answers a specified channel by sending a POST request to the corresponding endpoint.
|
|
394
|
+
*
|
|
395
|
+
* @param {string} channelId - The unique identifier of the channel to be answered.
|
|
396
|
+
* @return {Promise<void>} A promise that resolves when the channel has been successfully answered.
|
|
397
|
+
*/
|
|
161
398
|
answerChannel(channelId: string): Promise<void>;
|
|
399
|
+
/**
|
|
400
|
+
* Rings the specified channel by sending a POST request to the appropriate endpoint.
|
|
401
|
+
*
|
|
402
|
+
* @param {string} channelId - The unique identifier of the channel to be rung.
|
|
403
|
+
* @return {Promise<void>} A promise that resolves when the operation completes successfully.
|
|
404
|
+
*/
|
|
162
405
|
ringChannel(channelId: string): Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* Stops the ring channel for the specified channel ID.
|
|
408
|
+
*
|
|
409
|
+
* This method sends a DELETE request to the server to stop the ring action
|
|
410
|
+
* associated with the provided channel ID.
|
|
411
|
+
*
|
|
412
|
+
* @param {string} channelId - The unique identifier of the channel for which the ring action should be stopped.
|
|
413
|
+
* @return {Promise<void>} A promise that resolves when the ring channel is successfully stopped.
|
|
414
|
+
*/
|
|
163
415
|
stopRingChannel(channelId: string): Promise<void>;
|
|
416
|
+
/**
|
|
417
|
+
* Sends DTMF (Dual-Tone Multi-Frequency) signals to a specified channel.
|
|
418
|
+
*
|
|
419
|
+
* @param {string} channelId - The ID of the channel to which the DTMF signals should be sent.
|
|
420
|
+
* @param {string} dtmf - The DTMF tones to be sent, represented as a string. Each character corresponds to a specific tone.
|
|
421
|
+
* @param {Object} [options] - Optional configuration for the DTMF signal timing.
|
|
422
|
+
* @param {number} [options.before] - Time in milliseconds to wait before sending the first DTMF tone.
|
|
423
|
+
* @param {number} [options.between] - Time in milliseconds to wait between sending successive DTMF tones.
|
|
424
|
+
* @param {number} [options.duration] - Duration in milliseconds for each DTMF tone.
|
|
425
|
+
* @param {number} [options.after] - Time in milliseconds to wait after sending the last DTMF tone.
|
|
426
|
+
* @return {Promise<void>} A promise that resolves when the DTMF signals are successfully sent.
|
|
427
|
+
*/
|
|
164
428
|
sendDTMF(channelId: string, dtmf: string, options?: {
|
|
165
429
|
before?: number;
|
|
166
430
|
between?: number;
|
|
167
431
|
duration?: number;
|
|
168
432
|
after?: number;
|
|
169
433
|
}): Promise<void>;
|
|
434
|
+
/**
|
|
435
|
+
* Mutes a specified channel in the given direction.
|
|
436
|
+
*
|
|
437
|
+
* @param {string} channelId - The unique identifier of the channel to be muted.
|
|
438
|
+
* @param {"both" | "in" | "out"} [direction="both"] - The direction for muting, can be "both", "in", or "out". Default is "both".
|
|
439
|
+
* @return {Promise<void>} A promise that resolves when the channel is successfully muted.
|
|
440
|
+
*/
|
|
170
441
|
muteChannel(channelId: string, direction?: "both" | "in" | "out"): Promise<void>;
|
|
442
|
+
/**
|
|
443
|
+
* Unmutes a previously muted channel, allowing communication in the specified direction(s).
|
|
444
|
+
*
|
|
445
|
+
* @param {string} channelId - The unique identifier of the channel to be unmuted.
|
|
446
|
+
* @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".
|
|
447
|
+
* @return {Promise<void>} A promise that resolves when the channel is successfully unmuted.
|
|
448
|
+
*/
|
|
171
449
|
unmuteChannel(channelId: string, direction?: "both" | "in" | "out"): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* Places a specific channel on hold by sending a POST request to the server.
|
|
452
|
+
*
|
|
453
|
+
* @param {string} channelId - The unique identifier of the channel to be placed on hold.
|
|
454
|
+
* @return {Promise<void>} A promise that resolves when the channel hold operation is completed.
|
|
455
|
+
*/
|
|
172
456
|
holdChannel(channelId: string): Promise<void>;
|
|
457
|
+
/**
|
|
458
|
+
* Removes the hold status from a specific channel by its ID.
|
|
459
|
+
*
|
|
460
|
+
* @param {string} channelId - The unique identifier of the channel to unhold.
|
|
461
|
+
* @return {Promise<void>} A promise that resolves when the channel hold is successfully removed.
|
|
462
|
+
*/
|
|
173
463
|
unholdChannel(channelId: string): Promise<void>;
|
|
464
|
+
/**
|
|
465
|
+
* Creates a new communication channel with the specified configuration.
|
|
466
|
+
*
|
|
467
|
+
* @param {OriginateRequest} data - The configuration data required to create the channel, including relevant details such as endpoint and channel variables.
|
|
468
|
+
* @return {Promise<Channel>} A promise that resolves with the details of the created channel.
|
|
469
|
+
*/
|
|
174
470
|
createChannel(data: OriginateRequest): Promise<Channel>;
|
|
471
|
+
/**
|
|
472
|
+
* Initiates a new channel with the specified channel ID and originates a call using the provided data.
|
|
473
|
+
*
|
|
474
|
+
* @param {string} channelId - The unique identifier of the channel to be created.
|
|
475
|
+
* @param {OriginateRequest} data - The data required to originate the call, including details such as endpoint and caller information.
|
|
476
|
+
* @return {Promise<Channel>} A promise that resolves to the created Channel object.
|
|
477
|
+
*/
|
|
175
478
|
originateWithId(channelId: string, data: OriginateRequest): Promise<Channel>;
|
|
176
479
|
}
|
|
177
480
|
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/ari-client/resources/channels.ts"],"names":[],"mappings":"AAGA,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,YA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