@per_moeller/asterisk-ari 1.0.2 → 1.0.4

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.
@@ -1,258 +1,619 @@
1
1
  /**
2
2
  * ARI Event type definitions
3
+ *
4
+ * This module contains TypeScript type definitions for all Asterisk ARI WebSocket events.
5
+ * Events are emitted when state changes occur in Asterisk (calls, bridges, playbacks, etc.).
6
+ *
7
+ * @packageDocumentation
3
8
  */
4
9
  import type { Bridge, Channel, DeviceState, Endpoint, LiveRecording, Playback } from '../types/api.js';
10
+ /**
11
+ * Base interface for all ARI events.
12
+ *
13
+ * All events share these common properties that identify the event type,
14
+ * source application, and timing.
15
+ */
5
16
  export interface BaseEvent {
17
+ /** Event type identifier (e.g., "StasisStart", "ChannelDestroyed") */
6
18
  type: string;
19
+ /** Name of the Stasis application receiving this event */
7
20
  application: string;
21
+ /** ISO 8601 timestamp when the event occurred */
8
22
  timestamp: string;
23
+ /** Unique identifier for the Asterisk instance (useful in clustered setups) */
9
24
  asterisk_id?: string;
10
25
  }
26
+ /**
27
+ * Emitted when a channel enters a Stasis application.
28
+ *
29
+ * This is typically the first event you receive for an incoming call.
30
+ * The channel is now under your application's control.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * client.on('StasisStart', (event, channel) => {
35
+ * console.log(`Call from ${channel.caller.number}`);
36
+ * console.log(`Application args: ${event.args.join(', ')}`);
37
+ * await channel.answer();
38
+ * });
39
+ * ```
40
+ */
11
41
  export interface StasisStartEvent extends BaseEvent {
12
42
  type: 'StasisStart';
43
+ /** Arguments passed to the Stasis application */
13
44
  args: string[];
45
+ /** The channel entering Stasis */
14
46
  channel: Channel;
47
+ /** Channel being replaced (for channel takeover scenarios) */
15
48
  replace_channel?: Channel;
16
49
  }
50
+ /**
51
+ * Emitted when a channel leaves a Stasis application.
52
+ *
53
+ * After this event, the channel is no longer under your application's control.
54
+ * This occurs when the channel hangs up, is redirected, or moves to another app.
55
+ */
17
56
  export interface StasisEndEvent extends BaseEvent {
18
57
  type: 'StasisEnd';
58
+ /** The channel leaving Stasis */
19
59
  channel: Channel;
20
60
  }
61
+ /**
62
+ * Emitted when a new channel is created.
63
+ *
64
+ * This event occurs for any channel creation in Asterisk, not just
65
+ * channels in your Stasis application.
66
+ */
21
67
  export interface ChannelCreatedEvent extends BaseEvent {
22
68
  type: 'ChannelCreated';
69
+ /** The newly created channel */
23
70
  channel: Channel;
24
71
  }
72
+ /**
73
+ * Emitted when a channel is destroyed (hung up).
74
+ *
75
+ * Contains the hangup cause code which indicates why the call ended.
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * client.on('ChannelDestroyed', (event, channel) => {
80
+ * console.log(`Channel ${channel.name} destroyed`);
81
+ * console.log(`Cause: ${event.cause} (${event.cause_txt})`);
82
+ * });
83
+ * ```
84
+ */
25
85
  export interface ChannelDestroyedEvent extends BaseEvent {
26
86
  type: 'ChannelDestroyed';
87
+ /** The destroyed channel */
27
88
  channel: Channel;
89
+ /** Numeric hangup cause code */
28
90
  cause: number;
91
+ /** Human-readable hangup cause description */
29
92
  cause_txt: string;
30
93
  }
94
+ /**
95
+ * Emitted when a channel's state changes.
96
+ *
97
+ * Common state transitions:
98
+ * - Down → Ringing (incoming call)
99
+ * - Ringing → Up (call answered)
100
+ * - Up → Down (call ended)
101
+ */
31
102
  export interface ChannelStateChangeEvent extends BaseEvent {
32
103
  type: 'ChannelStateChange';
104
+ /** The channel with updated state */
33
105
  channel: Channel;
34
106
  }
107
+ /**
108
+ * Emitted when DTMF is received on a channel.
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * let dtmfBuffer = '';
113
+ * channel.on('ChannelDtmfReceived', (event) => {
114
+ * dtmfBuffer += event.digit;
115
+ * if (event.digit === '#') {
116
+ * console.log(`User entered: ${dtmfBuffer}`);
117
+ * dtmfBuffer = '';
118
+ * }
119
+ * });
120
+ * ```
121
+ */
35
122
  export interface ChannelDtmfReceivedEvent extends BaseEvent {
36
123
  type: 'ChannelDtmfReceived';
124
+ /** The channel that received DTMF */
37
125
  channel: Channel;
126
+ /** The DTMF digit received (0-9, A-D, *, #) */
38
127
  digit: string;
128
+ /** Duration the digit was pressed in milliseconds */
39
129
  duration_ms: number;
40
130
  }
131
+ /**
132
+ * Emitted when a hangup is requested for a channel.
133
+ *
134
+ * This occurs before the actual hangup. You can use this to perform
135
+ * cleanup actions before the channel is destroyed.
136
+ */
41
137
  export interface ChannelHangupRequestEvent extends BaseEvent {
42
138
  type: 'ChannelHangupRequest';
139
+ /** The channel being hung up */
43
140
  channel: Channel;
141
+ /** Whether this is a soft hangup (can be canceled) */
44
142
  soft?: boolean;
143
+ /** Hangup cause code if specified */
45
144
  cause?: number;
46
145
  }
146
+ /**
147
+ * Emitted when a channel variable is set.
148
+ *
149
+ * Note: The channel may be undefined for global variable sets.
150
+ */
47
151
  export interface ChannelVarsetEvent extends BaseEvent {
48
152
  type: 'ChannelVarset';
153
+ /** The channel the variable was set on (undefined for global variables) */
49
154
  channel?: Channel;
155
+ /** Name of the variable */
50
156
  variable: string;
157
+ /** Value of the variable */
51
158
  value: string;
52
159
  }
160
+ /**
161
+ * Emitted when a channel is placed on hold.
162
+ */
53
163
  export interface ChannelHoldEvent extends BaseEvent {
54
164
  type: 'ChannelHold';
165
+ /** The channel placed on hold */
55
166
  channel: Channel;
167
+ /** Music on hold class to play */
56
168
  musicclass?: string;
57
169
  }
170
+ /**
171
+ * Emitted when a channel is taken off hold.
172
+ */
58
173
  export interface ChannelUnholdEvent extends BaseEvent {
59
174
  type: 'ChannelUnhold';
175
+ /** The channel removed from hold */
60
176
  channel: Channel;
61
177
  }
178
+ /**
179
+ * Emitted when talking is detected on a channel.
180
+ *
181
+ * Requires talk detection to be enabled on the channel.
182
+ */
62
183
  export interface ChannelTalkingStartedEvent extends BaseEvent {
63
184
  type: 'ChannelTalkingStarted';
185
+ /** The channel where talking started */
64
186
  channel: Channel;
65
187
  }
188
+ /**
189
+ * Emitted when talking stops on a channel.
190
+ *
191
+ * Requires talk detection to be enabled on the channel.
192
+ */
66
193
  export interface ChannelTalkingFinishedEvent extends BaseEvent {
67
194
  type: 'ChannelTalkingFinished';
195
+ /** The channel where talking stopped */
68
196
  channel: Channel;
197
+ /** Duration of talking in milliseconds */
69
198
  duration: number;
70
199
  }
200
+ /**
201
+ * Emitted when the connected line information changes.
202
+ *
203
+ * This typically occurs during call transfers or when caller ID is updated.
204
+ */
71
205
  export interface ChannelConnectedLineEvent extends BaseEvent {
72
206
  type: 'ChannelConnectedLine';
207
+ /** The channel with updated connected line info */
73
208
  channel: Channel;
74
209
  }
210
+ /**
211
+ * Emitted when a channel enters a dialplan application.
212
+ *
213
+ * Only emitted for subscribed channels executing dialplan.
214
+ */
75
215
  export interface ChannelDialplanEvent extends BaseEvent {
76
216
  type: 'ChannelDialplan';
217
+ /** The channel executing dialplan */
77
218
  channel: Channel;
219
+ /** Dialplan application name */
78
220
  dialplan_app: string;
221
+ /** Arguments passed to the dialplan application */
79
222
  dialplan_app_data: string;
80
223
  }
224
+ /**
225
+ * Emitted when caller ID changes on a channel.
226
+ */
81
227
  export interface ChannelCallerIdEvent extends BaseEvent {
82
228
  type: 'ChannelCallerId';
229
+ /** The channel with updated caller ID */
83
230
  channel: Channel;
231
+ /** Numeric presentation value */
84
232
  caller_presentation: number;
233
+ /** Human-readable presentation description */
85
234
  caller_presentation_txt: string;
86
235
  }
87
- /** Asterisk 22+ */
236
+ /**
237
+ * Emitted when a tone is detected on a channel.
238
+ *
239
+ * @since Asterisk 22+
240
+ */
88
241
  export interface ChannelToneDetectedEvent extends BaseEvent {
89
242
  type: 'ChannelToneDetected';
243
+ /** The channel where tone was detected */
90
244
  channel: Channel;
91
245
  }
246
+ /**
247
+ * Emitted when a bridge is created.
248
+ */
92
249
  export interface BridgeCreatedEvent extends BaseEvent {
93
250
  type: 'BridgeCreated';
251
+ /** The newly created bridge */
94
252
  bridge: Bridge;
95
253
  }
254
+ /**
255
+ * Emitted when a bridge is destroyed.
256
+ */
96
257
  export interface BridgeDestroyedEvent extends BaseEvent {
97
258
  type: 'BridgeDestroyed';
259
+ /** The destroyed bridge */
98
260
  bridge: Bridge;
99
261
  }
262
+ /**
263
+ * Emitted when two bridges are merged.
264
+ */
100
265
  export interface BridgeMergedEvent extends BaseEvent {
101
266
  type: 'BridgeMerged';
267
+ /** The resulting bridge after merge */
102
268
  bridge: Bridge;
269
+ /** The bridge that was merged into the other */
103
270
  bridge_from: Bridge;
104
271
  }
272
+ /**
273
+ * Emitted when the video source changes in a bridge.
274
+ */
105
275
  export interface BridgeVideoSourceChangedEvent extends BaseEvent {
106
276
  type: 'BridgeVideoSourceChanged';
277
+ /** The bridge with changed video source */
107
278
  bridge: Bridge;
279
+ /** Previous video source channel ID */
108
280
  old_video_source_id?: string;
109
281
  }
282
+ /**
283
+ * Emitted when a blind transfer is performed.
284
+ *
285
+ * A blind transfer sends a call to a destination without consulting first.
286
+ */
110
287
  export interface BridgeBlindTransferEvent extends BaseEvent {
111
288
  type: 'BridgeBlindTransfer';
289
+ /** Channel performing the transfer */
112
290
  channel: Channel;
291
+ /** Channel replacing the transferer */
113
292
  replace_channel?: Channel;
293
+ /** Channel being transferred */
114
294
  transferee?: Channel;
295
+ /** Extension the call is being transferred to */
115
296
  exten: string;
297
+ /** Dialplan context for the transfer */
116
298
  context: string;
299
+ /** Transfer result (e.g., "Success", "Fail") */
117
300
  result: string;
301
+ /** Whether the transfer is to an external destination */
118
302
  is_external: boolean;
303
+ /** Bridge involved in the transfer */
119
304
  bridge?: Bridge;
120
305
  }
306
+ /**
307
+ * Emitted when an attended transfer is performed.
308
+ *
309
+ * An attended transfer involves the transferer consulting with the
310
+ * transfer target before completing the transfer.
311
+ */
121
312
  export interface BridgeAttendedTransferEvent extends BaseEvent {
122
313
  type: 'BridgeAttendedTransfer';
314
+ /** First leg of the transferer's channels */
123
315
  transferer_first_leg: Channel;
316
+ /** Second leg of the transferer's channels */
124
317
  transferer_second_leg: Channel;
318
+ /** Channel replacing the transferer */
125
319
  replace_channel?: Channel;
320
+ /** Channel being transferred */
126
321
  transferee?: Channel;
322
+ /** Transfer target channel */
127
323
  transfer_target?: Channel;
324
+ /** Transfer result (e.g., "Success", "Fail") */
128
325
  result: string;
326
+ /** Whether the transfer is to an external destination */
129
327
  is_external: boolean;
328
+ /** Bridge for the first leg */
130
329
  transferer_first_leg_bridge?: Bridge;
330
+ /** Bridge for the second leg */
131
331
  transferer_second_leg_bridge?: Bridge;
332
+ /** Type of destination (e.g., "Bridge", "Application") */
132
333
  destination_type: string;
334
+ /** Destination bridge ID */
133
335
  destination_bridge?: string;
336
+ /** Destination application name */
134
337
  destination_application?: string;
338
+ /** First leg of destination link */
135
339
  destination_link_first_leg?: Channel;
340
+ /** Second leg of destination link */
136
341
  destination_link_second_leg?: Channel;
342
+ /** Three-way channel for three-way transfers */
137
343
  destination_threeway_channel?: Channel;
344
+ /** Three-way bridge for three-way transfers */
138
345
  destination_threeway_bridge?: Bridge;
139
346
  }
347
+ /**
348
+ * Emitted when a channel enters a bridge.
349
+ */
140
350
  export interface ChannelEnteredBridgeEvent extends BaseEvent {
141
351
  type: 'ChannelEnteredBridge';
352
+ /** The bridge being entered */
142
353
  bridge: Bridge;
354
+ /** The channel entering the bridge */
143
355
  channel: Channel;
144
356
  }
357
+ /**
358
+ * Emitted when a channel leaves a bridge.
359
+ */
145
360
  export interface ChannelLeftBridgeEvent extends BaseEvent {
146
361
  type: 'ChannelLeftBridge';
362
+ /** The bridge being left */
147
363
  bridge: Bridge;
364
+ /** The channel leaving the bridge */
148
365
  channel: Channel;
149
366
  }
367
+ /**
368
+ * Emitted when playback starts.
369
+ */
150
370
  export interface PlaybackStartedEvent extends BaseEvent {
151
371
  type: 'PlaybackStarted';
372
+ /** The playback that started */
152
373
  playback: Playback;
153
374
  }
375
+ /**
376
+ * Emitted when playback continues to the next media item.
377
+ */
154
378
  export interface PlaybackContinuingEvent extends BaseEvent {
155
379
  type: 'PlaybackContinuing';
380
+ /** The continuing playback */
156
381
  playback: Playback;
157
382
  }
383
+ /**
384
+ * Emitted when playback finishes.
385
+ */
158
386
  export interface PlaybackFinishedEvent extends BaseEvent {
159
387
  type: 'PlaybackFinished';
388
+ /** The finished playback */
160
389
  playback: Playback;
161
390
  }
391
+ /**
392
+ * Emitted when recording starts.
393
+ */
162
394
  export interface RecordingStartedEvent extends BaseEvent {
163
395
  type: 'RecordingStarted';
396
+ /** The recording that started */
164
397
  recording: LiveRecording;
165
398
  }
399
+ /**
400
+ * Emitted when recording finishes successfully.
401
+ */
166
402
  export interface RecordingFinishedEvent extends BaseEvent {
167
403
  type: 'RecordingFinished';
404
+ /** The finished recording */
168
405
  recording: LiveRecording;
169
406
  }
407
+ /**
408
+ * Emitted when recording fails.
409
+ */
170
410
  export interface RecordingFailedEvent extends BaseEvent {
171
411
  type: 'RecordingFailed';
412
+ /** The failed recording */
172
413
  recording: LiveRecording;
173
414
  }
415
+ /**
416
+ * Emitted when an endpoint's state changes.
417
+ */
174
418
  export interface EndpointStateChangeEvent extends BaseEvent {
175
419
  type: 'EndpointStateChange';
420
+ /** The endpoint with changed state */
176
421
  endpoint: Endpoint;
177
422
  }
423
+ /**
424
+ * Emitted when a peer's registration status changes.
425
+ */
178
426
  export interface PeerStatusChangeEvent extends BaseEvent {
179
427
  type: 'PeerStatusChange';
428
+ /** The endpoint for this peer */
180
429
  endpoint: Endpoint;
430
+ /** Peer status information */
181
431
  peer: Peer;
182
432
  }
433
+ /**
434
+ * Peer status information.
435
+ */
183
436
  export interface Peer {
437
+ /** Peer status (e.g., "Reachable", "Unreachable", "Registered") */
184
438
  peer_status: string;
439
+ /** Reason for status change */
185
440
  cause?: string;
441
+ /** Peer's IP address */
186
442
  address?: string;
443
+ /** Peer's port */
187
444
  port?: string;
445
+ /** Time of status change */
188
446
  time?: string;
189
447
  }
448
+ /**
449
+ * Emitted when a SIP contact's status changes.
450
+ */
190
451
  export interface ContactStatusChangeEvent extends BaseEvent {
191
452
  type: 'ContactStatusChange';
453
+ /** The endpoint for this contact */
192
454
  endpoint: Endpoint;
455
+ /** Contact status information */
193
456
  contact_info: ContactInfo;
194
457
  }
458
+ /**
459
+ * SIP contact status information.
460
+ */
195
461
  export interface ContactInfo {
462
+ /** Contact URI */
196
463
  uri: string;
464
+ /** Contact status (e.g., "Reachable", "Unreachable") */
197
465
  contact_status: string;
466
+ /** Address of Record */
198
467
  aor: string;
468
+ /** Round-trip time in microseconds */
199
469
  roundtrip_usec?: string;
200
470
  }
471
+ /**
472
+ * Emitted when a device state changes.
473
+ */
201
474
  export interface DeviceStateChangedEvent extends BaseEvent {
202
475
  type: 'DeviceStateChanged';
476
+ /** Device state information */
203
477
  device_state: {
478
+ /** Device name */
204
479
  name: string;
480
+ /** Current device state */
205
481
  state: DeviceState;
206
482
  };
207
483
  }
484
+ /**
485
+ * Emitted when a text message is received.
486
+ */
208
487
  export interface TextMessageReceivedEvent extends BaseEvent {
209
488
  type: 'TextMessageReceived';
489
+ /** The received message */
210
490
  message: {
491
+ /** Sender URI */
211
492
  from: string;
493
+ /** Recipient URI */
212
494
  to: string;
495
+ /** Message body */
213
496
  body: string;
497
+ /** Message variables */
214
498
  variables?: Record<string, string>;
215
499
  };
500
+ /** Endpoint that received the message */
216
501
  endpoint?: Endpoint;
217
502
  }
503
+ /**
504
+ * Emitted during the dial process to indicate dial status.
505
+ *
506
+ * This event occurs multiple times during a call's lifecycle
507
+ * as the dial status changes (e.g., RINGING, ANSWER, BUSY).
508
+ */
218
509
  export interface DialEvent extends BaseEvent {
219
510
  type: 'Dial';
511
+ /** The calling channel (may be undefined) */
220
512
  caller?: Channel;
513
+ /** The channel being dialed */
221
514
  peer: Channel;
515
+ /** Forwarding information if call was forwarded */
222
516
  forward?: string;
517
+ /** Channel the call was forwarded from */
223
518
  forwarded?: Channel;
519
+ /** Original dial string */
224
520
  dialstring?: string;
521
+ /** Current dial status (e.g., "RINGING", "ANSWER", "BUSY", "NOANSWER") */
225
522
  dialstatus: string;
226
523
  }
524
+ /**
525
+ * Emitted when another WebSocket connection takes over the application.
526
+ *
527
+ * This occurs when a new connection is made for the same application,
528
+ * replacing the current connection.
529
+ */
227
530
  export interface ApplicationReplacedEvent extends BaseEvent {
228
531
  type: 'ApplicationReplaced';
229
532
  }
533
+ /**
534
+ * Emitted when a channel move to this application fails.
535
+ */
230
536
  export interface ApplicationMoveFailedEvent extends BaseEvent {
231
537
  type: 'ApplicationMoveFailed';
538
+ /** The channel that failed to move */
232
539
  channel: Channel;
540
+ /** Intended destination application */
233
541
  destination: string;
542
+ /** Arguments for the destination application */
234
543
  args: string[];
235
544
  }
545
+ /**
546
+ * Emitted when an application is registered.
547
+ */
236
548
  export interface ApplicationRegisteredEvent extends BaseEvent {
237
549
  type: 'ApplicationRegistered';
238
550
  }
551
+ /**
552
+ * Emitted when an application is unregistered.
553
+ */
239
554
  export interface ApplicationUnregisteredEvent extends BaseEvent {
240
555
  type: 'ApplicationUnregistered';
241
556
  }
557
+ /**
558
+ * User-defined event sent from the dialplan or another ARI application.
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * // From dialplan: UserEvent(MyCustomEvent,Key1:Value1,Key2:Value2)
563
+ * client.on('ChannelUserevent', (event) => {
564
+ * if (event.eventname === 'MyCustomEvent') {
565
+ * console.log(event.userevent.Key1); // "Value1"
566
+ * }
567
+ * });
568
+ * ```
569
+ */
242
570
  export interface ChannelUsereventEvent extends BaseEvent {
243
571
  type: 'ChannelUserevent';
572
+ /** Channel associated with the event (optional) */
244
573
  channel?: Channel;
574
+ /** Bridge associated with the event (optional) */
245
575
  bridge?: Bridge;
576
+ /** Endpoint associated with the event (optional) */
246
577
  endpoint?: Endpoint;
578
+ /** Name of the user event */
247
579
  eventname: string;
580
+ /** Key-value pairs passed with the event */
248
581
  userevent: Record<string, string>;
249
582
  }
583
+ /**
584
+ * Emitted when a channel transfer occurs.
585
+ *
586
+ * @since Asterisk 22+
587
+ */
250
588
  export interface ChannelTransferEvent extends BaseEvent {
251
589
  type: 'ChannelTransfer';
590
+ /** The channel being transferred */
252
591
  channel: Channel;
253
592
  }
593
+ /**
594
+ * Union type of all possible ARI events.
595
+ *
596
+ * Use this type when you need to handle events generically.
597
+ */
254
598
  export type AriEvent = StasisStartEvent | StasisEndEvent | ChannelCreatedEvent | ChannelDestroyedEvent | ChannelStateChangeEvent | ChannelDtmfReceivedEvent | ChannelHangupRequestEvent | ChannelVarsetEvent | ChannelHoldEvent | ChannelUnholdEvent | ChannelTalkingStartedEvent | ChannelTalkingFinishedEvent | ChannelConnectedLineEvent | ChannelDialplanEvent | ChannelCallerIdEvent | ChannelToneDetectedEvent | BridgeCreatedEvent | BridgeDestroyedEvent | BridgeMergedEvent | BridgeVideoSourceChangedEvent | BridgeBlindTransferEvent | BridgeAttendedTransferEvent | ChannelEnteredBridgeEvent | ChannelLeftBridgeEvent | PlaybackStartedEvent | PlaybackContinuingEvent | PlaybackFinishedEvent | RecordingStartedEvent | RecordingFinishedEvent | RecordingFailedEvent | EndpointStateChangeEvent | PeerStatusChangeEvent | ContactStatusChangeEvent | DeviceStateChangedEvent | TextMessageReceivedEvent | DialEvent | ApplicationReplacedEvent | ApplicationMoveFailedEvent | ApplicationRegisteredEvent | ApplicationUnregisteredEvent | ChannelUsereventEvent | ChannelTransferEvent;
599
+ /**
600
+ * All possible event type strings.
601
+ */
255
602
  export type AriEventType = AriEvent['type'];
603
+ /**
604
+ * Maps event type strings to their corresponding event interfaces.
605
+ *
606
+ * Used internally for type-safe event listeners.
607
+ *
608
+ * @example
609
+ * ```typescript
610
+ * // The listener receives the correct event type automatically
611
+ * client.on('StasisStart', (event, channel) => {
612
+ * // event is StasisStartEvent
613
+ * // channel is Channel
614
+ * });
615
+ * ```
616
+ */
256
617
  export interface AriEventMap {
257
618
  StasisStart: StasisStartEvent;
258
619
  StasisEnd: StasisEndEvent;
@@ -296,10 +657,37 @@ export interface AriEventMap {
296
657
  ApplicationUnregistered: ApplicationUnregisteredEvent;
297
658
  ChannelUserevent: ChannelUsereventEvent;
298
659
  ChannelTransfer: ChannelTransferEvent;
660
+ /** Wildcard listener receives all events */
299
661
  '*': AriEvent;
300
662
  }
663
+ /**
664
+ * Event types that can occur on channels.
665
+ */
301
666
  export type ChannelEventType = 'StasisStart' | 'StasisEnd' | 'ChannelCreated' | 'ChannelDestroyed' | 'ChannelStateChange' | 'ChannelDtmfReceived' | 'ChannelHangupRequest' | 'ChannelVarset' | 'ChannelHold' | 'ChannelUnhold' | 'ChannelTalkingStarted' | 'ChannelTalkingFinished' | 'ChannelConnectedLine' | 'ChannelDialplan' | 'ChannelCallerId' | 'ChannelToneDetected' | 'ChannelEnteredBridge' | 'ChannelLeftBridge' | 'ChannelUserevent' | 'ChannelTransfer' | 'Dial';
667
+ /**
668
+ * Event types that can occur on bridges.
669
+ */
302
670
  export type BridgeEventType = 'BridgeCreated' | 'BridgeDestroyed' | 'BridgeMerged' | 'BridgeVideoSourceChanged' | 'BridgeBlindTransfer' | 'BridgeAttendedTransfer' | 'ChannelEnteredBridge' | 'ChannelLeftBridge';
671
+ /**
672
+ * Event types that can occur on playbacks.
673
+ */
303
674
  export type PlaybackEventType = 'PlaybackStarted' | 'PlaybackContinuing' | 'PlaybackFinished';
675
+ /**
676
+ * Event types that can occur on recordings.
677
+ */
304
678
  export type RecordingEventType = 'RecordingStarted' | 'RecordingFinished' | 'RecordingFailed';
679
+ /**
680
+ * Maps event types to their raw data convenience argument type.
681
+ *
682
+ * This type maps to raw data types (Channel, Bridge, etc.) without methods.
683
+ * For instance types with methods, see `EventInstanceArg` in the emitter module.
684
+ *
685
+ * @remarks
686
+ * This type is primarily used internally. When using `client.on()`, you'll
687
+ * receive instance types (ChannelInstance, BridgeInstance, etc.) that have
688
+ * methods like `answer()`, `play()`, etc.
689
+ *
690
+ * @see EventInstanceArg for the instance type mapping used in event listeners
691
+ */
692
+ export type EventConvenienceArg<K extends AriEventType> = K extends 'StasisStart' | 'StasisEnd' | 'ChannelCreated' | 'ChannelDestroyed' | 'ChannelStateChange' | 'ChannelDtmfReceived' | 'ChannelHangupRequest' | 'ChannelHold' | 'ChannelUnhold' | 'ChannelTalkingStarted' | 'ChannelTalkingFinished' | 'ChannelConnectedLine' | 'ChannelDialplan' | 'ChannelCallerId' | 'ChannelToneDetected' | 'ChannelEnteredBridge' | 'ChannelLeftBridge' | 'ChannelTransfer' | 'BridgeBlindTransfer' | 'ApplicationMoveFailed' ? Channel : K extends 'BridgeCreated' | 'BridgeDestroyed' | 'BridgeMerged' | 'BridgeVideoSourceChanged' ? Bridge : K extends 'PlaybackStarted' | 'PlaybackContinuing' | 'PlaybackFinished' ? Playback : K extends 'RecordingStarted' | 'RecordingFinished' | 'RecordingFailed' ? LiveRecording : K extends 'EndpointStateChange' | 'PeerStatusChange' | 'ContactStatusChange' ? Endpoint : K extends 'Dial' ? Channel : K extends 'ChannelVarset' ? Channel | undefined : K extends 'ChannelUserevent' ? Channel | undefined : undefined;
305
693
  //# sourceMappingURL=types.d.ts.map