@per_moeller/asterisk-ari 1.0.3 → 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,331 +1,985 @@
1
1
  /**
2
2
  * API request and response types for Asterisk ARI
3
+ *
4
+ * This module contains all TypeScript type definitions for the Asterisk REST Interface (ARI).
5
+ * These types correspond to the objects returned by the Asterisk ARI API.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Possible states of a channel in Asterisk.
11
+ *
12
+ * @remarks
13
+ * These states correspond to the channel states in Asterisk's core:
14
+ * - `Down` - Channel is down and available
15
+ * - `Rsrvd` - Channel is reserved
16
+ * - `OffHook` - Channel is off hook (receiver lifted)
17
+ * - `Dialing` - Digits have been dialed
18
+ * - `Ring` - Remote end is ringing
19
+ * - `Ringing` - Local end is ringing
20
+ * - `Up` - Channel is connected and active
21
+ * - `Busy` - Line is busy
22
+ * - `Dialing Offhook` - Dialing while off hook
23
+ * - `Pre-ring` - Channel is about to ring
24
+ * - `Unknown` - Unknown state
3
25
  */
4
26
  export type ChannelState = 'Down' | 'Rsrvd' | 'OffHook' | 'Dialing' | 'Ring' | 'Ringing' | 'Up' | 'Busy' | 'Dialing Offhook' | 'Pre-ring' | 'Unknown';
27
+ /**
28
+ * Caller ID information for a channel.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const callerId: CallerId = {
33
+ * name: "John Doe",
34
+ * number: "+15551234567"
35
+ * };
36
+ * ```
37
+ */
5
38
  export interface CallerId {
39
+ /** Display name of the caller */
6
40
  name: string;
41
+ /** Phone number of the caller */
7
42
  number: string;
8
43
  }
44
+ /**
45
+ * Dialplan Context, Extension, and Priority (CEP) information.
46
+ *
47
+ * Represents the current or target position in the Asterisk dialplan.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const dialplan: DialplanCEP = {
52
+ * context: "default",
53
+ * exten: "100",
54
+ * priority: 1
55
+ * };
56
+ * ```
57
+ */
9
58
  export interface DialplanCEP {
59
+ /** Dialplan context name */
10
60
  context: string;
61
+ /** Dialplan extension (phone number or pattern) */
11
62
  exten: string;
63
+ /** Priority number within the extension */
12
64
  priority: number;
65
+ /** Application name currently executing (if any) */
13
66
  app_name?: string;
67
+ /** Arguments passed to the dialplan application */
14
68
  app_data?: string;
15
69
  }
70
+ /**
71
+ * RTP (Real-time Transport Protocol) statistics for a channel.
72
+ *
73
+ * Contains detailed statistics about the RTP stream including packet counts,
74
+ * jitter measurements, packet loss, and round-trip time metrics.
75
+ *
76
+ * @remarks
77
+ * All jitter and RTT values are in milliseconds. Packet loss values are
78
+ * cumulative counts of lost packets.
79
+ */
16
80
  export interface RTPstat {
81
+ /** Number of packets transmitted */
17
82
  txcount: number;
83
+ /** Number of packets received */
18
84
  rxcount: number;
85
+ /** Jitter on transmitted packets (ms) */
19
86
  txjitter?: number;
87
+ /** Jitter on received packets (ms) */
20
88
  rxjitter?: number;
89
+ /** Maximum jitter reported by remote end (ms) */
21
90
  remote_maxjitter?: number;
91
+ /** Minimum jitter reported by remote end (ms) */
22
92
  remote_minjitter?: number;
93
+ /** Average jitter reported by remote end (ms) */
23
94
  remote_normdevjitter?: number;
95
+ /** Standard deviation of jitter reported by remote end (ms) */
24
96
  remote_stdevjitter?: number;
97
+ /** Maximum local jitter (ms) */
25
98
  local_maxjitter?: number;
99
+ /** Minimum local jitter (ms) */
26
100
  local_minjitter?: number;
101
+ /** Average local jitter (ms) */
27
102
  local_normdevjitter?: number;
103
+ /** Standard deviation of local jitter (ms) */
28
104
  local_stdevjitter?: number;
105
+ /** Number of transmitted packets lost */
29
106
  txploss: number;
107
+ /** Number of received packets lost */
30
108
  rxploss: number;
109
+ /** Maximum packet loss reported by remote end */
31
110
  remote_maxrxploss?: number;
111
+ /** Minimum packet loss reported by remote end */
32
112
  remote_minrxploss?: number;
113
+ /** Average packet loss reported by remote end */
33
114
  remote_normdevrxploss?: number;
115
+ /** Standard deviation of packet loss reported by remote end */
34
116
  remote_stdevrxploss?: number;
117
+ /** Maximum local packet loss */
35
118
  local_maxrxploss?: number;
119
+ /** Minimum local packet loss */
36
120
  local_minrxploss?: number;
121
+ /** Average local packet loss */
37
122
  local_normdevrxploss?: number;
123
+ /** Standard deviation of local packet loss */
38
124
  local_stdevrxploss?: number;
125
+ /** Current round-trip time (ms) */
39
126
  rtt?: number;
127
+ /** Maximum round-trip time (ms) */
40
128
  maxrtt?: number;
129
+ /** Minimum round-trip time (ms) */
41
130
  minrtt?: number;
131
+ /** Average round-trip time (ms) */
42
132
  normdevrtt?: number;
133
+ /** Standard deviation of round-trip time (ms) */
43
134
  stdevrtt?: number;
135
+ /** Local SSRC (Synchronization Source identifier) */
44
136
  local_ssrc: number;
137
+ /** Remote SSRC (Synchronization Source identifier) */
45
138
  remote_ssrc: number;
139
+ /** Number of octets (bytes) transmitted */
46
140
  txoctetcount: number;
141
+ /** Number of octets (bytes) received */
47
142
  rxoctetcount: number;
143
+ /** Unique identifier for the channel */
48
144
  channel_uniqueid: string;
49
145
  }
146
+ /**
147
+ * Represents an active channel in Asterisk.
148
+ *
149
+ * A channel is a connection between Asterisk and an endpoint (phone, trunk, etc.).
150
+ * It carries audio/video data and can participate in bridges, playbacks, and recordings.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * client.on('StasisStart', (event, channel) => {
155
+ * console.log(`Call from ${channel.caller.number} in state ${channel.state}`);
156
+ * channel.answer();
157
+ * });
158
+ * ```
159
+ */
50
160
  export interface Channel {
161
+ /** Unique identifier for this channel */
51
162
  id: string;
163
+ /** Channel name in Asterisk format (e.g., "PJSIP/endpoint-00000001") */
52
164
  name: string;
165
+ /** Current state of the channel */
53
166
  state: ChannelState;
167
+ /** Caller ID information for the calling party */
54
168
  caller: CallerId;
169
+ /** Caller ID information for the connected party */
55
170
  connected: CallerId;
171
+ /** Account code for billing purposes */
56
172
  accountcode: string;
173
+ /** Current position in the dialplan */
57
174
  dialplan: DialplanCEP;
175
+ /** ISO 8601 timestamp when the channel was created */
58
176
  creationtime: string;
177
+ /** Language code for the channel (e.g., "en", "es") */
59
178
  language: string;
179
+ /** Channel variables set on this channel */
60
180
  channelvars?: Record<string, string>;
61
- /** Protocol ID (Asterisk 20+) */
181
+ /**
182
+ * Protocol-specific identifier (e.g., SIP Call-ID)
183
+ * @since Asterisk 20+
184
+ */
62
185
  protocol_id?: string;
63
186
  }
187
+ /**
188
+ * Parameters for originating (creating and dialing) a new channel.
189
+ *
190
+ * @remarks
191
+ * You must specify either `extension` (to continue in dialplan) or `app` (to enter Stasis).
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * // Originate to a Stasis application
196
+ * await client.channels.originate({
197
+ * endpoint: "PJSIP/1000",
198
+ * app: "my-app",
199
+ * callerId: "ARI <100>"
200
+ * });
201
+ *
202
+ * // Originate to dialplan
203
+ * await client.channels.originate({
204
+ * endpoint: "PJSIP/1000",
205
+ * context: "default",
206
+ * extension: "200",
207
+ * priority: 1
208
+ * });
209
+ * ```
210
+ */
64
211
  export interface OriginateParams {
212
+ /**
213
+ * Endpoint to dial (e.g., "PJSIP/1000", "SIP/trunk/5551234567")
214
+ */
65
215
  endpoint: string;
216
+ /** Extension to dial after channel answers (dialplan mode) */
66
217
  extension?: string;
218
+ /** Dialplan context for the extension */
67
219
  context?: string;
220
+ /** Priority within the extension */
68
221
  priority?: number;
222
+ /** Label within the extension to jump to */
69
223
  label?: string;
224
+ /** Stasis application name to enter (Stasis mode) */
70
225
  app?: string;
226
+ /** Arguments to pass to the Stasis application */
71
227
  appArgs?: string;
228
+ /** Caller ID to set on the outgoing channel (format: "Name <number>") */
72
229
  callerId?: string;
230
+ /** Timeout in seconds before giving up on the call */
73
231
  timeout?: number;
232
+ /** Specific channel ID to use (optional, auto-generated if not provided) */
74
233
  channelId?: string;
234
+ /** Channel ID for the second leg in Local channel scenarios */
75
235
  otherChannelId?: string;
236
+ /** Channel ID of the originating channel (for linked channels) */
76
237
  originator?: string;
238
+ /** Comma-separated list of allowed codecs (e.g., "ulaw,alaw") */
77
239
  formats?: string;
240
+ /** Channel variables to set on the new channel */
78
241
  variables?: Record<string, string>;
79
242
  }
243
+ /**
244
+ * Parameters for creating a channel without dialing.
245
+ *
246
+ * Creates a channel that can be dialed later using the `dial()` method.
247
+ * Useful for setting up channels before initiating the call.
248
+ */
80
249
  export interface CreateChannelParams {
250
+ /** Endpoint specification (e.g., "PJSIP/1000") */
81
251
  endpoint: string;
252
+ /** Stasis application name for the channel */
82
253
  app: string;
254
+ /** Arguments to pass to the Stasis application */
83
255
  appArgs?: string;
256
+ /** Specific channel ID to use */
84
257
  channelId?: string;
258
+ /** Channel ID for the second leg in Local channel scenarios */
85
259
  otherChannelId?: string;
260
+ /** Channel ID of the originating channel */
86
261
  originator?: string;
262
+ /** Comma-separated list of allowed codecs */
87
263
  formats?: string;
264
+ /** Channel variables to set on the new channel */
88
265
  variables?: Record<string, string>;
89
266
  }
267
+ /**
268
+ * Parameters for hanging up a channel.
269
+ */
90
270
  export interface HangupParams {
271
+ /**
272
+ * Numeric hangup cause code (e.g., "16" for normal clearing)
273
+ * @see https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings
274
+ */
91
275
  reason_code?: string;
276
+ /**
277
+ * Text description of the hangup reason (e.g., "normal", "busy")
278
+ */
92
279
  reason?: string;
93
280
  }
281
+ /**
282
+ * Parameters for continuing a channel in the dialplan.
283
+ */
94
284
  export interface ContinueParams {
285
+ /** Dialplan context to continue in */
95
286
  context?: string;
287
+ /** Extension to continue at */
96
288
  extension?: string;
289
+ /** Priority to continue at */
97
290
  priority?: number;
291
+ /** Label to jump to within the extension */
98
292
  label?: string;
99
293
  }
294
+ /**
295
+ * Parameters for moving a channel to a different Stasis application.
296
+ */
100
297
  export interface MoveParams {
298
+ /** Target Stasis application name */
101
299
  app: string;
300
+ /** Arguments to pass to the target application */
102
301
  appArgs?: string;
103
302
  }
303
+ /**
304
+ * Parameters for sending DTMF tones to a channel.
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * // Send a PIN code with proper timing
309
+ * await channel.sendDTMF({
310
+ * dtmf: "1234#",
311
+ * between: 100, // 100ms between digits
312
+ * duration: 200 // 200ms per digit
313
+ * });
314
+ * ```
315
+ */
104
316
  export interface DTMFParams {
317
+ /** DTMF digits to send (0-9, A-D, *, #) */
105
318
  dtmf: string;
319
+ /** Milliseconds to wait before sending the first digit */
106
320
  before?: number;
321
+ /** Milliseconds to wait between each digit */
107
322
  between?: number;
323
+ /** Duration of each digit in milliseconds */
108
324
  duration?: number;
325
+ /** Milliseconds to wait after sending the last digit */
109
326
  after?: number;
110
327
  }
328
+ /**
329
+ * Parameters for playing media to a channel or bridge.
330
+ *
331
+ * @example
332
+ * ```typescript
333
+ * // Play a sound file
334
+ * await channel.play({ media: "sound:hello-world" });
335
+ *
336
+ * // Play multiple files in sequence
337
+ * await channel.play({
338
+ * media: ["sound:welcome", "sound:press-one"],
339
+ * lang: "en"
340
+ * });
341
+ *
342
+ * // Play with offset for resuming
343
+ * await channel.play({
344
+ * media: "sound:long-message",
345
+ * offsetms: 5000 // Start 5 seconds in
346
+ * });
347
+ * ```
348
+ */
111
349
  export interface PlayParams {
350
+ /**
351
+ * Media URI(s) to play. Supported schemes:
352
+ * - `sound:` - Asterisk sound files
353
+ * - `recording:` - Stored recordings
354
+ * - `number:` - Say a number
355
+ * - `digits:` - Say digits
356
+ * - `characters:` - Spell characters
357
+ * - `tone:` - Play a tone
358
+ */
112
359
  media: string | string[];
360
+ /** Language code for sound files (e.g., "en", "es") */
113
361
  lang?: string;
362
+ /** Offset in milliseconds to start playback from */
114
363
  offsetms?: number;
364
+ /** Milliseconds to skip forward/back when using playback controls */
115
365
  skipms?: number;
366
+ /** Specific playback ID to use (for tracking) */
116
367
  playbackId?: string;
117
368
  }
369
+ /**
370
+ * Parameters for recording audio from a channel or bridge.
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * const recording = await channel.record({
375
+ * name: "voicemail-12345",
376
+ * format: "wav",
377
+ * maxDurationSeconds: 60,
378
+ * beep: true,
379
+ * terminateOn: "#"
380
+ * });
381
+ * ```
382
+ */
118
383
  export interface RecordParams {
384
+ /** Name for the recording (will be used as filename) */
119
385
  name: string;
386
+ /** Audio format (e.g., "wav", "ulaw", "gsm") */
120
387
  format: string;
388
+ /** Maximum recording duration in seconds */
121
389
  maxDurationSeconds?: number;
390
+ /** Stop recording after this many seconds of silence */
122
391
  maxSilenceSeconds?: number;
392
+ /** Behavior if recording already exists */
123
393
  ifExists?: 'fail' | 'overwrite' | 'append';
394
+ /** Play a beep before starting the recording */
124
395
  beep?: boolean;
396
+ /** DTMF digits that terminate the recording (e.g., "#") */
125
397
  terminateOn?: string;
126
398
  }
399
+ /**
400
+ * Parameters for snooping (spying/whispering) on a channel.
401
+ *
402
+ * Creates a new channel that can listen to and/or speak to the target channel.
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * // Supervisor listening silently
407
+ * const snoopChannel = await channel.snoop({
408
+ * spy: "both",
409
+ * whisper: "none",
410
+ * app: "supervisor-app"
411
+ * });
412
+ * ```
413
+ */
127
414
  export interface SnoopParams {
415
+ /**
416
+ * Direction to spy (listen) on:
417
+ * - `none` - Don't listen
418
+ * - `both` - Listen to both directions
419
+ * - `out` - Listen to audio going out from the channel
420
+ * - `in` - Listen to audio coming in to the channel
421
+ */
128
422
  spy?: 'none' | 'both' | 'out' | 'in';
423
+ /**
424
+ * Direction to whisper (speak) to:
425
+ * - `none` - Don't whisper
426
+ * - `both` - Whisper to both parties
427
+ * - `out` - Whisper only to remote party
428
+ * - `in` - Whisper only to local channel
429
+ */
129
430
  whisper?: 'none' | 'both' | 'out' | 'in';
431
+ /** Stasis application for the snoop channel */
130
432
  app: string;
433
+ /** Arguments to pass to the Stasis application */
131
434
  appArgs?: string;
435
+ /** Specific channel ID for the snoop channel */
132
436
  snoopId?: string;
133
437
  }
438
+ /**
439
+ * Parameters for dialing a created channel.
440
+ */
134
441
  export interface DialParams {
442
+ /** Channel ID of the calling channel (for caller ID purposes) */
135
443
  caller?: string;
444
+ /** Timeout in seconds before giving up */
136
445
  timeout?: number;
137
446
  }
447
+ /**
448
+ * Parameters for creating an external media channel.
449
+ *
450
+ * External media allows connecting Asterisk audio to external
451
+ * applications via RTP or AudioSocket protocols.
452
+ *
453
+ * @since Asterisk 18+
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * const channel = await client.channels.externalMedia({
458
+ * app: "my-app",
459
+ * external_host: "192.168.1.100:10000",
460
+ * format: "ulaw",
461
+ * encapsulation: "rtp",
462
+ * transport: "udp"
463
+ * });
464
+ * ```
465
+ */
138
466
  export interface ExternalMediaParams {
467
+ /** Specific channel ID to use */
139
468
  channelId?: string;
469
+ /** Stasis application name */
140
470
  app: string;
471
+ /** External host and port (format: "host:port") */
141
472
  external_host: string;
473
+ /** Protocol encapsulation type */
142
474
  encapsulation?: 'rtp' | 'audiosocket';
475
+ /** Transport protocol */
143
476
  transport?: 'udp' | 'tcp';
477
+ /** Connection type for TCP transport */
144
478
  connection_type?: 'client' | 'server';
479
+ /** Audio codec format (e.g., "ulaw", "alaw", "slin16") */
145
480
  format: string;
481
+ /** Audio direction */
146
482
  direction?: 'both' | 'read' | 'write';
483
+ /** Additional protocol-specific data */
147
484
  data?: string;
485
+ /** Channel variables to set */
148
486
  variables?: Record<string, string>;
149
487
  }
488
+ /**
489
+ * Type of bridge for different use cases.
490
+ *
491
+ * - `mixing` - Standard conference bridge (mixes audio from all participants)
492
+ * - `holding` - Holding bridge (for music on hold, parking)
493
+ * - `dtmf_events` - Bridge that generates DTMF events
494
+ * - `proxy_media` - Media goes through Asterisk (required for some features)
495
+ * - `video_sfu` - Selective Forwarding Unit for video (Asterisk 18+)
496
+ * - `video_single` - Single video source bridge
497
+ */
150
498
  export type BridgeType = 'mixing' | 'holding' | 'dtmf_events' | 'proxy_media' | 'video_sfu' | 'video_single';
499
+ /**
500
+ * Represents an active bridge in Asterisk.
501
+ *
502
+ * A bridge is a container that connects multiple channels together,
503
+ * allowing audio/video to flow between them.
504
+ *
505
+ * @example
506
+ * ```typescript
507
+ * const bridge = await client.bridges.create({ type: "mixing" });
508
+ * await bridge.addChannel({ channel: [channelA.id, channelB.id] });
509
+ * ```
510
+ */
151
511
  export interface Bridge {
512
+ /** Unique identifier for this bridge */
152
513
  id: string;
514
+ /** Technology used for bridging (e.g., "simple_bridge", "native_rtp") */
153
515
  technology: string;
516
+ /** Type of bridge */
154
517
  bridge_type: BridgeType;
518
+ /** Bridge class (e.g., "base", "stasis") */
155
519
  bridge_class: string;
520
+ /** Creator of the bridge (application name) */
156
521
  creator: string;
522
+ /** Friendly name for the bridge */
157
523
  name: string;
524
+ /** Array of channel IDs currently in the bridge */
158
525
  channels: string[];
526
+ /** Video mode for the bridge */
159
527
  video_mode?: 'none' | 'talker' | 'single';
528
+ /** Channel ID of the current video source */
160
529
  video_source_id?: string;
530
+ /** ISO 8601 timestamp when the bridge was created */
161
531
  creationtime: string;
162
532
  }
533
+ /**
534
+ * Parameters for creating a bridge.
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * // Create a mixing bridge with custom ID
539
+ * const bridge = await client.bridges.create({
540
+ * type: "mixing",
541
+ * bridgeId: "conference-room-1",
542
+ * name: "Conference Room 1"
543
+ * });
544
+ * ```
545
+ */
163
546
  export interface CreateBridgeParams {
547
+ /**
548
+ * Bridge type(s). Can be a single type or comma-separated list.
549
+ * Multiple types combine behaviors (e.g., "mixing,dtmf_events").
550
+ */
164
551
  type?: BridgeType | string;
552
+ /** Specific bridge ID to use */
165
553
  bridgeId?: string;
554
+ /** Friendly name for the bridge */
166
555
  name?: string;
167
556
  }
557
+ /**
558
+ * Parameters for adding channels to a bridge.
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * await bridge.addChannel({
563
+ * channel: ["channel-1", "channel-2"],
564
+ * role: "participant",
565
+ * mute: true
566
+ * });
567
+ * ```
568
+ */
168
569
  export interface AddChannelParams {
570
+ /** Channel ID(s) to add to the bridge */
169
571
  channel: string | string[];
572
+ /**
573
+ * Role of the channel in the bridge.
574
+ * Common values: "participant", "announcer"
575
+ */
170
576
  role?: string;
577
+ /** If true, DTMF from this channel won't be heard in the bridge */
171
578
  absorbDTMF?: boolean;
579
+ /** If true, the channel joins muted */
172
580
  mute?: boolean;
581
+ /** If true, don't update connected line information */
173
582
  inhibitConnectedLineUpdates?: boolean;
174
583
  }
584
+ /**
585
+ * Parameters for removing channels from a bridge.
586
+ */
175
587
  export interface RemoveChannelParams {
588
+ /** Channel ID(s) to remove from the bridge */
176
589
  channel: string | string[];
177
590
  }
591
+ /**
592
+ * Parameters for playing media to a bridge.
593
+ * @see PlayParams
594
+ */
178
595
  export interface PlayBridgeParams extends PlayParams {
179
596
  }
597
+ /**
598
+ * Parameters for recording a bridge.
599
+ * @see RecordParams
600
+ */
180
601
  export interface RecordBridgeParams extends RecordParams {
181
602
  }
603
+ /**
604
+ * State of an endpoint.
605
+ *
606
+ * - `unknown` - State cannot be determined
607
+ * - `offline` - Endpoint is not registered/available
608
+ * - `online` - Endpoint is registered and available
609
+ */
182
610
  export type EndpointState = 'unknown' | 'offline' | 'online';
611
+ /**
612
+ * Represents an endpoint (phone, trunk, etc.) in Asterisk.
613
+ *
614
+ * An endpoint is a configured destination that can have multiple
615
+ * active channels.
616
+ */
183
617
  export interface Endpoint {
618
+ /** Channel technology (e.g., "PJSIP", "SIP", "IAX2") */
184
619
  technology: string;
620
+ /** Endpoint resource name */
185
621
  resource: string;
622
+ /** Current state of the endpoint */
186
623
  state: EndpointState;
624
+ /** Array of active channel IDs for this endpoint */
187
625
  channel_ids: string[];
188
626
  }
627
+ /**
628
+ * Text message to be sent to an endpoint.
629
+ *
630
+ * @example
631
+ * ```typescript
632
+ * await client.endpoints.sendMessage("pjsip", "1000", {
633
+ * from: "pjsip:100",
634
+ * to: "pjsip:1000",
635
+ * body: "Hello from ARI!"
636
+ * });
637
+ * ```
638
+ */
189
639
  export interface TextMessage {
640
+ /** Sender URI */
190
641
  from: string;
642
+ /** Recipient URI */
191
643
  to: string;
644
+ /** Message content */
192
645
  body: string;
646
+ /** Additional message variables */
193
647
  variables?: Record<string, string>;
194
648
  }
649
+ /**
650
+ * Represents a Stasis application.
651
+ *
652
+ * A Stasis application is an ARI application that receives events
653
+ * for channels, bridges, and other resources it controls.
654
+ */
195
655
  export interface Application {
656
+ /** Name of the application */
196
657
  name: string;
658
+ /** Channel IDs controlled by this application */
197
659
  channel_ids: string[];
660
+ /** Bridge IDs controlled by this application */
198
661
  bridge_ids: string[];
662
+ /** Endpoint IDs subscribed to by this application */
199
663
  endpoint_ids: string[];
664
+ /** Device names subscribed to by this application */
200
665
  device_names: string[];
201
666
  }
667
+ /**
668
+ * Parameters for subscribing to event sources.
669
+ */
202
670
  export interface SubscribeParams {
671
+ /**
672
+ * Event source(s) to subscribe to.
673
+ * Format: "resource:id" (e.g., "channel:12345", "bridge:conf-1")
674
+ */
203
675
  eventSource: string | string[];
204
676
  }
677
+ /**
678
+ * State of a playback operation.
679
+ *
680
+ * - `queued` - Playback is waiting to start
681
+ * - `playing` - Playback is in progress
682
+ * - `paused` - Playback is paused (can be resumed)
683
+ * - `complete` - Playback finished successfully
684
+ * - `failed` - Playback failed
685
+ */
205
686
  export type PlaybackState = 'queued' | 'playing' | 'paused' | 'complete' | 'failed';
687
+ /**
688
+ * Represents an active playback operation.
689
+ */
206
690
  export interface Playback {
691
+ /** Unique identifier for this playback */
207
692
  id: string;
693
+ /** URI of the media being played */
208
694
  media_uri: string;
695
+ /** URI of the next media to play (if queued) */
209
696
  next_media_uri?: string;
697
+ /** URI of the target (channel or bridge) */
210
698
  target_uri: string;
699
+ /** Language of the media */
211
700
  language: string;
701
+ /** Current state of the playback */
212
702
  state: PlaybackState;
213
703
  }
704
+ /**
705
+ * State of a recording operation.
706
+ *
707
+ * - `queued` - Recording is waiting to start
708
+ * - `recording` - Recording is in progress
709
+ * - `paused` - Recording is paused (can be resumed)
710
+ * - `done` - Recording completed successfully
711
+ * - `failed` - Recording failed
712
+ * - `canceled` - Recording was canceled
713
+ */
214
714
  export type RecordingState = 'queued' | 'recording' | 'paused' | 'done' | 'failed' | 'canceled';
715
+ /**
716
+ * Represents an active (live) recording.
717
+ */
215
718
  export interface LiveRecording {
719
+ /** Name of the recording (filename without extension) */
216
720
  name: string;
721
+ /** Audio format of the recording */
217
722
  format: string;
723
+ /** Current state of the recording */
218
724
  state: RecordingState;
725
+ /** URI of the target being recorded */
219
726
  target_uri: string;
727
+ /** Total duration in seconds */
220
728
  duration?: number;
729
+ /** Duration of non-silent audio in seconds */
221
730
  talking_duration?: number;
731
+ /** Duration of silence in seconds */
222
732
  silence_duration?: number;
733
+ /** Reason for failure (if state is 'failed') */
223
734
  cause?: string;
224
735
  }
736
+ /**
737
+ * Represents a stored recording on disk.
738
+ */
225
739
  export interface StoredRecording {
740
+ /** Name of the recording (filename without extension) */
226
741
  name: string;
742
+ /** Audio format of the recording */
227
743
  format: string;
228
744
  }
745
+ /**
746
+ * Parameters for copying a stored recording.
747
+ */
229
748
  export interface StoredRecordingCopyParams {
749
+ /** Name for the destination recording */
230
750
  destinationRecordingName: string;
231
751
  }
752
+ /**
753
+ * Represents a sound file available in Asterisk.
754
+ */
232
755
  export interface Sound {
756
+ /** Sound identifier (used in play URIs) */
233
757
  id: string;
758
+ /** Human-readable text description of the sound */
234
759
  text?: string;
760
+ /** Available format/language combinations */
235
761
  formats: FormatLangPair[];
236
762
  }
763
+ /**
764
+ * A format and language combination for a sound file.
765
+ */
237
766
  export interface FormatLangPair {
767
+ /** Language code (e.g., "en", "es") */
238
768
  language: string;
769
+ /** Audio format (e.g., "wav", "gsm") */
239
770
  format: string;
240
771
  }
772
+ /**
773
+ * Parameters for listing sounds.
774
+ */
241
775
  export interface ListSoundsParams {
776
+ /** Filter by language */
242
777
  lang?: string;
778
+ /** Filter by format */
243
779
  format?: string;
244
780
  }
781
+ /**
782
+ * Represents a voicemail mailbox.
783
+ */
245
784
  export interface Mailbox {
785
+ /** Mailbox identifier */
246
786
  name: string;
787
+ /** Number of old (read) messages */
247
788
  old_messages: number;
789
+ /** Number of new (unread) messages */
248
790
  new_messages: number;
249
791
  }
792
+ /**
793
+ * Parameters for updating mailbox message counts.
794
+ */
250
795
  export interface UpdateMailboxParams {
796
+ /** Number of old (read) messages */
251
797
  oldMessages: number;
798
+ /** Number of new (unread) messages */
252
799
  newMessages: number;
253
800
  }
801
+ /**
802
+ * Possible states for a device.
803
+ *
804
+ * - `UNKNOWN` - Device exists but state is unknown
805
+ * - `NOT_INUSE` - Device is idle
806
+ * - `INUSE` - Device is in use
807
+ * - `BUSY` - Device is busy (all lines in use)
808
+ * - `INVALID` - Device is invalid/not found
809
+ * - `UNAVAILABLE` - Device is not available
810
+ * - `RINGING` - Device is ringing
811
+ * - `RINGINUSE` - Device is ringing while in use
812
+ * - `ONHOLD` - Device is on hold
813
+ */
254
814
  export type DeviceState = 'UNKNOWN' | 'NOT_INUSE' | 'INUSE' | 'BUSY' | 'INVALID' | 'UNAVAILABLE' | 'RINGING' | 'RINGINUSE' | 'ONHOLD';
815
+ /**
816
+ * Represents a device state resource.
817
+ */
255
818
  export interface DeviceStateResource {
819
+ /** Device name (e.g., "Stasis:mydevice") */
256
820
  name: string;
821
+ /** Current state of the device */
257
822
  state: DeviceState;
258
823
  }
824
+ /**
825
+ * Asterisk system information.
826
+ */
259
827
  export interface AsteriskInfo {
828
+ /** Build information */
260
829
  build?: BuildInfo;
830
+ /** System information */
261
831
  system?: SystemInfo;
832
+ /** Configuration information */
262
833
  config?: ConfigInfo;
834
+ /** Current status information */
263
835
  status?: StatusInfo;
264
836
  }
837
+ /**
838
+ * Asterisk build information.
839
+ */
265
840
  export interface BuildInfo {
841
+ /** Operating system name */
266
842
  os: string;
843
+ /** Kernel version */
267
844
  kernel: string;
845
+ /** Build options */
268
846
  options: string;
847
+ /** Machine architecture */
269
848
  machine: string;
849
+ /** Build date */
270
850
  date: string;
851
+ /** User who built Asterisk */
271
852
  user: string;
272
853
  }
854
+ /**
855
+ * Asterisk system information.
856
+ */
273
857
  export interface SystemInfo {
858
+ /** Asterisk version string */
274
859
  version: string;
860
+ /** Entity ID for this Asterisk instance */
275
861
  entity_id: string;
276
862
  }
863
+ /**
864
+ * Asterisk configuration information.
865
+ */
277
866
  export interface ConfigInfo {
867
+ /** System name */
278
868
  name: string;
869
+ /** Default language */
279
870
  default_language: string;
871
+ /** Maximum number of channels */
280
872
  max_channels?: number;
873
+ /** Maximum number of open files */
281
874
  max_open_files?: number;
875
+ /** Maximum load average */
282
876
  max_load?: number;
877
+ /** User/group IDs Asterisk runs as */
283
878
  setid?: SetId;
284
879
  }
880
+ /**
881
+ * User and group ID information.
882
+ */
285
883
  export interface SetId {
884
+ /** User ID/name */
286
885
  user: string;
886
+ /** Group ID/name */
287
887
  group: string;
288
888
  }
889
+ /**
890
+ * Asterisk status information.
891
+ */
289
892
  export interface StatusInfo {
893
+ /** ISO 8601 timestamp when Asterisk started */
290
894
  startup_time: string;
895
+ /** ISO 8601 timestamp of last reload */
291
896
  last_reload_time: string;
292
897
  }
898
+ /**
899
+ * A channel variable value.
900
+ */
293
901
  export interface Variable {
902
+ /** The variable's value */
294
903
  value: string;
295
904
  }
905
+ /**
906
+ * Asterisk module information.
907
+ */
296
908
  export interface Module {
909
+ /** Module name */
297
910
  name: string;
911
+ /** Module description */
298
912
  description: string;
913
+ /** Number of uses of this module */
299
914
  use_count: number;
915
+ /** Module status (e.g., "Running") */
300
916
  status: string;
917
+ /** Support level (e.g., "core", "extended") */
301
918
  support_level: string;
302
919
  }
920
+ /**
921
+ * Asterisk log channel information.
922
+ */
303
923
  export interface LogChannel {
924
+ /** Log channel name */
304
925
  channel: string;
926
+ /** Log type */
305
927
  type: string;
928
+ /** Log channel status */
306
929
  status: string;
930
+ /** Log channel configuration */
307
931
  configuration: string;
308
932
  }
933
+ /**
934
+ * ARI API information from the resources.json endpoint.
935
+ * @internal
936
+ */
309
937
  export interface AriInfo {
938
+ /** ARI API version */
310
939
  apiVersion: string;
940
+ /** Swagger version */
311
941
  swaggerVersion: string;
942
+ /** Base path for API calls */
312
943
  basePath: string;
944
+ /** Resource path */
313
945
  resourcePath: string;
946
+ /** Available API declarations */
314
947
  apis: ApiDeclaration[];
948
+ /** Model definitions */
315
949
  models?: Record<string, unknown>;
316
950
  }
951
+ /**
952
+ * API declaration from resources.json.
953
+ * @internal
954
+ */
317
955
  export interface ApiDeclaration {
956
+ /** API path */
318
957
  path: string;
958
+ /** API description */
319
959
  description?: string;
320
960
  }
961
+ /**
962
+ * Root resources.json structure.
963
+ * @internal
964
+ */
321
965
  export interface ResourcesJson {
966
+ /** ARI API version */
322
967
  apiVersion: string;
968
+ /** Swagger version */
323
969
  swaggerVersion: string;
970
+ /** Base path for API calls */
324
971
  basePath: string;
972
+ /** Available APIs */
325
973
  apis: ApiListing[];
326
974
  }
975
+ /**
976
+ * API listing entry from resources.json.
977
+ * @internal
978
+ */
327
979
  export interface ApiListing {
980
+ /** API path */
328
981
  path: string;
982
+ /** API description */
329
983
  description: string;
330
984
  }
331
985
  //# sourceMappingURL=api.d.ts.map