@per_moeller/asterisk-ari 1.0.3 → 1.0.5
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/client.d.ts +360 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +374 -29
- package/dist/client.js.map +1 -1
- package/dist/connection.d.ts +132 -12
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +121 -10
- package/dist/connection.js.map +1 -1
- package/dist/events/emitter.d.ts +213 -21
- package/dist/events/emitter.d.ts.map +1 -1
- package/dist/events/emitter.js +163 -17
- package/dist/events/emitter.js.map +1 -1
- package/dist/events/types.d.ts +386 -3
- package/dist/events/types.d.ts.map +1 -1
- package/dist/events/types.js +5 -0
- package/dist/events/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/bridge.d.ts +26 -3
- package/dist/models/bridge.d.ts.map +1 -1
- package/dist/models/bridge.js.map +1 -1
- package/dist/models/channel.d.ts +364 -35
- package/dist/models/channel.d.ts.map +1 -1
- package/dist/models/channel.js +348 -34
- package/dist/models/channel.js.map +1 -1
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/playback.d.ts +23 -3
- package/dist/models/playback.d.ts.map +1 -1
- package/dist/models/playback.js.map +1 -1
- package/dist/models/recording.d.ts +23 -3
- package/dist/models/recording.d.ts.map +1 -1
- package/dist/models/recording.js.map +1 -1
- package/dist/pool.d.ts +152 -11
- package/dist/pool.d.ts.map +1 -1
- package/dist/pool.js +152 -11
- package/dist/pool.js.map +1 -1
- package/dist/queue.d.ts +130 -16
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +123 -16
- package/dist/queue.js.map +1 -1
- package/dist/types/api.d.ts +655 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/api.js +5 -0
- package/dist/types/api.js.map +1 -1
- package/dist/version.d.ts +163 -26
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +143 -22
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/models/channel.d.ts
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Channel model and instance class
|
|
3
|
+
*
|
|
4
|
+
* This module provides the `ChannelInstance` class which wraps channel data
|
|
5
|
+
* and provides event handling and convenience methods for channel operations.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
3
8
|
*/
|
|
4
9
|
import type { AriClient } from '../client.js';
|
|
5
10
|
import type { Channel, ChannelState, CallerId, DialplanCEP, OriginateParams, HangupParams, ContinueParams, MoveParams, DTMFParams, PlayParams, RecordParams, SnoopParams, DialParams, RTPstat } from '../types/api.js';
|
|
6
11
|
import type { AriEventMap, ChannelEventType, StasisStartEvent, StasisEndEvent, ChannelDtmfReceivedEvent, ChannelStateChangeEvent, ChannelHangupRequestEvent, ChannelVarsetEvent, ChannelHoldEvent, ChannelUnholdEvent, ChannelTalkingStartedEvent, ChannelTalkingFinishedEvent, ChannelEnteredBridgeEvent, ChannelLeftBridgeEvent, DialEvent } from '../events/types.js';
|
|
7
12
|
import type { PlaybackInstance } from './playback.js';
|
|
8
13
|
import type { LiveRecordingInstance } from './recording.js';
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Event listener type for channel events.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam E - The event type
|
|
18
|
+
*/
|
|
19
|
+
export type ChannelEventListener<E> = (event: E, channel: ChannelInstance) => void | Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Map of channel event types to their listener signatures.
|
|
22
|
+
*
|
|
23
|
+
* Use this interface to type listener functions for channel events.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import type { ChannelEventListeners } from '@per_moeller/asterisk-ari';
|
|
28
|
+
*
|
|
29
|
+
* const dtmfHandler: ChannelEventListeners['ChannelDtmfReceived'] = (event, channel) => {
|
|
30
|
+
* console.log(`Received DTMF ${event.digit} on ${channel.name}`);
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* channel.on('ChannelDtmfReceived', dtmfHandler);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface ChannelEventListeners {
|
|
11
37
|
StasisStart: ChannelEventListener<StasisStartEvent>;
|
|
12
38
|
StasisEnd: ChannelEventListener<StasisEndEvent>;
|
|
13
39
|
ChannelStateChange: ChannelEventListener<ChannelStateChangeEvent>;
|
|
@@ -23,144 +49,447 @@ interface ChannelEventListeners {
|
|
|
23
49
|
Dial: ChannelEventListener<DialEvent>;
|
|
24
50
|
}
|
|
25
51
|
/**
|
|
26
|
-
* Channel instance with bound operations and event handling
|
|
52
|
+
* Channel instance with bound operations and event handling.
|
|
53
|
+
*
|
|
54
|
+
* A `ChannelInstance` wraps a channel and provides:
|
|
55
|
+
* - Event listeners scoped to this specific channel
|
|
56
|
+
* - Convenience methods that automatically use this channel's ID
|
|
57
|
+
* - Automatic data updates when events are received
|
|
58
|
+
*
|
|
59
|
+
* The instance implements the `Channel` interface, so you can access
|
|
60
|
+
* all channel properties directly.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Create instances using `client.Channel()` rather than instantiating directly.
|
|
64
|
+
* This ensures proper registration for event routing.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* // Create from an event
|
|
69
|
+
* client.on('StasisStart', (event, channelData) => {
|
|
70
|
+
* const channel = client.Channel(channelData.id, channelData);
|
|
71
|
+
*
|
|
72
|
+
* // Listen for events on this specific channel
|
|
73
|
+
* channel.on('ChannelDtmfReceived', (event) => {
|
|
74
|
+
* console.log(`Received: ${event.digit}`);
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* channel.on('StasisEnd', () => {
|
|
78
|
+
* console.log('Call ended');
|
|
79
|
+
* channel.removeAllListeners();
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // Perform operations
|
|
83
|
+
* await channel.answer();
|
|
84
|
+
* await channel.play({ media: 'sound:hello-world' });
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
27
87
|
*/
|
|
28
88
|
export declare class ChannelInstance implements Channel {
|
|
89
|
+
/** Unique identifier for this channel */
|
|
29
90
|
id: string;
|
|
91
|
+
/** Channel name in Asterisk format (e.g., "PJSIP/endpoint-00000001") */
|
|
30
92
|
name: string;
|
|
93
|
+
/** Current state of the channel */
|
|
31
94
|
state: ChannelState;
|
|
95
|
+
/** Caller ID information for the calling party */
|
|
32
96
|
caller: CallerId;
|
|
97
|
+
/** Caller ID information for the connected party */
|
|
33
98
|
connected: CallerId;
|
|
99
|
+
/** Account code for billing purposes */
|
|
34
100
|
accountcode: string;
|
|
101
|
+
/** Current position in the dialplan */
|
|
35
102
|
dialplan: DialplanCEP;
|
|
103
|
+
/** ISO 8601 timestamp when the channel was created */
|
|
36
104
|
creationtime: string;
|
|
105
|
+
/** Language code for the channel */
|
|
37
106
|
language: string;
|
|
107
|
+
/** Channel variables set on this channel */
|
|
38
108
|
channelvars?: Record<string, string>;
|
|
109
|
+
/** Protocol-specific identifier (Asterisk 20+) */
|
|
39
110
|
protocol_id?: string;
|
|
40
111
|
private readonly client;
|
|
41
112
|
private readonly listeners;
|
|
113
|
+
/**
|
|
114
|
+
* Create a new channel instance.
|
|
115
|
+
*
|
|
116
|
+
* @param client - The ARI client this instance belongs to
|
|
117
|
+
* @param id - Channel ID (auto-generated UUID if not provided)
|
|
118
|
+
* @param data - Initial channel data from an event or API response
|
|
119
|
+
*
|
|
120
|
+
* @internal - Use `client.Channel()` instead
|
|
121
|
+
*/
|
|
42
122
|
constructor(client: AriClient, id?: string, data?: Partial<Channel>);
|
|
43
123
|
/**
|
|
44
|
-
* Update channel data from an event or API response
|
|
124
|
+
* Update channel data from an event or API response.
|
|
125
|
+
*
|
|
126
|
+
* This is called automatically when channel events are received.
|
|
127
|
+
* You can also call it manually to update the instance with fresh data.
|
|
128
|
+
*
|
|
129
|
+
* @param data - Partial channel data to merge
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* // Manually refresh channel data
|
|
134
|
+
* const freshData = await client.channels.get(channel.id);
|
|
135
|
+
* channel.updateData(freshData);
|
|
136
|
+
* ```
|
|
45
137
|
*/
|
|
46
138
|
updateData(data: Partial<Channel>): void;
|
|
47
139
|
/**
|
|
48
|
-
* Add an event listener
|
|
140
|
+
* Add an event listener for this channel.
|
|
141
|
+
*
|
|
142
|
+
* Only events for this specific channel will trigger the listener.
|
|
143
|
+
* The listener receives the event and this channel instance.
|
|
144
|
+
*
|
|
145
|
+
* @param event - Event type to listen for
|
|
146
|
+
* @param listener - Callback function
|
|
147
|
+
* @returns This instance for chaining
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* channel.on('ChannelDtmfReceived', (event, channel) => {
|
|
152
|
+
* console.log(`DTMF ${event.digit} on ${channel.name}`);
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* channel.on('ChannelStateChange', (event, channel) => {
|
|
156
|
+
* console.log(`State changed to ${channel.state}`);
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
49
159
|
*/
|
|
50
160
|
on<K extends keyof ChannelEventListeners>(event: K, listener: ChannelEventListeners[K]): this;
|
|
51
161
|
/**
|
|
52
|
-
* Add a one-time event listener
|
|
162
|
+
* Add a one-time event listener for this channel.
|
|
163
|
+
*
|
|
164
|
+
* The listener is automatically removed after being invoked once.
|
|
165
|
+
*
|
|
166
|
+
* @param event - Event type to listen for
|
|
167
|
+
* @param listener - Callback function
|
|
168
|
+
* @returns This instance for chaining
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* channel.once('ChannelDtmfReceived', (event) => {
|
|
173
|
+
* console.log(`First DTMF: ${event.digit}`);
|
|
174
|
+
* });
|
|
175
|
+
* ```
|
|
53
176
|
*/
|
|
54
177
|
once<K extends keyof ChannelEventListeners>(event: K, listener: ChannelEventListeners[K]): this;
|
|
55
178
|
/**
|
|
56
|
-
* Remove an event listener
|
|
179
|
+
* Remove an event listener.
|
|
180
|
+
*
|
|
181
|
+
* @param event - Event type the listener was registered for
|
|
182
|
+
* @param listener - The listener function to remove
|
|
183
|
+
* @returns This instance for chaining
|
|
57
184
|
*/
|
|
58
185
|
off<K extends keyof ChannelEventListeners>(event: K, listener: ChannelEventListeners[K]): this;
|
|
59
186
|
/**
|
|
60
|
-
* Emit an event to listeners
|
|
61
|
-
*
|
|
187
|
+
* Emit an event to listeners.
|
|
188
|
+
*
|
|
189
|
+
* @param event - Event type to emit
|
|
190
|
+
* @param data - Event data
|
|
191
|
+
*
|
|
192
|
+
* @internal - Called by the client when routing events
|
|
62
193
|
*/
|
|
63
194
|
_emit<K extends ChannelEventType>(event: K, data: AriEventMap[K]): void;
|
|
64
195
|
/**
|
|
65
|
-
* Remove all event listeners and unregister from client
|
|
196
|
+
* Remove all event listeners and unregister from the client.
|
|
197
|
+
*
|
|
198
|
+
* Call this when you're done with the channel to clean up resources.
|
|
199
|
+
*
|
|
200
|
+
* @returns This instance for chaining
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* channel.on('StasisEnd', () => {
|
|
205
|
+
* channel.removeAllListeners();
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
66
208
|
*/
|
|
67
209
|
removeAllListeners(): this;
|
|
68
210
|
/**
|
|
69
|
-
* Originate a call to this channel
|
|
211
|
+
* Originate a call to this channel.
|
|
212
|
+
*
|
|
213
|
+
* @param params - Originate parameters (channelId is automatically set)
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const channel = client.Channel();
|
|
218
|
+
* await channel.originate({
|
|
219
|
+
* endpoint: 'PJSIP/1000',
|
|
220
|
+
* app: 'my-app'
|
|
221
|
+
* });
|
|
222
|
+
* ```
|
|
70
223
|
*/
|
|
71
224
|
originate(params: Omit<OriginateParams, 'channelId'>): Promise<void>;
|
|
72
225
|
/**
|
|
73
|
-
* Answer this channel
|
|
226
|
+
* Answer this channel.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* client.on('StasisStart', async (event, channel) => {
|
|
231
|
+
* await channel.answer();
|
|
232
|
+
* });
|
|
233
|
+
* ```
|
|
74
234
|
*/
|
|
75
235
|
answer(): Promise<void>;
|
|
76
236
|
/**
|
|
77
|
-
*
|
|
237
|
+
* Hang up this channel.
|
|
238
|
+
*
|
|
239
|
+
* @param params - Optional hangup parameters with reason code
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* // Normal hangup
|
|
244
|
+
* await channel.hangup();
|
|
245
|
+
*
|
|
246
|
+
* // Hangup with reason
|
|
247
|
+
* await channel.hangup({ reason: 'busy' });
|
|
248
|
+
* ```
|
|
78
249
|
*/
|
|
79
250
|
hangup(params?: HangupParams): Promise<void>;
|
|
80
251
|
/**
|
|
81
|
-
* Continue this channel in the dialplan
|
|
252
|
+
* Continue this channel in the dialplan.
|
|
253
|
+
*
|
|
254
|
+
* @param params - Optional dialplan location
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* await channel.continueInDialplan({
|
|
259
|
+
* context: 'default',
|
|
260
|
+
* extension: '200',
|
|
261
|
+
* priority: 1
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
82
264
|
*/
|
|
83
265
|
continueInDialplan(params?: ContinueParams): Promise<void>;
|
|
84
266
|
/**
|
|
85
|
-
* Move this channel to a different Stasis application
|
|
267
|
+
* Move this channel to a different Stasis application.
|
|
268
|
+
*
|
|
269
|
+
* @param params - Target application and arguments
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* await channel.move({
|
|
274
|
+
* app: 'other-app',
|
|
275
|
+
* appArgs: 'some,args'
|
|
276
|
+
* });
|
|
277
|
+
* ```
|
|
86
278
|
*/
|
|
87
279
|
move(params: MoveParams): Promise<void>;
|
|
88
280
|
/**
|
|
89
|
-
* Redirect this channel to a different
|
|
281
|
+
* Redirect this channel to a different endpoint.
|
|
282
|
+
*
|
|
283
|
+
* @param endpoint - Target endpoint
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* await channel.redirect('PJSIP/2000');
|
|
288
|
+
* ```
|
|
90
289
|
*/
|
|
91
290
|
redirect(endpoint: string): Promise<void>;
|
|
92
291
|
/**
|
|
93
|
-
* Indicate ringing to this channel
|
|
292
|
+
* Indicate ringing to this channel.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* await channel.ring();
|
|
297
|
+
* // ... do something ...
|
|
298
|
+
* await channel.ringStop();
|
|
299
|
+
* await channel.answer();
|
|
300
|
+
* ```
|
|
94
301
|
*/
|
|
95
302
|
ring(): Promise<void>;
|
|
96
303
|
/**
|
|
97
|
-
* Stop indicating ringing to this channel
|
|
304
|
+
* Stop indicating ringing to this channel.
|
|
98
305
|
*/
|
|
99
306
|
ringStop(): Promise<void>;
|
|
100
307
|
/**
|
|
101
|
-
* Send DTMF to this channel
|
|
308
|
+
* Send DTMF tones to this channel.
|
|
309
|
+
*
|
|
310
|
+
* @param params - DTMF digits and timing parameters
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* await channel.sendDTMF({
|
|
315
|
+
* dtmf: '1234#',
|
|
316
|
+
* between: 100
|
|
317
|
+
* });
|
|
318
|
+
* ```
|
|
102
319
|
*/
|
|
103
320
|
sendDTMF(params: DTMFParams): Promise<void>;
|
|
104
321
|
/**
|
|
105
|
-
* Mute this channel
|
|
322
|
+
* Mute this channel.
|
|
323
|
+
*
|
|
324
|
+
* @param direction - Direction to mute ('both', 'in', or 'out')
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* await channel.mute('both');
|
|
329
|
+
* // ... later ...
|
|
330
|
+
* await channel.unmute('both');
|
|
331
|
+
* ```
|
|
106
332
|
*/
|
|
107
333
|
mute(direction?: 'both' | 'in' | 'out'): Promise<void>;
|
|
108
334
|
/**
|
|
109
|
-
* Unmute this channel
|
|
335
|
+
* Unmute this channel.
|
|
336
|
+
*
|
|
337
|
+
* @param direction - Direction to unmute ('both', 'in', or 'out')
|
|
110
338
|
*/
|
|
111
339
|
unmute(direction?: 'both' | 'in' | 'out'): Promise<void>;
|
|
112
340
|
/**
|
|
113
|
-
* Put this channel on hold
|
|
341
|
+
* Put this channel on hold.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* await channel.hold();
|
|
346
|
+
* // ... later ...
|
|
347
|
+
* await channel.unhold();
|
|
348
|
+
* ```
|
|
114
349
|
*/
|
|
115
350
|
hold(): Promise<void>;
|
|
116
351
|
/**
|
|
117
|
-
* Remove this channel from hold
|
|
352
|
+
* Remove this channel from hold.
|
|
118
353
|
*/
|
|
119
354
|
unhold(): Promise<void>;
|
|
120
355
|
/**
|
|
121
|
-
* Start music on hold for this channel
|
|
356
|
+
* Start music on hold for this channel.
|
|
357
|
+
*
|
|
358
|
+
* @param mohClass - Optional music on hold class
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```typescript
|
|
362
|
+
* await channel.startMoh('jazz');
|
|
363
|
+
* // ... later ...
|
|
364
|
+
* await channel.stopMoh();
|
|
365
|
+
* ```
|
|
122
366
|
*/
|
|
123
367
|
startMoh(mohClass?: string): Promise<void>;
|
|
124
368
|
/**
|
|
125
|
-
* Stop music on hold for this channel
|
|
369
|
+
* Stop music on hold for this channel.
|
|
126
370
|
*/
|
|
127
371
|
stopMoh(): Promise<void>;
|
|
128
372
|
/**
|
|
129
|
-
* Start silence on this channel
|
|
373
|
+
* Start silence on this channel.
|
|
130
374
|
*/
|
|
131
375
|
startSilence(): Promise<void>;
|
|
132
376
|
/**
|
|
133
|
-
* Stop silence on this channel
|
|
377
|
+
* Stop silence on this channel.
|
|
134
378
|
*/
|
|
135
379
|
stopSilence(): Promise<void>;
|
|
136
380
|
/**
|
|
137
|
-
* Play media to this channel
|
|
381
|
+
* Play media to this channel.
|
|
382
|
+
*
|
|
383
|
+
* Returns a PlaybackInstance for controlling and monitoring the playback.
|
|
384
|
+
*
|
|
385
|
+
* @param params - Play parameters (media URI, language, etc.)
|
|
386
|
+
* @returns Playback instance
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* const playback = await channel.play({
|
|
391
|
+
* media: 'sound:hello-world'
|
|
392
|
+
* });
|
|
393
|
+
*
|
|
394
|
+
* playback.on('PlaybackFinished', () => {
|
|
395
|
+
* console.log('Playback complete');
|
|
396
|
+
* });
|
|
397
|
+
* ```
|
|
138
398
|
*/
|
|
139
399
|
play(params: PlayParams): Promise<PlaybackInstance>;
|
|
140
400
|
/**
|
|
141
|
-
* Record audio from this channel
|
|
401
|
+
* Record audio from this channel.
|
|
402
|
+
*
|
|
403
|
+
* Returns a LiveRecordingInstance for controlling and monitoring the recording.
|
|
404
|
+
*
|
|
405
|
+
* @param params - Record parameters (name, format, etc.)
|
|
406
|
+
* @returns LiveRecording instance
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* const recording = await channel.record({
|
|
411
|
+
* name: 'voicemail-123',
|
|
412
|
+
* format: 'wav',
|
|
413
|
+
* beep: true,
|
|
414
|
+
* terminateOn: '#'
|
|
415
|
+
* });
|
|
416
|
+
*
|
|
417
|
+
* recording.on('RecordingFinished', () => {
|
|
418
|
+
* console.log('Recording saved');
|
|
419
|
+
* });
|
|
420
|
+
* ```
|
|
142
421
|
*/
|
|
143
422
|
record(params: RecordParams): Promise<LiveRecordingInstance>;
|
|
144
423
|
/**
|
|
145
|
-
* Get a channel variable
|
|
424
|
+
* Get a channel variable.
|
|
425
|
+
*
|
|
426
|
+
* @param variable - Variable name to get
|
|
427
|
+
* @returns Variable value
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const value = await channel.getVariable('CALLERID(num)');
|
|
432
|
+
* console.log(`Caller: ${value}`);
|
|
433
|
+
* ```
|
|
146
434
|
*/
|
|
147
435
|
getVariable(variable: string): Promise<string>;
|
|
148
436
|
/**
|
|
149
|
-
* Set a channel variable
|
|
437
|
+
* Set a channel variable.
|
|
438
|
+
*
|
|
439
|
+
* @param variable - Variable name to set
|
|
440
|
+
* @param value - Variable value (undefined to unset)
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* await channel.setVariable('MY_VAR', 'some value');
|
|
445
|
+
* ```
|
|
150
446
|
*/
|
|
151
447
|
setVariable(variable: string, value?: string): Promise<void>;
|
|
152
448
|
/**
|
|
153
|
-
* Start snooping on this channel
|
|
449
|
+
* Start snooping (spying/whispering) on this channel.
|
|
450
|
+
*
|
|
451
|
+
* @param params - Snoop parameters (spy/whisper direction, app, etc.)
|
|
452
|
+
* @returns Channel instance for the snoop channel
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* const snoopChannel = await channel.snoop({
|
|
457
|
+
* spy: 'both',
|
|
458
|
+
* whisper: 'none',
|
|
459
|
+
* app: 'supervisor'
|
|
460
|
+
* });
|
|
461
|
+
* ```
|
|
154
462
|
*/
|
|
155
463
|
snoop(params: SnoopParams): Promise<ChannelInstance>;
|
|
156
464
|
/**
|
|
157
|
-
* Dial this channel
|
|
465
|
+
* Dial this channel (for channels created with create() instead of originate).
|
|
466
|
+
*
|
|
467
|
+
* @param params - Optional dial parameters
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* const channel = await client.channels.create({
|
|
472
|
+
* endpoint: 'PJSIP/1000',
|
|
473
|
+
* app: 'my-app'
|
|
474
|
+
* });
|
|
475
|
+
*
|
|
476
|
+
* const instance = client.Channel(channel.id, channel);
|
|
477
|
+
* await instance.dial({ timeout: 30 });
|
|
478
|
+
* ```
|
|
158
479
|
*/
|
|
159
480
|
dial(params?: DialParams): Promise<void>;
|
|
160
481
|
/**
|
|
161
|
-
* Get RTP statistics for this channel
|
|
482
|
+
* Get RTP statistics for this channel.
|
|
483
|
+
*
|
|
484
|
+
* @returns RTP statistics including jitter, packet loss, RTT
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```typescript
|
|
488
|
+
* const stats = await channel.getRtpStatistics();
|
|
489
|
+
* console.log(`Jitter: ${stats.rxjitter}ms`);
|
|
490
|
+
* console.log(`Packet loss: ${stats.rxploss}`);
|
|
491
|
+
* ```
|
|
162
492
|
*/
|
|
163
493
|
getRtpStatistics(): Promise<RTPstat>;
|
|
164
494
|
}
|
|
165
|
-
export {};
|
|
166
495
|
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/models/channel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/models/channel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,WAAW,E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