retell-sdk 5.22.0 → 5.24.0

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +10 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +10 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/agent.d.mts +17 -4
  10. package/resources/agent.d.mts.map +1 -1
  11. package/resources/agent.d.ts +17 -4
  12. package/resources/agent.d.ts.map +1 -1
  13. package/resources/agent.js +15 -0
  14. package/resources/agent.js.map +1 -1
  15. package/resources/agent.mjs +15 -0
  16. package/resources/agent.mjs.map +1 -1
  17. package/resources/batch-call.d.mts +2 -2
  18. package/resources/batch-call.d.mts.map +1 -1
  19. package/resources/batch-call.d.ts +2 -2
  20. package/resources/batch-call.d.ts.map +1 -1
  21. package/resources/call.d.mts +1754 -120
  22. package/resources/call.d.mts.map +1 -1
  23. package/resources/call.d.ts +1754 -120
  24. package/resources/call.d.ts.map +1 -1
  25. package/resources/call.js +7 -4
  26. package/resources/call.js.map +1 -1
  27. package/resources/call.mjs +7 -4
  28. package/resources/call.mjs.map +1 -1
  29. package/resources/chat-agent.d.mts +16 -1
  30. package/resources/chat-agent.d.mts.map +1 -1
  31. package/resources/chat-agent.d.ts +16 -1
  32. package/resources/chat-agent.d.ts.map +1 -1
  33. package/resources/chat-agent.js +17 -0
  34. package/resources/chat-agent.js.map +1 -1
  35. package/resources/chat-agent.mjs +17 -0
  36. package/resources/chat-agent.mjs.map +1 -1
  37. package/resources/chat.d.mts +38 -12
  38. package/resources/chat.d.mts.map +1 -1
  39. package/resources/chat.d.ts +38 -12
  40. package/resources/chat.d.ts.map +1 -1
  41. package/resources/chat.js +8 -5
  42. package/resources/chat.js.map +1 -1
  43. package/resources/chat.mjs +8 -5
  44. package/resources/chat.mjs.map +1 -1
  45. package/resources/conversation-flow-component.d.mts +33 -5
  46. package/resources/conversation-flow-component.d.mts.map +1 -1
  47. package/resources/conversation-flow-component.d.ts +33 -5
  48. package/resources/conversation-flow-component.d.ts.map +1 -1
  49. package/resources/conversation-flow-component.js +8 -4
  50. package/resources/conversation-flow-component.js.map +1 -1
  51. package/resources/conversation-flow-component.mjs +8 -4
  52. package/resources/conversation-flow-component.mjs.map +1 -1
  53. package/resources/conversation-flow.d.mts +21 -14
  54. package/resources/conversation-flow.d.mts.map +1 -1
  55. package/resources/conversation-flow.d.ts +21 -14
  56. package/resources/conversation-flow.d.ts.map +1 -1
  57. package/resources/conversation-flow.js +7 -3
  58. package/resources/conversation-flow.js.map +1 -1
  59. package/resources/conversation-flow.mjs +7 -3
  60. package/resources/conversation-flow.mjs.map +1 -1
  61. package/resources/index.d.mts +5 -5
  62. package/resources/index.d.mts.map +1 -1
  63. package/resources/index.d.ts +5 -5
  64. package/resources/index.d.ts.map +1 -1
  65. package/resources/index.js.map +1 -1
  66. package/resources/index.mjs.map +1 -1
  67. package/resources/llm.d.mts +23 -15
  68. package/resources/llm.d.mts.map +1 -1
  69. package/resources/llm.d.ts +23 -15
  70. package/resources/llm.d.ts.map +1 -1
  71. package/resources/llm.js +6 -3
  72. package/resources/llm.js.map +1 -1
  73. package/resources/llm.mjs +6 -3
  74. package/resources/llm.mjs.map +1 -1
  75. package/resources/phone-number.d.mts +32 -5
  76. package/resources/phone-number.d.mts.map +1 -1
  77. package/resources/phone-number.d.ts +32 -5
  78. package/resources/phone-number.d.ts.map +1 -1
  79. package/resources/phone-number.js +7 -4
  80. package/resources/phone-number.js.map +1 -1
  81. package/resources/phone-number.mjs +7 -4
  82. package/resources/phone-number.mjs.map +1 -1
  83. package/resources/tests.d.mts +64 -14
  84. package/resources/tests.d.mts.map +1 -1
  85. package/resources/tests.d.ts +64 -14
  86. package/resources/tests.d.ts.map +1 -1
  87. package/resources/tests.js +7 -13
  88. package/resources/tests.js.map +1 -1
  89. package/resources/tests.mjs +7 -13
  90. package/resources/tests.mjs.map +1 -1
  91. package/src/client.ts +10 -0
  92. package/src/resources/agent.ts +29 -0
  93. package/src/resources/batch-call.ts +3 -1
  94. package/src/resources/call.ts +2207 -118
  95. package/src/resources/chat-agent.ts +25 -0
  96. package/src/resources/chat.ts +42 -17
  97. package/src/resources/conversation-flow-component.ts +42 -5
  98. package/src/resources/conversation-flow.ts +24 -15
  99. package/src/resources/index.ts +5 -0
  100. package/src/resources/llm.ts +26 -16
  101. package/src/resources/phone-number.ts +41 -5
  102. package/src/resources/tests.ts +83 -16
  103. package/src/version.ts +1 -1
  104. package/version.d.mts +1 -1
  105. package/version.d.ts +1 -1
  106. package/version.js +1 -1
  107. package/version.mjs +1 -1
@@ -43,12 +43,15 @@ export class Call extends APIResource {
43
43
  }
44
44
 
45
45
  /**
46
- * Retrieve call details
46
+ * List calls with unified cursor pagination response.
47
47
  *
48
- * @deprecated
48
+ * @example
49
+ * ```ts
50
+ * const calls = await client.call.list();
51
+ * ```
49
52
  */
50
- list(body: CallListParams, options?: RequestOptions): APIPromise<CallListResponse> {
51
- return this._client.post('/v2/list-calls', {
53
+ list(body: CallListParams | null | undefined = {}, options?: RequestOptions): APIPromise<CallListResponse> {
54
+ return this._client.post('/v3/list-calls', {
52
55
  body,
53
56
  timeout: (this._client as any)._options.timeout ?? 300000,
54
57
  ...options,
@@ -2281,110 +2284,100 @@ export namespace WebCallResponse {
2281
2284
  }
2282
2285
  }
2283
2286
 
2284
- export type CallListResponse = Array<CallResponse>;
2285
-
2286
- export interface CallUpdateParams {
2287
- /**
2288
- * Custom attributes for the call
2289
- */
2290
- custom_attributes?: { [key: string]: string | number | boolean };
2291
-
2287
+ export interface CallListResponse {
2292
2288
  /**
2293
- * Data storage setting for this call. Overrides the agent's default setting.
2294
- * "everything" stores all data, "everything_except_pii" excludes PII when
2295
- * possible, "basic_attributes_only" stores only metadata. Cannot be downgraded
2296
- * from more restrictive to less restrictive settings.
2289
+ * Whether more results are available.
2297
2290
  */
2298
- data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only';
2291
+ has_more?: boolean;
2299
2292
 
2300
- /**
2301
- * An arbitrary object for storage purpose only. You can put anything here like
2302
- * your internal customer id associated with the call. Not used for processing. You
2303
- * can later get this field from the call object. Size limited to 50kB max.
2304
- */
2305
- metadata?: unknown;
2293
+ items?: Array<CallListResponse.V3WebCallResponse | CallListResponse.V3PhoneCallResponse>;
2306
2294
 
2307
2295
  /**
2308
- * Override dynamic varaibles represented as key-value pairs of strings. Setting
2309
- * this will override or add the dynamic variables set in the agent during the
2310
- * call. Only need to set the delta where you want to override, no need to set the
2311
- * entire dynamic variables object. Setting this to null will remove any existing
2312
- * override.
2296
+ * Pagination key for the next page.
2313
2297
  */
2314
- override_dynamic_variables?: { [key: string]: string } | null;
2298
+ pagination_key?: string;
2315
2299
  }
2316
2300
 
2317
- export interface CallListParams {
2318
- /**
2319
- * Filter criteria for the calls to retrieve.
2320
- */
2321
- filter_criteria?: CallListParams.FilterCriteria;
2301
+ export namespace CallListResponse {
2302
+ export interface V3WebCallResponse {
2303
+ /**
2304
+ * Access token to enter the web call room. This needs to be passed to your
2305
+ * frontend to join the call.
2306
+ */
2307
+ access_token: string;
2322
2308
 
2323
- /**
2324
- * Limit the number of calls returned. Default 50, Max 1000. To retrieve more than
2325
- * 1000, use pagination_key to continue fetching the next page.
2326
- */
2327
- limit?: number;
2309
+ /**
2310
+ * Corresponding agent id of this call.
2311
+ */
2312
+ agent_id: string;
2328
2313
 
2329
- /**
2330
- * The pagination key to continue fetching the next page of calls. Pagination key
2331
- * is represented by a call id here, and it's exclusive (not included in the
2332
- * fetched calls). The last call id from the list calls is usually used as
2333
- * pagination key here. If not set, will start from the beginning.
2334
- */
2335
- pagination_key?: string;
2314
+ /**
2315
+ * The version of the agent.
2316
+ */
2317
+ agent_version: number;
2336
2318
 
2337
- /**
2338
- * The calls will be sorted by `start_timestamp`, whether to return the calls in
2339
- * ascending or descending order.
2340
- */
2341
- sort_order?: 'ascending' | 'descending';
2342
- }
2319
+ /**
2320
+ * Unique id of the call. Used to identify the call in the LLM websocket and used
2321
+ * to authenticate in the audio websocket.
2322
+ */
2323
+ call_id: string;
2324
+
2325
+ /**
2326
+ * Status of call.
2327
+ *
2328
+ * - `registered`: Call id issued, starting to make a call using this id.
2329
+ * - `ongoing`: Call connected and ongoing.
2330
+ * - `ended`: The underlying websocket has ended for the call. Either user or agent
2331
+ * hung up, or call transferred.
2332
+ * - `error`: Call encountered error.
2333
+ */
2334
+ call_status: 'registered' | 'not_connected' | 'ongoing' | 'ended' | 'error';
2343
2335
 
2344
- export namespace CallListParams {
2345
- /**
2346
- * Filter criteria for the calls to retrieve.
2347
- */
2348
- export interface FilterCriteria {
2349
2336
  /**
2350
- * Only retrieve calls that are made with specific agent(s).
2337
+ * Type of the call. Used to distinguish between web call and phone call.
2351
2338
  */
2352
- agent_id?: Array<string>;
2339
+ call_type: 'web_call';
2353
2340
 
2354
2341
  /**
2355
- * Only retrieve calls with specific batch call id(s).
2342
+ * Name of the agent.
2356
2343
  */
2357
- batch_call_id?: Array<string>;
2344
+ agent_name?: string;
2358
2345
 
2359
2346
  /**
2360
- * Only retrieve calls with specific call id(s).
2347
+ * Post call analysis that includes information such as sentiment, status, summary,
2348
+ * and custom defined data to extract. Available after call ends. Subscribe to
2349
+ * `call_analyzed` webhook event type to receive it once ready.
2361
2350
  */
2362
- call_id?: Array<string>;
2351
+ call_analysis?: V3WebCallResponse.CallAnalysis;
2363
2352
 
2364
2353
  /**
2365
- * Only retrieve calls with specific call status(es).
2354
+ * Cost of the call, including all the products and their costs and discount.
2366
2355
  */
2367
- call_status?: Array<'not_connected' | 'ongoing' | 'ended' | 'error'>;
2356
+ call_cost?: V3WebCallResponse.CallCost;
2368
2357
 
2369
2358
  /**
2370
- * Only retrieve calls with specific call successful(s).
2359
+ * Dynamic variables collected from the call. Only available after the call ends.
2371
2360
  */
2372
- call_successful?: Array<boolean>;
2361
+ collected_dynamic_variables?: { [key: string]: unknown };
2373
2362
 
2374
2363
  /**
2375
- * Only retrieve calls with specific call type(s).
2364
+ * Custom SIP headers to be added to the call.
2376
2365
  */
2377
- call_type?: Array<'web_call' | 'phone_call'>;
2366
+ custom_sip_headers?: { [key: string]: string };
2378
2367
 
2379
2368
  /**
2380
- * Only retrieve calls with specific direction(s).
2369
+ * Data storage setting for this call's agent. "everything" stores all data,
2370
+ * "everything_except_pii" excludes PII when possible, "basic_attributes_only"
2371
+ * stores only metadata.
2381
2372
  */
2382
- direction?: Array<'inbound' | 'outbound'>;
2373
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only' | null;
2383
2374
 
2384
2375
  /**
2385
- * Only retrieve calls with specific disconnection reason(s).
2376
+ * The reason for the disconnection of the call. Read detailed description about
2377
+ * reasons listed here at
2378
+ * [Disconnection Reason Doc](/reliability/debug-call-disconnect#understanding-disconnection-reasons).
2386
2379
  */
2387
- disconnection_reason?: Array<
2380
+ disconnection_reason?:
2388
2381
  | 'user_hangup'
2389
2382
  | 'agent_hangup'
2390
2383
  | 'call_transfer'
@@ -2416,96 +2409,2186 @@ export namespace CallListParams {
2416
2409
  | 'registered_call_timeout'
2417
2410
  | 'transfer_bridged'
2418
2411
  | 'transfer_cancelled'
2419
- | 'manual_stopped'
2420
- >;
2412
+ | 'manual_stopped';
2413
+
2414
+ /**
2415
+ * Duration of the call in milliseconds. Available after call ends.
2416
+ */
2417
+ duration_ms?: number;
2418
+
2419
+ /**
2420
+ * End timestamp (milliseconds since epoch) of the call. Available after call ends.
2421
+ */
2422
+ end_timestamp?: number;
2421
2423
 
2422
2424
  /**
2423
- * Only retrieve calls with specific range of duration(s).
2425
+ * URL to the knowledge base retrieved contents of the call. Available after call
2426
+ * ends if the call utilizes knowledge base feature. It consists of the respond id
2427
+ * and the retrieved contents related to that response. It's already rendered in
2428
+ * call history tab of dashboard, and you can also manually download and check
2429
+ * against the transcript to view the knowledge base retrieval results.
2424
2430
  */
2425
- duration_ms?: FilterCriteria.DurationMs;
2431
+ knowledge_base_retrieved_contents_url?: string;
2426
2432
 
2427
2433
  /**
2428
- * Filter by dynamic variables using dot notation (e.g., `dynamic_variables.name`).
2429
- * Values are matched exactly as strings.
2434
+ * Latency tracking of the call, available after call ends. Not all fields here
2435
+ * will be available, as it depends on the type of call and feature used.
2430
2436
  */
2431
- dynamic_variables?: { [key: string]: Array<string> };
2437
+ latency?: V3WebCallResponse.Latency;
2432
2438
 
2433
- e2e_latency_p50?: FilterCriteria.E2ELatencyP50;
2439
+ /**
2440
+ * LLM token usage of the call, available after call ends. Not populated if using
2441
+ * custom LLM, realtime API, or no LLM call is made.
2442
+ */
2443
+ llm_token_usage?: V3WebCallResponse.LlmTokenUsage;
2444
+
2445
+ /**
2446
+ * An arbitrary object for storage purpose only. You can put anything here like
2447
+ * your internal customer id associated with the call. Not used for processing. You
2448
+ * can later get this field from the call object.
2449
+ */
2450
+ metadata?: unknown;
2451
+
2452
+ /**
2453
+ * Whether this agent opts in for signed URLs for public logs and recordings. When
2454
+ * enabled, the generated URLs will include security signatures that restrict
2455
+ * access and automatically expire after 24 hours.
2456
+ */
2457
+ opt_in_signed_url?: boolean;
2434
2458
 
2435
2459
  /**
2436
- * Only retrieve calls with specific range of end timestamp(s).
2460
+ * Public log of the call, containing details about all the requests and responses
2461
+ * received in LLM WebSocket, latency tracking for each turntaking, helpful for
2462
+ * debugging and tracing. Available after call ends.
2437
2463
  */
2438
- end_timestamp?: FilterCriteria.EndTimestamp;
2464
+ public_log_url?: string;
2439
2465
 
2440
2466
  /**
2441
- * Only retrieve calls with specific from number(s).
2467
+ * Recording of the call, with each party's audio stored in a separate channel.
2468
+ * Available after the call ends.
2442
2469
  */
2443
- from_number?: Array<string>;
2470
+ recording_multi_channel_url?: string;
2444
2471
 
2445
2472
  /**
2446
- * Only retrieve calls that are in voicemail or not in voicemail.
2473
+ * Recording of the call. Available after call ends.
2447
2474
  */
2448
- in_voicemail?: Array<boolean>;
2475
+ recording_url?: string;
2449
2476
 
2450
2477
  /**
2451
- * Filter by metadata fields using dot notation (e.g., `metadata.customer_id`).
2452
- * Values are matched exactly as strings.
2478
+ * Add optional dynamic variables in key value pairs of string that injects into
2479
+ * your Response Engine prompt and tool description. Only applicable for Response
2480
+ * Engine.
2453
2481
  */
2454
- metadata?: { [key: string]: Array<string> };
2482
+ retell_llm_dynamic_variables?: { [key: string]: unknown };
2455
2483
 
2456
2484
  /**
2457
- * Only retrieve calls with specific range of start timestamp(s).
2485
+ * Recording of the call without PII, with each party's audio stored in a separate
2486
+ * channel. Available after the call ends.
2458
2487
  */
2459
- start_timestamp?: FilterCriteria.StartTimestamp;
2488
+ scrubbed_recording_multi_channel_url?: string;
2460
2489
 
2461
2490
  /**
2462
- * Only retrieve calls with specific to number(s).
2491
+ * Recording of the call without PII. Available after call ends.
2463
2492
  */
2464
- to_number?: Array<string>;
2493
+ scrubbed_recording_url?: string;
2465
2494
 
2466
2495
  /**
2467
- * Only retrieve calls with specific user sentiment(s).
2496
+ * Begin timestamp (milliseconds since epoch) of the call. Available after call
2497
+ * starts.
2468
2498
  */
2469
- user_sentiment?: Array<'Negative' | 'Positive' | 'Neutral' | 'Unknown'>;
2499
+ start_timestamp?: number;
2470
2500
 
2471
2501
  /**
2472
- * The version of the agent to use for the call.
2502
+ * The destination number or identifier where the call was transferred to. Only
2503
+ * populated when the disconnection reason was `call_transfer`. Can be a phone
2504
+ * number or a SIP URI. SIP URIs are prefixed with "sip:" and may include a
2505
+ * ";transport=..." portion (if transport is known) where the transport type can be
2506
+ * "tls", "tcp" or "udp".
2473
2507
  */
2474
- version?: Array<number>;
2508
+ transfer_destination?: string | null;
2509
+
2510
+ /**
2511
+ * Transfer end timestamp (milliseconds since epoch) of the call. Available after
2512
+ * transfer call ends.
2513
+ */
2514
+ transfer_end_timestamp?: number;
2475
2515
  }
2476
2516
 
2477
- export namespace FilterCriteria {
2517
+ export namespace V3WebCallResponse {
2478
2518
  /**
2479
- * Only retrieve calls with specific range of duration(s).
2519
+ * Post call analysis that includes information such as sentiment, status, summary,
2520
+ * and custom defined data to extract. Available after call ends. Subscribe to
2521
+ * `call_analyzed` webhook event type to receive it once ready.
2480
2522
  */
2481
- export interface DurationMs {
2482
- lower_threshold?: number;
2523
+ export interface CallAnalysis {
2524
+ /**
2525
+ * Whether the agent seems to have a successful call with the user, where the agent
2526
+ * finishes the task, and the call was complete without being cutoff.
2527
+ */
2528
+ call_successful?: boolean;
2483
2529
 
2484
- upper_threshold?: number;
2485
- }
2530
+ /**
2531
+ * A high level summary of the call.
2532
+ */
2533
+ call_summary?: string;
2534
+
2535
+ /**
2536
+ * Custom analysis data that was extracted based on the schema defined in agent
2537
+ * post call analysis data. Can be empty if nothing is specified.
2538
+ */
2539
+ custom_analysis_data?: unknown;
2486
2540
 
2487
- export interface E2ELatencyP50 {
2488
- lower_threshold?: number;
2541
+ /**
2542
+ * Whether the call is entered voicemail.
2543
+ */
2544
+ in_voicemail?: boolean;
2489
2545
 
2490
- upper_threshold?: number;
2546
+ /**
2547
+ * Sentiment of the user in the call.
2548
+ */
2549
+ user_sentiment?: 'Negative' | 'Positive' | 'Neutral' | 'Unknown';
2491
2550
  }
2492
2551
 
2493
2552
  /**
2494
- * Only retrieve calls with specific range of end timestamp(s).
2553
+ * Cost of the call, including all the products and their costs and discount.
2495
2554
  */
2496
- export interface EndTimestamp {
2497
- lower_threshold?: number;
2555
+ export interface CallCost {
2556
+ /**
2557
+ * Combined cost of all individual costs in cents
2558
+ */
2559
+ combined_cost: number;
2560
+
2561
+ /**
2562
+ * List of products with their unit prices and costs in cents
2563
+ */
2564
+ product_costs: Array<CallCost.ProductCost>;
2565
+
2566
+ /**
2567
+ * Total duration of the call in seconds
2568
+ */
2569
+ total_duration_seconds: number;
2498
2570
 
2499
- upper_threshold?: number;
2571
+ /**
2572
+ * Total unit duration price of all products in cents per second
2573
+ */
2574
+ total_duration_unit_price: number;
2575
+ }
2576
+
2577
+ export namespace CallCost {
2578
+ export interface ProductCost {
2579
+ /**
2580
+ * Cost for the product in cents for the duration of the call.
2581
+ */
2582
+ cost: number;
2583
+
2584
+ /**
2585
+ * Product name that has a cost associated with it.
2586
+ */
2587
+ product: string;
2588
+
2589
+ /**
2590
+ * True if this cost item is for a transfer segment.
2591
+ */
2592
+ is_transfer_leg_cost?: boolean;
2593
+
2594
+ /**
2595
+ * Unit price of the product in cents per second.
2596
+ */
2597
+ unit_price?: number;
2598
+ }
2500
2599
  }
2501
2600
 
2502
2601
  /**
2503
- * Only retrieve calls with specific range of start timestamp(s).
2602
+ * Latency tracking of the call, available after call ends. Not all fields here
2603
+ * will be available, as it depends on the type of call and feature used.
2504
2604
  */
2505
- export interface StartTimestamp {
2506
- lower_threshold?: number;
2605
+ export interface Latency {
2606
+ /**
2607
+ * Transcription latency (diff between the duration of the chunks streamed and the
2608
+ * durations of the transcribed part) tracking of the call.
2609
+ */
2610
+ asr?: Latency.Asr;
2611
+
2612
+ /**
2613
+ * End to end latency (from user stops talking to agent start talking) tracking of
2614
+ * the call. This latency does not account for the network trip time from Retell
2615
+ * server to user frontend. The latency is tracked every time turn change between
2616
+ * user and agent.
2617
+ */
2618
+ e2e?: Latency.E2E;
2619
+
2620
+ /**
2621
+ * Knowledge base latency (from the triggering of knowledge base retrival to all
2622
+ * relevant context received) tracking of the call. Only populated when using
2623
+ * knowledge base feature for the agent of the call.
2624
+ */
2625
+ knowledge_base?: Latency.KnowledgeBase;
2626
+
2627
+ /**
2628
+ * LLM latency (from issue of LLM call to first speakable chunk received) tracking
2629
+ * of the call. When using custom LLM. this latency includes LLM websocket
2630
+ * roundtrip time between user server and Retell server.
2631
+ */
2632
+ llm?: Latency.Llm;
2633
+
2634
+ /**
2635
+ * LLM websocket roundtrip latency (between user server and Retell server) tracking
2636
+ * of the call. Only populated for calls using custom LLM.
2637
+ */
2638
+ llm_websocket_network_rtt?: Latency.LlmWebsocketNetworkRtt;
2639
+
2640
+ /**
2641
+ * Speech-to-speech latency (from requesting responses of a S2S model to first byte
2642
+ * received) tracking of the call. Only populated for calls that uses S2S model
2643
+ * like Realtime API.
2644
+ */
2645
+ s2s?: Latency.S2s;
2646
+
2647
+ /**
2648
+ * Text-to-speech latency (from the triggering of TTS to first byte received)
2649
+ * tracking of the call.
2650
+ */
2651
+ tts?: Latency.Tts;
2652
+ }
2653
+
2654
+ export namespace Latency {
2655
+ /**
2656
+ * Transcription latency (diff between the duration of the chunks streamed and the
2657
+ * durations of the transcribed part) tracking of the call.
2658
+ */
2659
+ export interface Asr {
2660
+ /**
2661
+ * Maximum latency in the call, measured in milliseconds.
2662
+ */
2663
+ max?: number;
2664
+
2665
+ /**
2666
+ * Minimum latency in the call, measured in milliseconds.
2667
+ */
2668
+ min?: number;
2669
+
2670
+ /**
2671
+ * Number of data points (number of times latency is tracked).
2672
+ */
2673
+ num?: number;
2674
+
2675
+ /**
2676
+ * 50 percentile of latency, measured in milliseconds.
2677
+ */
2678
+ p50?: number;
2679
+
2680
+ /**
2681
+ * 90 percentile of latency, measured in milliseconds.
2682
+ */
2683
+ p90?: number;
2684
+
2685
+ /**
2686
+ * 95 percentile of latency, measured in milliseconds.
2687
+ */
2688
+ p95?: number;
2689
+
2690
+ /**
2691
+ * 99 percentile of latency, measured in milliseconds.
2692
+ */
2693
+ p99?: number;
2694
+
2695
+ /**
2696
+ * All the latency data points in the call, measured in milliseconds.
2697
+ */
2698
+ values?: Array<number>;
2699
+ }
2700
+
2701
+ /**
2702
+ * End to end latency (from user stops talking to agent start talking) tracking of
2703
+ * the call. This latency does not account for the network trip time from Retell
2704
+ * server to user frontend. The latency is tracked every time turn change between
2705
+ * user and agent.
2706
+ */
2707
+ export interface E2E {
2708
+ /**
2709
+ * Maximum latency in the call, measured in milliseconds.
2710
+ */
2711
+ max?: number;
2712
+
2713
+ /**
2714
+ * Minimum latency in the call, measured in milliseconds.
2715
+ */
2716
+ min?: number;
2717
+
2718
+ /**
2719
+ * Number of data points (number of times latency is tracked).
2720
+ */
2721
+ num?: number;
2722
+
2723
+ /**
2724
+ * 50 percentile of latency, measured in milliseconds.
2725
+ */
2726
+ p50?: number;
2727
+
2728
+ /**
2729
+ * 90 percentile of latency, measured in milliseconds.
2730
+ */
2731
+ p90?: number;
2732
+
2733
+ /**
2734
+ * 95 percentile of latency, measured in milliseconds.
2735
+ */
2736
+ p95?: number;
2737
+
2738
+ /**
2739
+ * 99 percentile of latency, measured in milliseconds.
2740
+ */
2741
+ p99?: number;
2742
+
2743
+ /**
2744
+ * All the latency data points in the call, measured in milliseconds.
2745
+ */
2746
+ values?: Array<number>;
2747
+ }
2748
+
2749
+ /**
2750
+ * Knowledge base latency (from the triggering of knowledge base retrival to all
2751
+ * relevant context received) tracking of the call. Only populated when using
2752
+ * knowledge base feature for the agent of the call.
2753
+ */
2754
+ export interface KnowledgeBase {
2755
+ /**
2756
+ * Maximum latency in the call, measured in milliseconds.
2757
+ */
2758
+ max?: number;
2759
+
2760
+ /**
2761
+ * Minimum latency in the call, measured in milliseconds.
2762
+ */
2763
+ min?: number;
2764
+
2765
+ /**
2766
+ * Number of data points (number of times latency is tracked).
2767
+ */
2768
+ num?: number;
2769
+
2770
+ /**
2771
+ * 50 percentile of latency, measured in milliseconds.
2772
+ */
2773
+ p50?: number;
2774
+
2775
+ /**
2776
+ * 90 percentile of latency, measured in milliseconds.
2777
+ */
2778
+ p90?: number;
2779
+
2780
+ /**
2781
+ * 95 percentile of latency, measured in milliseconds.
2782
+ */
2783
+ p95?: number;
2784
+
2785
+ /**
2786
+ * 99 percentile of latency, measured in milliseconds.
2787
+ */
2788
+ p99?: number;
2789
+
2790
+ /**
2791
+ * All the latency data points in the call, measured in milliseconds.
2792
+ */
2793
+ values?: Array<number>;
2794
+ }
2795
+
2796
+ /**
2797
+ * LLM latency (from issue of LLM call to first speakable chunk received) tracking
2798
+ * of the call. When using custom LLM. this latency includes LLM websocket
2799
+ * roundtrip time between user server and Retell server.
2800
+ */
2801
+ export interface Llm {
2802
+ /**
2803
+ * Maximum latency in the call, measured in milliseconds.
2804
+ */
2805
+ max?: number;
2806
+
2807
+ /**
2808
+ * Minimum latency in the call, measured in milliseconds.
2809
+ */
2810
+ min?: number;
2811
+
2812
+ /**
2813
+ * Number of data points (number of times latency is tracked).
2814
+ */
2815
+ num?: number;
2816
+
2817
+ /**
2818
+ * 50 percentile of latency, measured in milliseconds.
2819
+ */
2820
+ p50?: number;
2821
+
2822
+ /**
2823
+ * 90 percentile of latency, measured in milliseconds.
2824
+ */
2825
+ p90?: number;
2826
+
2827
+ /**
2828
+ * 95 percentile of latency, measured in milliseconds.
2829
+ */
2830
+ p95?: number;
2831
+
2832
+ /**
2833
+ * 99 percentile of latency, measured in milliseconds.
2834
+ */
2835
+ p99?: number;
2836
+
2837
+ /**
2838
+ * All the latency data points in the call, measured in milliseconds.
2839
+ */
2840
+ values?: Array<number>;
2841
+ }
2842
+
2843
+ /**
2844
+ * LLM websocket roundtrip latency (between user server and Retell server) tracking
2845
+ * of the call. Only populated for calls using custom LLM.
2846
+ */
2847
+ export interface LlmWebsocketNetworkRtt {
2848
+ /**
2849
+ * Maximum latency in the call, measured in milliseconds.
2850
+ */
2851
+ max?: number;
2852
+
2853
+ /**
2854
+ * Minimum latency in the call, measured in milliseconds.
2855
+ */
2856
+ min?: number;
2857
+
2858
+ /**
2859
+ * Number of data points (number of times latency is tracked).
2860
+ */
2861
+ num?: number;
2862
+
2863
+ /**
2864
+ * 50 percentile of latency, measured in milliseconds.
2865
+ */
2866
+ p50?: number;
2867
+
2868
+ /**
2869
+ * 90 percentile of latency, measured in milliseconds.
2870
+ */
2871
+ p90?: number;
2872
+
2873
+ /**
2874
+ * 95 percentile of latency, measured in milliseconds.
2875
+ */
2876
+ p95?: number;
2877
+
2878
+ /**
2879
+ * 99 percentile of latency, measured in milliseconds.
2880
+ */
2881
+ p99?: number;
2882
+
2883
+ /**
2884
+ * All the latency data points in the call, measured in milliseconds.
2885
+ */
2886
+ values?: Array<number>;
2887
+ }
2888
+
2889
+ /**
2890
+ * Speech-to-speech latency (from requesting responses of a S2S model to first byte
2891
+ * received) tracking of the call. Only populated for calls that uses S2S model
2892
+ * like Realtime API.
2893
+ */
2894
+ export interface S2s {
2895
+ /**
2896
+ * Maximum latency in the call, measured in milliseconds.
2897
+ */
2898
+ max?: number;
2899
+
2900
+ /**
2901
+ * Minimum latency in the call, measured in milliseconds.
2902
+ */
2903
+ min?: number;
2904
+
2905
+ /**
2906
+ * Number of data points (number of times latency is tracked).
2907
+ */
2908
+ num?: number;
2909
+
2910
+ /**
2911
+ * 50 percentile of latency, measured in milliseconds.
2912
+ */
2913
+ p50?: number;
2914
+
2915
+ /**
2916
+ * 90 percentile of latency, measured in milliseconds.
2917
+ */
2918
+ p90?: number;
2919
+
2920
+ /**
2921
+ * 95 percentile of latency, measured in milliseconds.
2922
+ */
2923
+ p95?: number;
2924
+
2925
+ /**
2926
+ * 99 percentile of latency, measured in milliseconds.
2927
+ */
2928
+ p99?: number;
2929
+
2930
+ /**
2931
+ * All the latency data points in the call, measured in milliseconds.
2932
+ */
2933
+ values?: Array<number>;
2934
+ }
2935
+
2936
+ /**
2937
+ * Text-to-speech latency (from the triggering of TTS to first byte received)
2938
+ * tracking of the call.
2939
+ */
2940
+ export interface Tts {
2941
+ /**
2942
+ * Maximum latency in the call, measured in milliseconds.
2943
+ */
2944
+ max?: number;
2945
+
2946
+ /**
2947
+ * Minimum latency in the call, measured in milliseconds.
2948
+ */
2949
+ min?: number;
2950
+
2951
+ /**
2952
+ * Number of data points (number of times latency is tracked).
2953
+ */
2954
+ num?: number;
2955
+
2956
+ /**
2957
+ * 50 percentile of latency, measured in milliseconds.
2958
+ */
2959
+ p50?: number;
2960
+
2961
+ /**
2962
+ * 90 percentile of latency, measured in milliseconds.
2963
+ */
2964
+ p90?: number;
2965
+
2966
+ /**
2967
+ * 95 percentile of latency, measured in milliseconds.
2968
+ */
2969
+ p95?: number;
2970
+
2971
+ /**
2972
+ * 99 percentile of latency, measured in milliseconds.
2973
+ */
2974
+ p99?: number;
2975
+
2976
+ /**
2977
+ * All the latency data points in the call, measured in milliseconds.
2978
+ */
2979
+ values?: Array<number>;
2980
+ }
2981
+ }
2982
+
2983
+ /**
2984
+ * LLM token usage of the call, available after call ends. Not populated if using
2985
+ * custom LLM, realtime API, or no LLM call is made.
2986
+ */
2987
+ export interface LlmTokenUsage {
2988
+ /**
2989
+ * Average token count of the call.
2990
+ */
2991
+ average: number;
2992
+
2993
+ /**
2994
+ * Number of requests made to the LLM.
2995
+ */
2996
+ num_requests: number;
2997
+
2998
+ /**
2999
+ * All the token count values in the call.
3000
+ */
3001
+ values: Array<number>;
3002
+ }
3003
+ }
3004
+
3005
+ export interface V3PhoneCallResponse {
3006
+ /**
3007
+ * Corresponding agent id of this call.
3008
+ */
3009
+ agent_id: string;
3010
+
3011
+ /**
3012
+ * The version of the agent.
3013
+ */
3014
+ agent_version: number;
3015
+
3016
+ /**
3017
+ * Unique id of the call. Used to identify the call in the LLM websocket and used
3018
+ * to authenticate in the audio websocket.
3019
+ */
3020
+ call_id: string;
3021
+
3022
+ /**
3023
+ * Status of call.
3024
+ *
3025
+ * - `registered`: Call id issued, starting to make a call using this id.
3026
+ * - `ongoing`: Call connected and ongoing.
3027
+ * - `ended`: The underlying websocket has ended for the call. Either user or agent
3028
+ * hung up, or call transferred.
3029
+ * - `error`: Call encountered error.
3030
+ */
3031
+ call_status: 'registered' | 'not_connected' | 'ongoing' | 'ended' | 'error';
3032
+
3033
+ /**
3034
+ * Type of the call. Used to distinguish between web call and phone call.
3035
+ */
3036
+ call_type: 'phone_call';
3037
+
3038
+ /**
3039
+ * Direction of the phone call.
3040
+ */
3041
+ direction: 'inbound' | 'outbound';
3042
+
3043
+ /**
3044
+ * The caller number.
3045
+ */
3046
+ from_number: string;
3047
+
3048
+ /**
3049
+ * The callee number.
3050
+ */
3051
+ to_number: string;
3052
+
3053
+ /**
3054
+ * Name of the agent.
3055
+ */
3056
+ agent_name?: string;
3057
+
3058
+ /**
3059
+ * Post call analysis that includes information such as sentiment, status, summary,
3060
+ * and custom defined data to extract. Available after call ends. Subscribe to
3061
+ * `call_analyzed` webhook event type to receive it once ready.
3062
+ */
3063
+ call_analysis?: V3PhoneCallResponse.CallAnalysis;
3064
+
3065
+ /**
3066
+ * Cost of the call, including all the products and their costs and discount.
3067
+ */
3068
+ call_cost?: V3PhoneCallResponse.CallCost;
3069
+
3070
+ /**
3071
+ * Dynamic variables collected from the call. Only available after the call ends.
3072
+ */
3073
+ collected_dynamic_variables?: { [key: string]: unknown };
3074
+
3075
+ /**
3076
+ * Custom SIP headers to be added to the call.
3077
+ */
3078
+ custom_sip_headers?: { [key: string]: string };
3079
+
3080
+ /**
3081
+ * Data storage setting for this call's agent. "everything" stores all data,
3082
+ * "everything_except_pii" excludes PII when possible, "basic_attributes_only"
3083
+ * stores only metadata.
3084
+ */
3085
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only' | null;
3086
+
3087
+ /**
3088
+ * The reason for the disconnection of the call. Read detailed description about
3089
+ * reasons listed here at
3090
+ * [Disconnection Reason Doc](/reliability/debug-call-disconnect#understanding-disconnection-reasons).
3091
+ */
3092
+ disconnection_reason?:
3093
+ | 'user_hangup'
3094
+ | 'agent_hangup'
3095
+ | 'call_transfer'
3096
+ | 'voicemail_reached'
3097
+ | 'ivr_reached'
3098
+ | 'inactivity'
3099
+ | 'max_duration_reached'
3100
+ | 'concurrency_limit_reached'
3101
+ | 'no_valid_payment'
3102
+ | 'scam_detected'
3103
+ | 'dial_busy'
3104
+ | 'dial_failed'
3105
+ | 'dial_no_answer'
3106
+ | 'invalid_destination'
3107
+ | 'telephony_provider_permission_denied'
3108
+ | 'telephony_provider_unavailable'
3109
+ | 'sip_routing_error'
3110
+ | 'marked_as_spam'
3111
+ | 'user_declined'
3112
+ | 'error_llm_websocket_open'
3113
+ | 'error_llm_websocket_lost_connection'
3114
+ | 'error_llm_websocket_runtime'
3115
+ | 'error_llm_websocket_corrupt_payload'
3116
+ | 'error_no_audio_received'
3117
+ | 'error_asr'
3118
+ | 'error_retell'
3119
+ | 'error_unknown'
3120
+ | 'error_user_not_joined'
3121
+ | 'registered_call_timeout'
3122
+ | 'transfer_bridged'
3123
+ | 'transfer_cancelled'
3124
+ | 'manual_stopped';
3125
+
3126
+ /**
3127
+ * Duration of the call in milliseconds. Available after call ends.
3128
+ */
3129
+ duration_ms?: number;
3130
+
3131
+ /**
3132
+ * End timestamp (milliseconds since epoch) of the call. Available after call ends.
3133
+ */
3134
+ end_timestamp?: number;
3135
+
3136
+ /**
3137
+ * URL to the knowledge base retrieved contents of the call. Available after call
3138
+ * ends if the call utilizes knowledge base feature. It consists of the respond id
3139
+ * and the retrieved contents related to that response. It's already rendered in
3140
+ * call history tab of dashboard, and you can also manually download and check
3141
+ * against the transcript to view the knowledge base retrieval results.
3142
+ */
3143
+ knowledge_base_retrieved_contents_url?: string;
3144
+
3145
+ /**
3146
+ * Latency tracking of the call, available after call ends. Not all fields here
3147
+ * will be available, as it depends on the type of call and feature used.
3148
+ */
3149
+ latency?: V3PhoneCallResponse.Latency;
3150
+
3151
+ /**
3152
+ * LLM token usage of the call, available after call ends. Not populated if using
3153
+ * custom LLM, realtime API, or no LLM call is made.
3154
+ */
3155
+ llm_token_usage?: V3PhoneCallResponse.LlmTokenUsage;
3156
+
3157
+ /**
3158
+ * An arbitrary object for storage purpose only. You can put anything here like
3159
+ * your internal customer id associated with the call. Not used for processing. You
3160
+ * can later get this field from the call object.
3161
+ */
3162
+ metadata?: unknown;
3163
+
3164
+ /**
3165
+ * Whether this agent opts in for signed URLs for public logs and recordings. When
3166
+ * enabled, the generated URLs will include security signatures that restrict
3167
+ * access and automatically expire after 24 hours.
3168
+ */
3169
+ opt_in_signed_url?: boolean;
3170
+
3171
+ /**
3172
+ * Public log of the call, containing details about all the requests and responses
3173
+ * received in LLM WebSocket, latency tracking for each turntaking, helpful for
3174
+ * debugging and tracing. Available after call ends.
3175
+ */
3176
+ public_log_url?: string;
3177
+
3178
+ /**
3179
+ * Recording of the call, with each party's audio stored in a separate channel.
3180
+ * Available after the call ends.
3181
+ */
3182
+ recording_multi_channel_url?: string;
3183
+
3184
+ /**
3185
+ * Recording of the call. Available after call ends.
3186
+ */
3187
+ recording_url?: string;
3188
+
3189
+ /**
3190
+ * Add optional dynamic variables in key value pairs of string that injects into
3191
+ * your Response Engine prompt and tool description. Only applicable for Response
3192
+ * Engine.
3193
+ */
3194
+ retell_llm_dynamic_variables?: { [key: string]: unknown };
3195
+
3196
+ /**
3197
+ * Recording of the call without PII, with each party's audio stored in a separate
3198
+ * channel. Available after the call ends.
3199
+ */
3200
+ scrubbed_recording_multi_channel_url?: string;
3201
+
3202
+ /**
3203
+ * Recording of the call without PII. Available after call ends.
3204
+ */
3205
+ scrubbed_recording_url?: string;
3206
+
3207
+ /**
3208
+ * Begin timestamp (milliseconds since epoch) of the call. Available after call
3209
+ * starts.
3210
+ */
3211
+ start_timestamp?: number;
3212
+
3213
+ /**
3214
+ * Telephony identifier of the call, populated when available. Tracking purposes
3215
+ * only.
3216
+ */
3217
+ telephony_identifier?: V3PhoneCallResponse.TelephonyIdentifier;
3218
+
3219
+ /**
3220
+ * The destination number or identifier where the call was transferred to. Only
3221
+ * populated when the disconnection reason was `call_transfer`. Can be a phone
3222
+ * number or a SIP URI. SIP URIs are prefixed with "sip:" and may include a
3223
+ * ";transport=..." portion (if transport is known) where the transport type can be
3224
+ * "tls", "tcp" or "udp".
3225
+ */
3226
+ transfer_destination?: string | null;
3227
+
3228
+ /**
3229
+ * Transfer end timestamp (milliseconds since epoch) of the call. Available after
3230
+ * transfer call ends.
3231
+ */
3232
+ transfer_end_timestamp?: number;
3233
+ }
3234
+
3235
+ export namespace V3PhoneCallResponse {
3236
+ /**
3237
+ * Post call analysis that includes information such as sentiment, status, summary,
3238
+ * and custom defined data to extract. Available after call ends. Subscribe to
3239
+ * `call_analyzed` webhook event type to receive it once ready.
3240
+ */
3241
+ export interface CallAnalysis {
3242
+ /**
3243
+ * Whether the agent seems to have a successful call with the user, where the agent
3244
+ * finishes the task, and the call was complete without being cutoff.
3245
+ */
3246
+ call_successful?: boolean;
3247
+
3248
+ /**
3249
+ * A high level summary of the call.
3250
+ */
3251
+ call_summary?: string;
3252
+
3253
+ /**
3254
+ * Custom analysis data that was extracted based on the schema defined in agent
3255
+ * post call analysis data. Can be empty if nothing is specified.
3256
+ */
3257
+ custom_analysis_data?: unknown;
3258
+
3259
+ /**
3260
+ * Whether the call is entered voicemail.
3261
+ */
3262
+ in_voicemail?: boolean;
3263
+
3264
+ /**
3265
+ * Sentiment of the user in the call.
3266
+ */
3267
+ user_sentiment?: 'Negative' | 'Positive' | 'Neutral' | 'Unknown';
3268
+ }
3269
+
3270
+ /**
3271
+ * Cost of the call, including all the products and their costs and discount.
3272
+ */
3273
+ export interface CallCost {
3274
+ /**
3275
+ * Combined cost of all individual costs in cents
3276
+ */
3277
+ combined_cost: number;
3278
+
3279
+ /**
3280
+ * List of products with their unit prices and costs in cents
3281
+ */
3282
+ product_costs: Array<CallCost.ProductCost>;
3283
+
3284
+ /**
3285
+ * Total duration of the call in seconds
3286
+ */
3287
+ total_duration_seconds: number;
3288
+
3289
+ /**
3290
+ * Total unit duration price of all products in cents per second
3291
+ */
3292
+ total_duration_unit_price: number;
3293
+ }
3294
+
3295
+ export namespace CallCost {
3296
+ export interface ProductCost {
3297
+ /**
3298
+ * Cost for the product in cents for the duration of the call.
3299
+ */
3300
+ cost: number;
3301
+
3302
+ /**
3303
+ * Product name that has a cost associated with it.
3304
+ */
3305
+ product: string;
3306
+
3307
+ /**
3308
+ * True if this cost item is for a transfer segment.
3309
+ */
3310
+ is_transfer_leg_cost?: boolean;
3311
+
3312
+ /**
3313
+ * Unit price of the product in cents per second.
3314
+ */
3315
+ unit_price?: number;
3316
+ }
3317
+ }
3318
+
3319
+ /**
3320
+ * Latency tracking of the call, available after call ends. Not all fields here
3321
+ * will be available, as it depends on the type of call and feature used.
3322
+ */
3323
+ export interface Latency {
3324
+ /**
3325
+ * Transcription latency (diff between the duration of the chunks streamed and the
3326
+ * durations of the transcribed part) tracking of the call.
3327
+ */
3328
+ asr?: Latency.Asr;
3329
+
3330
+ /**
3331
+ * End to end latency (from user stops talking to agent start talking) tracking of
3332
+ * the call. This latency does not account for the network trip time from Retell
3333
+ * server to user frontend. The latency is tracked every time turn change between
3334
+ * user and agent.
3335
+ */
3336
+ e2e?: Latency.E2E;
3337
+
3338
+ /**
3339
+ * Knowledge base latency (from the triggering of knowledge base retrival to all
3340
+ * relevant context received) tracking of the call. Only populated when using
3341
+ * knowledge base feature for the agent of the call.
3342
+ */
3343
+ knowledge_base?: Latency.KnowledgeBase;
3344
+
3345
+ /**
3346
+ * LLM latency (from issue of LLM call to first speakable chunk received) tracking
3347
+ * of the call. When using custom LLM. this latency includes LLM websocket
3348
+ * roundtrip time between user server and Retell server.
3349
+ */
3350
+ llm?: Latency.Llm;
3351
+
3352
+ /**
3353
+ * LLM websocket roundtrip latency (between user server and Retell server) tracking
3354
+ * of the call. Only populated for calls using custom LLM.
3355
+ */
3356
+ llm_websocket_network_rtt?: Latency.LlmWebsocketNetworkRtt;
3357
+
3358
+ /**
3359
+ * Speech-to-speech latency (from requesting responses of a S2S model to first byte
3360
+ * received) tracking of the call. Only populated for calls that uses S2S model
3361
+ * like Realtime API.
3362
+ */
3363
+ s2s?: Latency.S2s;
3364
+
3365
+ /**
3366
+ * Text-to-speech latency (from the triggering of TTS to first byte received)
3367
+ * tracking of the call.
3368
+ */
3369
+ tts?: Latency.Tts;
3370
+ }
3371
+
3372
+ export namespace Latency {
3373
+ /**
3374
+ * Transcription latency (diff between the duration of the chunks streamed and the
3375
+ * durations of the transcribed part) tracking of the call.
3376
+ */
3377
+ export interface Asr {
3378
+ /**
3379
+ * Maximum latency in the call, measured in milliseconds.
3380
+ */
3381
+ max?: number;
3382
+
3383
+ /**
3384
+ * Minimum latency in the call, measured in milliseconds.
3385
+ */
3386
+ min?: number;
3387
+
3388
+ /**
3389
+ * Number of data points (number of times latency is tracked).
3390
+ */
3391
+ num?: number;
3392
+
3393
+ /**
3394
+ * 50 percentile of latency, measured in milliseconds.
3395
+ */
3396
+ p50?: number;
3397
+
3398
+ /**
3399
+ * 90 percentile of latency, measured in milliseconds.
3400
+ */
3401
+ p90?: number;
3402
+
3403
+ /**
3404
+ * 95 percentile of latency, measured in milliseconds.
3405
+ */
3406
+ p95?: number;
3407
+
3408
+ /**
3409
+ * 99 percentile of latency, measured in milliseconds.
3410
+ */
3411
+ p99?: number;
3412
+
3413
+ /**
3414
+ * All the latency data points in the call, measured in milliseconds.
3415
+ */
3416
+ values?: Array<number>;
3417
+ }
3418
+
3419
+ /**
3420
+ * End to end latency (from user stops talking to agent start talking) tracking of
3421
+ * the call. This latency does not account for the network trip time from Retell
3422
+ * server to user frontend. The latency is tracked every time turn change between
3423
+ * user and agent.
3424
+ */
3425
+ export interface E2E {
3426
+ /**
3427
+ * Maximum latency in the call, measured in milliseconds.
3428
+ */
3429
+ max?: number;
3430
+
3431
+ /**
3432
+ * Minimum latency in the call, measured in milliseconds.
3433
+ */
3434
+ min?: number;
3435
+
3436
+ /**
3437
+ * Number of data points (number of times latency is tracked).
3438
+ */
3439
+ num?: number;
3440
+
3441
+ /**
3442
+ * 50 percentile of latency, measured in milliseconds.
3443
+ */
3444
+ p50?: number;
3445
+
3446
+ /**
3447
+ * 90 percentile of latency, measured in milliseconds.
3448
+ */
3449
+ p90?: number;
3450
+
3451
+ /**
3452
+ * 95 percentile of latency, measured in milliseconds.
3453
+ */
3454
+ p95?: number;
3455
+
3456
+ /**
3457
+ * 99 percentile of latency, measured in milliseconds.
3458
+ */
3459
+ p99?: number;
3460
+
3461
+ /**
3462
+ * All the latency data points in the call, measured in milliseconds.
3463
+ */
3464
+ values?: Array<number>;
3465
+ }
3466
+
3467
+ /**
3468
+ * Knowledge base latency (from the triggering of knowledge base retrival to all
3469
+ * relevant context received) tracking of the call. Only populated when using
3470
+ * knowledge base feature for the agent of the call.
3471
+ */
3472
+ export interface KnowledgeBase {
3473
+ /**
3474
+ * Maximum latency in the call, measured in milliseconds.
3475
+ */
3476
+ max?: number;
3477
+
3478
+ /**
3479
+ * Minimum latency in the call, measured in milliseconds.
3480
+ */
3481
+ min?: number;
3482
+
3483
+ /**
3484
+ * Number of data points (number of times latency is tracked).
3485
+ */
3486
+ num?: number;
3487
+
3488
+ /**
3489
+ * 50 percentile of latency, measured in milliseconds.
3490
+ */
3491
+ p50?: number;
3492
+
3493
+ /**
3494
+ * 90 percentile of latency, measured in milliseconds.
3495
+ */
3496
+ p90?: number;
3497
+
3498
+ /**
3499
+ * 95 percentile of latency, measured in milliseconds.
3500
+ */
3501
+ p95?: number;
3502
+
3503
+ /**
3504
+ * 99 percentile of latency, measured in milliseconds.
3505
+ */
3506
+ p99?: number;
3507
+
3508
+ /**
3509
+ * All the latency data points in the call, measured in milliseconds.
3510
+ */
3511
+ values?: Array<number>;
3512
+ }
3513
+
3514
+ /**
3515
+ * LLM latency (from issue of LLM call to first speakable chunk received) tracking
3516
+ * of the call. When using custom LLM. this latency includes LLM websocket
3517
+ * roundtrip time between user server and Retell server.
3518
+ */
3519
+ export interface Llm {
3520
+ /**
3521
+ * Maximum latency in the call, measured in milliseconds.
3522
+ */
3523
+ max?: number;
3524
+
3525
+ /**
3526
+ * Minimum latency in the call, measured in milliseconds.
3527
+ */
3528
+ min?: number;
3529
+
3530
+ /**
3531
+ * Number of data points (number of times latency is tracked).
3532
+ */
3533
+ num?: number;
3534
+
3535
+ /**
3536
+ * 50 percentile of latency, measured in milliseconds.
3537
+ */
3538
+ p50?: number;
3539
+
3540
+ /**
3541
+ * 90 percentile of latency, measured in milliseconds.
3542
+ */
3543
+ p90?: number;
3544
+
3545
+ /**
3546
+ * 95 percentile of latency, measured in milliseconds.
3547
+ */
3548
+ p95?: number;
3549
+
3550
+ /**
3551
+ * 99 percentile of latency, measured in milliseconds.
3552
+ */
3553
+ p99?: number;
3554
+
3555
+ /**
3556
+ * All the latency data points in the call, measured in milliseconds.
3557
+ */
3558
+ values?: Array<number>;
3559
+ }
3560
+
3561
+ /**
3562
+ * LLM websocket roundtrip latency (between user server and Retell server) tracking
3563
+ * of the call. Only populated for calls using custom LLM.
3564
+ */
3565
+ export interface LlmWebsocketNetworkRtt {
3566
+ /**
3567
+ * Maximum latency in the call, measured in milliseconds.
3568
+ */
3569
+ max?: number;
3570
+
3571
+ /**
3572
+ * Minimum latency in the call, measured in milliseconds.
3573
+ */
3574
+ min?: number;
3575
+
3576
+ /**
3577
+ * Number of data points (number of times latency is tracked).
3578
+ */
3579
+ num?: number;
3580
+
3581
+ /**
3582
+ * 50 percentile of latency, measured in milliseconds.
3583
+ */
3584
+ p50?: number;
3585
+
3586
+ /**
3587
+ * 90 percentile of latency, measured in milliseconds.
3588
+ */
3589
+ p90?: number;
3590
+
3591
+ /**
3592
+ * 95 percentile of latency, measured in milliseconds.
3593
+ */
3594
+ p95?: number;
3595
+
3596
+ /**
3597
+ * 99 percentile of latency, measured in milliseconds.
3598
+ */
3599
+ p99?: number;
3600
+
3601
+ /**
3602
+ * All the latency data points in the call, measured in milliseconds.
3603
+ */
3604
+ values?: Array<number>;
3605
+ }
3606
+
3607
+ /**
3608
+ * Speech-to-speech latency (from requesting responses of a S2S model to first byte
3609
+ * received) tracking of the call. Only populated for calls that uses S2S model
3610
+ * like Realtime API.
3611
+ */
3612
+ export interface S2s {
3613
+ /**
3614
+ * Maximum latency in the call, measured in milliseconds.
3615
+ */
3616
+ max?: number;
3617
+
3618
+ /**
3619
+ * Minimum latency in the call, measured in milliseconds.
3620
+ */
3621
+ min?: number;
3622
+
3623
+ /**
3624
+ * Number of data points (number of times latency is tracked).
3625
+ */
3626
+ num?: number;
3627
+
3628
+ /**
3629
+ * 50 percentile of latency, measured in milliseconds.
3630
+ */
3631
+ p50?: number;
3632
+
3633
+ /**
3634
+ * 90 percentile of latency, measured in milliseconds.
3635
+ */
3636
+ p90?: number;
3637
+
3638
+ /**
3639
+ * 95 percentile of latency, measured in milliseconds.
3640
+ */
3641
+ p95?: number;
3642
+
3643
+ /**
3644
+ * 99 percentile of latency, measured in milliseconds.
3645
+ */
3646
+ p99?: number;
3647
+
3648
+ /**
3649
+ * All the latency data points in the call, measured in milliseconds.
3650
+ */
3651
+ values?: Array<number>;
3652
+ }
3653
+
3654
+ /**
3655
+ * Text-to-speech latency (from the triggering of TTS to first byte received)
3656
+ * tracking of the call.
3657
+ */
3658
+ export interface Tts {
3659
+ /**
3660
+ * Maximum latency in the call, measured in milliseconds.
3661
+ */
3662
+ max?: number;
3663
+
3664
+ /**
3665
+ * Minimum latency in the call, measured in milliseconds.
3666
+ */
3667
+ min?: number;
3668
+
3669
+ /**
3670
+ * Number of data points (number of times latency is tracked).
3671
+ */
3672
+ num?: number;
3673
+
3674
+ /**
3675
+ * 50 percentile of latency, measured in milliseconds.
3676
+ */
3677
+ p50?: number;
3678
+
3679
+ /**
3680
+ * 90 percentile of latency, measured in milliseconds.
3681
+ */
3682
+ p90?: number;
3683
+
3684
+ /**
3685
+ * 95 percentile of latency, measured in milliseconds.
3686
+ */
3687
+ p95?: number;
3688
+
3689
+ /**
3690
+ * 99 percentile of latency, measured in milliseconds.
3691
+ */
3692
+ p99?: number;
3693
+
3694
+ /**
3695
+ * All the latency data points in the call, measured in milliseconds.
3696
+ */
3697
+ values?: Array<number>;
3698
+ }
3699
+ }
3700
+
3701
+ /**
3702
+ * LLM token usage of the call, available after call ends. Not populated if using
3703
+ * custom LLM, realtime API, or no LLM call is made.
3704
+ */
3705
+ export interface LlmTokenUsage {
3706
+ /**
3707
+ * Average token count of the call.
3708
+ */
3709
+ average: number;
3710
+
3711
+ /**
3712
+ * Number of requests made to the LLM.
3713
+ */
3714
+ num_requests: number;
3715
+
3716
+ /**
3717
+ * All the token count values in the call.
3718
+ */
3719
+ values: Array<number>;
3720
+ }
3721
+
3722
+ /**
3723
+ * Telephony identifier of the call, populated when available. Tracking purposes
3724
+ * only.
3725
+ */
3726
+ export interface TelephonyIdentifier {
3727
+ /**
3728
+ * Twilio call sid.
3729
+ */
3730
+ twilio_call_sid?: string;
3731
+ }
3732
+ }
3733
+ }
3734
+
3735
+ export interface CallUpdateParams {
3736
+ /**
3737
+ * Custom attributes for the call
3738
+ */
3739
+ custom_attributes?: { [key: string]: string | number | boolean };
3740
+
3741
+ /**
3742
+ * Data storage setting for this call. Overrides the agent's default setting.
3743
+ * "everything" stores all data, "everything_except_pii" excludes PII when
3744
+ * possible, "basic_attributes_only" stores only metadata. Cannot be downgraded
3745
+ * from more restrictive to less restrictive settings.
3746
+ */
3747
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only';
3748
+
3749
+ /**
3750
+ * An arbitrary object for storage purpose only. You can put anything here like
3751
+ * your internal customer id associated with the call. Not used for processing. You
3752
+ * can later get this field from the call object. Size limited to 50kB max.
3753
+ */
3754
+ metadata?: unknown;
3755
+
3756
+ /**
3757
+ * Override dynamic varaibles represented as key-value pairs of strings. Setting
3758
+ * this will override or add the dynamic variables set in the agent during the
3759
+ * call. Only need to set the delta where you want to override, no need to set the
3760
+ * entire dynamic variables object. Setting this to null will remove any existing
3761
+ * override.
3762
+ */
3763
+ override_dynamic_variables?: { [key: string]: string } | null;
3764
+ }
3765
+
3766
+ export interface CallListParams {
3767
+ /**
3768
+ * Filter criteria for calls. All conditions are implicitly connected with AND.
3769
+ */
3770
+ filter_criteria?: CallListParams.FilterCriteria;
3771
+
3772
+ /**
3773
+ * Maximum number of calls to return.
3774
+ */
3775
+ limit?: number;
3776
+
3777
+ /**
3778
+ * Opaque pagination cursor from a previous response.
3779
+ */
3780
+ pagination_key?: string;
3781
+
3782
+ /**
3783
+ * Number of records to skip for pagination.
3784
+ */
3785
+ skip?: number;
3786
+
3787
+ /**
3788
+ * Sort calls by `start_timestamp` in ascending or descending order.
3789
+ */
3790
+ sort_order?: 'ascending' | 'descending';
3791
+ }
3792
+
3793
+ export namespace CallListParams {
3794
+ /**
3795
+ * Filter criteria for calls. All conditions are implicitly connected with AND.
3796
+ */
3797
+ export interface FilterCriteria {
3798
+ /**
3799
+ * Filter by agent(s). Agent filters are connected by OR.
3800
+ */
3801
+ agent?: Array<FilterCriteria.Agent>;
3802
+
3803
+ /**
3804
+ * Filter by batch call ID.
3805
+ */
3806
+ batch_call_id?: FilterCriteria.BatchCallID;
3807
+
3808
+ /**
3809
+ * Filter by call ID.
3810
+ */
3811
+ call_id?: FilterCriteria.CallID;
3812
+
3813
+ call_status?: FilterCriteria.CallStatus;
3814
+
3815
+ /**
3816
+ * Filter by whether the call was successful.
3817
+ */
3818
+ call_successful?: FilterCriteria.CallSuccessful;
3819
+
3820
+ call_type?: FilterCriteria.CallType;
3821
+
3822
+ /**
3823
+ * Filter by combined cost of the call.
3824
+ */
3825
+ combined_cost?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
3826
+
3827
+ /**
3828
+ * Filter by custom analysis data fields.
3829
+ */
3830
+ custom_analysis_data?: Array<
3831
+ | FilterCriteria.StringFilter
3832
+ | FilterCriteria.NumberFilter
3833
+ | FilterCriteria.BooleanFilter
3834
+ | FilterCriteria.RangeFilter
3835
+ | FilterCriteria.EnumFilter
3836
+ | FilterCriteria.PresentFilter
3837
+ >;
3838
+
3839
+ /**
3840
+ * Filter by custom attributes fields.
3841
+ */
3842
+ custom_attributes?: Array<
3843
+ | FilterCriteria.StringFilter
3844
+ | FilterCriteria.NumberFilter
3845
+ | FilterCriteria.BooleanFilter
3846
+ | FilterCriteria.RangeFilter
3847
+ | FilterCriteria.EnumFilter
3848
+ | FilterCriteria.PresentFilter
3849
+ >;
3850
+
3851
+ data_storage_setting?: FilterCriteria.DataStorageSetting;
3852
+
3853
+ direction?: FilterCriteria.Direction;
3854
+
3855
+ disconnection_reason?: FilterCriteria.DisconnectionReason;
3856
+
3857
+ /**
3858
+ * Filter by call duration in milliseconds.
3859
+ */
3860
+ duration_ms?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
3861
+
3862
+ /**
3863
+ * Filter by dynamic variables.
3864
+ */
3865
+ dynamic_variables?: Array<FilterCriteria.DynamicVariable>;
3866
+
3867
+ /**
3868
+ * Filter by end-to-end latency p50.
3869
+ */
3870
+ e2e_latency_p50?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
3871
+
3872
+ /**
3873
+ * Filter by call end timestamp (epoch ms).
3874
+ */
3875
+ end_timestamp?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
3876
+
3877
+ /**
3878
+ * Filter by from number.
3879
+ */
3880
+ from_number?: FilterCriteria.FromNumber;
3881
+
3882
+ /**
3883
+ * Filter by whether the call is in voicemail.
3884
+ */
3885
+ in_voicemail?: FilterCriteria.InVoicemail;
3886
+
3887
+ /**
3888
+ * Filter by metadata fields.
3889
+ */
3890
+ metadata?: Array<
3891
+ | FilterCriteria.StringFilter
3892
+ | FilterCriteria.NumberFilter
3893
+ | FilterCriteria.BooleanFilter
3894
+ | FilterCriteria.RangeFilter
3895
+ | FilterCriteria.EnumFilter
3896
+ | FilterCriteria.PresentFilter
3897
+ >;
3898
+
3899
+ /**
3900
+ * Filter by call start timestamp (epoch ms).
3901
+ */
3902
+ start_timestamp?: FilterCriteria.NumberFilter | FilterCriteria.RangeFilter;
3903
+
3904
+ /**
3905
+ * Filter by to number.
3906
+ */
3907
+ to_number?: FilterCriteria.ToNumber;
3908
+
3909
+ /**
3910
+ * Filter by tool call criteria. Tool call filters are connected by AND.
3911
+ */
3912
+ tool_calls?: Array<FilterCriteria.ToolCall>;
3913
+
3914
+ user_sentiment?: FilterCriteria.UserSentiment;
3915
+ }
3916
+
3917
+ export namespace FilterCriteria {
3918
+ export interface Agent {
3919
+ /**
3920
+ * The agent ID to filter on.
3921
+ */
3922
+ agent_id: string;
3923
+
3924
+ /**
3925
+ * Specific versions to filter on. If not provided, all versions are included.
3926
+ */
3927
+ version?: Array<number>;
3928
+ }
3929
+
3930
+ /**
3931
+ * Filter by batch call ID.
3932
+ */
3933
+ export interface BatchCallID {
3934
+ /**
3935
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
3936
+ */
3937
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
3938
+
3939
+ type: 'string';
3940
+
3941
+ value: string;
3942
+ }
3943
+
3944
+ /**
3945
+ * Filter by call ID.
3946
+ */
3947
+ export interface CallID {
3948
+ /**
3949
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
3950
+ */
3951
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
3952
+
3953
+ type: 'string';
3954
+
3955
+ value: string;
3956
+ }
3957
+
3958
+ export interface CallStatus {
3959
+ /**
3960
+ * in: value is one of the listed values
3961
+ */
3962
+ op: 'in';
3963
+
3964
+ type: 'enum';
3965
+
3966
+ value: Array<'not_connected' | 'ongoing' | 'ended' | 'error'>;
3967
+ }
3968
+
3969
+ /**
3970
+ * Filter by whether the call was successful.
3971
+ */
3972
+ export interface CallSuccessful {
3973
+ op: 'eq';
3974
+
3975
+ type: 'boolean';
3976
+
3977
+ value: boolean;
3978
+ }
3979
+
3980
+ export interface CallType {
3981
+ /**
3982
+ * in: value is one of the listed values
3983
+ */
3984
+ op: 'in';
3985
+
3986
+ type: 'enum';
3987
+
3988
+ value: Array<'web_call' | 'phone_call'>;
3989
+ }
3990
+
3991
+ export interface NumberFilter {
3992
+ /**
3993
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
3994
+ * than, le: less than or equal
3995
+ */
3996
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
3997
+
3998
+ type: 'number';
3999
+
4000
+ value: number;
4001
+ }
4002
+
4003
+ export interface RangeFilter {
4004
+ /**
4005
+ * bt: between
4006
+ */
4007
+ op: 'bt';
4008
+
4009
+ type: 'range';
4010
+
4011
+ /**
4012
+ * [lower_bound, upper_bound]
4013
+ */
4014
+ value: Array<number>;
4015
+ }
4016
+
4017
+ export interface StringFilter {
4018
+ /**
4019
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4020
+ */
4021
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4022
+
4023
+ type: 'string';
4024
+
4025
+ value: string;
4026
+
4027
+ /**
4028
+ * The field name to filter on.
4029
+ */
4030
+ key?: string;
4031
+ }
4032
+
4033
+ export interface NumberFilter {
4034
+ /**
4035
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4036
+ * than, le: less than or equal
4037
+ */
4038
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4039
+
4040
+ type: 'number';
4041
+
4042
+ value: number;
4043
+
4044
+ /**
4045
+ * The field name to filter on.
4046
+ */
4047
+ key?: string;
4048
+ }
4049
+
4050
+ export interface BooleanFilter {
4051
+ op: 'eq';
4052
+
4053
+ type: 'boolean';
4054
+
4055
+ value: boolean;
4056
+
4057
+ /**
4058
+ * The field name to filter on.
4059
+ */
4060
+ key?: string;
4061
+ }
4062
+
4063
+ export interface RangeFilter {
4064
+ /**
4065
+ * bt: between
4066
+ */
4067
+ op: 'bt';
4068
+
4069
+ type: 'range';
4070
+
4071
+ /**
4072
+ * [lower_bound, upper_bound]
4073
+ */
4074
+ value: Array<number>;
4075
+
4076
+ /**
4077
+ * The field name to filter on.
4078
+ */
4079
+ key?: string;
4080
+ }
4081
+
4082
+ export interface EnumFilter {
4083
+ /**
4084
+ * in: value is one of the listed values
4085
+ */
4086
+ op: 'in';
4087
+
4088
+ type: 'enum';
4089
+
4090
+ value: Array<string>;
4091
+
4092
+ /**
4093
+ * The field name to filter on.
4094
+ */
4095
+ key?: string;
4096
+ }
4097
+
4098
+ export interface PresentFilter {
4099
+ /**
4100
+ * pr: present (has value), np: not present
4101
+ */
4102
+ op: 'pr' | 'np';
4103
+
4104
+ type: 'present';
4105
+
4106
+ /**
4107
+ * The field name to filter on.
4108
+ */
4109
+ key?: string;
4110
+ }
4111
+
4112
+ export interface StringFilter {
4113
+ /**
4114
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4115
+ */
4116
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4117
+
4118
+ type: 'string';
4119
+
4120
+ value: string;
4121
+
4122
+ /**
4123
+ * The field name to filter on.
4124
+ */
4125
+ key?: string;
4126
+ }
4127
+
4128
+ export interface NumberFilter {
4129
+ /**
4130
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4131
+ * than, le: less than or equal
4132
+ */
4133
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4134
+
4135
+ type: 'number';
4136
+
4137
+ value: number;
4138
+
4139
+ /**
4140
+ * The field name to filter on.
4141
+ */
4142
+ key?: string;
4143
+ }
4144
+
4145
+ export interface BooleanFilter {
4146
+ op: 'eq';
4147
+
4148
+ type: 'boolean';
4149
+
4150
+ value: boolean;
4151
+
4152
+ /**
4153
+ * The field name to filter on.
4154
+ */
4155
+ key?: string;
4156
+ }
4157
+
4158
+ export interface RangeFilter {
4159
+ /**
4160
+ * bt: between
4161
+ */
4162
+ op: 'bt';
4163
+
4164
+ type: 'range';
4165
+
4166
+ /**
4167
+ * [lower_bound, upper_bound]
4168
+ */
4169
+ value: Array<number>;
4170
+
4171
+ /**
4172
+ * The field name to filter on.
4173
+ */
4174
+ key?: string;
4175
+ }
4176
+
4177
+ export interface EnumFilter {
4178
+ /**
4179
+ * in: value is one of the listed values
4180
+ */
4181
+ op: 'in';
4182
+
4183
+ type: 'enum';
4184
+
4185
+ value: Array<string>;
4186
+
4187
+ /**
4188
+ * The field name to filter on.
4189
+ */
4190
+ key?: string;
4191
+ }
4192
+
4193
+ export interface PresentFilter {
4194
+ /**
4195
+ * pr: present (has value), np: not present
4196
+ */
4197
+ op: 'pr' | 'np';
4198
+
4199
+ type: 'present';
4200
+
4201
+ /**
4202
+ * The field name to filter on.
4203
+ */
4204
+ key?: string;
4205
+ }
4206
+
4207
+ export interface DataStorageSetting {
4208
+ /**
4209
+ * in: value is one of the listed values
4210
+ */
4211
+ op: 'in';
4212
+
4213
+ type: 'enum';
4214
+
4215
+ value: Array<'everything' | 'everything_except_pii' | 'basic_attributes_only'>;
4216
+ }
4217
+
4218
+ export interface Direction {
4219
+ /**
4220
+ * in: value is one of the listed values
4221
+ */
4222
+ op: 'in';
4223
+
4224
+ type: 'enum';
4225
+
4226
+ value: Array<'inbound' | 'outbound'>;
4227
+ }
4228
+
4229
+ export interface DisconnectionReason {
4230
+ /**
4231
+ * in: value is one of the listed values
4232
+ */
4233
+ op: 'in';
4234
+
4235
+ type: 'enum';
4236
+
4237
+ value: Array<
4238
+ | 'user_hangup'
4239
+ | 'agent_hangup'
4240
+ | 'call_transfer'
4241
+ | 'voicemail_reached'
4242
+ | 'ivr_reached'
4243
+ | 'inactivity'
4244
+ | 'max_duration_reached'
4245
+ | 'concurrency_limit_reached'
4246
+ | 'no_valid_payment'
4247
+ | 'scam_detected'
4248
+ | 'dial_busy'
4249
+ | 'dial_failed'
4250
+ | 'dial_no_answer'
4251
+ | 'invalid_destination'
4252
+ | 'telephony_provider_permission_denied'
4253
+ | 'telephony_provider_unavailable'
4254
+ | 'sip_routing_error'
4255
+ | 'marked_as_spam'
4256
+ | 'user_declined'
4257
+ | 'error_llm_websocket_open'
4258
+ | 'error_llm_websocket_lost_connection'
4259
+ | 'error_llm_websocket_runtime'
4260
+ | 'error_llm_websocket_corrupt_payload'
4261
+ | 'error_no_audio_received'
4262
+ | 'error_asr'
4263
+ | 'error_retell'
4264
+ | 'error_unknown'
4265
+ | 'error_user_not_joined'
4266
+ | 'registered_call_timeout'
4267
+ | 'transfer_bridged'
4268
+ | 'transfer_cancelled'
4269
+ | 'manual_stopped'
4270
+ >;
4271
+ }
4272
+
4273
+ export interface NumberFilter {
4274
+ /**
4275
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4276
+ * than, le: less than or equal
4277
+ */
4278
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4279
+
4280
+ type: 'number';
4281
+
4282
+ value: number;
4283
+ }
4284
+
4285
+ export interface RangeFilter {
4286
+ /**
4287
+ * bt: between
4288
+ */
4289
+ op: 'bt';
4290
+
4291
+ type: 'range';
4292
+
4293
+ /**
4294
+ * [lower_bound, upper_bound]
4295
+ */
4296
+ value: Array<number>;
4297
+ }
4298
+
4299
+ export interface DynamicVariable {
4300
+ /**
4301
+ * The dynamic variable name to filter on.
4302
+ */
4303
+ key: string;
4304
+
4305
+ /**
4306
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4307
+ */
4308
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4309
+
4310
+ type: 'string';
4311
+
4312
+ value: string;
4313
+ }
4314
+
4315
+ export interface NumberFilter {
4316
+ /**
4317
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4318
+ * than, le: less than or equal
4319
+ */
4320
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4321
+
4322
+ type: 'number';
4323
+
4324
+ value: number;
4325
+ }
4326
+
4327
+ export interface RangeFilter {
4328
+ /**
4329
+ * bt: between
4330
+ */
4331
+ op: 'bt';
4332
+
4333
+ type: 'range';
4334
+
4335
+ /**
4336
+ * [lower_bound, upper_bound]
4337
+ */
4338
+ value: Array<number>;
4339
+ }
4340
+
4341
+ export interface NumberFilter {
4342
+ /**
4343
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4344
+ * than, le: less than or equal
4345
+ */
4346
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4347
+
4348
+ type: 'number';
4349
+
4350
+ value: number;
4351
+ }
4352
+
4353
+ export interface RangeFilter {
4354
+ /**
4355
+ * bt: between
4356
+ */
4357
+ op: 'bt';
4358
+
4359
+ type: 'range';
4360
+
4361
+ /**
4362
+ * [lower_bound, upper_bound]
4363
+ */
4364
+ value: Array<number>;
4365
+ }
4366
+
4367
+ /**
4368
+ * Filter by from number.
4369
+ */
4370
+ export interface FromNumber {
4371
+ /**
4372
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4373
+ */
4374
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4375
+
4376
+ type: 'string';
4377
+
4378
+ value: string;
4379
+ }
4380
+
4381
+ /**
4382
+ * Filter by whether the call is in voicemail.
4383
+ */
4384
+ export interface InVoicemail {
4385
+ op: 'eq';
4386
+
4387
+ type: 'boolean';
4388
+
4389
+ value: boolean;
4390
+ }
4391
+
4392
+ export interface StringFilter {
4393
+ /**
4394
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4395
+ */
4396
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4397
+
4398
+ type: 'string';
4399
+
4400
+ value: string;
4401
+
4402
+ /**
4403
+ * The field name to filter on.
4404
+ */
4405
+ key?: string;
4406
+ }
4407
+
4408
+ export interface NumberFilter {
4409
+ /**
4410
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4411
+ * than, le: less than or equal
4412
+ */
4413
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4414
+
4415
+ type: 'number';
4416
+
4417
+ value: number;
4418
+
4419
+ /**
4420
+ * The field name to filter on.
4421
+ */
4422
+ key?: string;
4423
+ }
4424
+
4425
+ export interface BooleanFilter {
4426
+ op: 'eq';
4427
+
4428
+ type: 'boolean';
4429
+
4430
+ value: boolean;
4431
+
4432
+ /**
4433
+ * The field name to filter on.
4434
+ */
4435
+ key?: string;
4436
+ }
4437
+
4438
+ export interface RangeFilter {
4439
+ /**
4440
+ * bt: between
4441
+ */
4442
+ op: 'bt';
4443
+
4444
+ type: 'range';
4445
+
4446
+ /**
4447
+ * [lower_bound, upper_bound]
4448
+ */
4449
+ value: Array<number>;
4450
+
4451
+ /**
4452
+ * The field name to filter on.
4453
+ */
4454
+ key?: string;
4455
+ }
4456
+
4457
+ export interface EnumFilter {
4458
+ /**
4459
+ * in: value is one of the listed values
4460
+ */
4461
+ op: 'in';
4462
+
4463
+ type: 'enum';
4464
+
4465
+ value: Array<string>;
4466
+
4467
+ /**
4468
+ * The field name to filter on.
4469
+ */
4470
+ key?: string;
4471
+ }
4472
+
4473
+ export interface PresentFilter {
4474
+ /**
4475
+ * pr: present (has value), np: not present
4476
+ */
4477
+ op: 'pr' | 'np';
4478
+
4479
+ type: 'present';
4480
+
4481
+ /**
4482
+ * The field name to filter on.
4483
+ */
4484
+ key?: string;
4485
+ }
4486
+
4487
+ export interface NumberFilter {
4488
+ /**
4489
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4490
+ * than, le: less than or equal
4491
+ */
4492
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4493
+
4494
+ type: 'number';
4495
+
4496
+ value: number;
4497
+ }
4498
+
4499
+ export interface RangeFilter {
4500
+ /**
4501
+ * bt: between
4502
+ */
4503
+ op: 'bt';
4504
+
4505
+ type: 'range';
4506
+
4507
+ /**
4508
+ * [lower_bound, upper_bound]
4509
+ */
4510
+ value: Array<number>;
4511
+ }
4512
+
4513
+ /**
4514
+ * Filter by to number.
4515
+ */
4516
+ export interface ToNumber {
4517
+ /**
4518
+ * eq: equal, ne: not equal, sw: starts with, ew: ends with, co: contains
4519
+ */
4520
+ op: 'eq' | 'ne' | 'sw' | 'ew' | 'co';
4521
+
4522
+ type: 'string';
4523
+
4524
+ value: string;
4525
+ }
4526
+
4527
+ export interface ToolCall {
4528
+ /**
4529
+ * The tool call name to filter on.
4530
+ */
4531
+ name: string;
4532
+
4533
+ /**
4534
+ * Filter by tool call latency in milliseconds.
4535
+ */
4536
+ latency_ms?: ToolCall.NumberFilter | ToolCall.RangeFilter;
4537
+
4538
+ /**
4539
+ * Filter by tool call success status.
4540
+ */
4541
+ success?: ToolCall.Success;
4542
+ }
4543
+
4544
+ export namespace ToolCall {
4545
+ export interface NumberFilter {
4546
+ /**
4547
+ * eq: equal, ne: not equal, gt: greater than, ge: greater than or equal, lt: less
4548
+ * than, le: less than or equal
4549
+ */
4550
+ op: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
4551
+
4552
+ type: 'number';
4553
+
4554
+ value: number;
4555
+ }
4556
+
4557
+ export interface RangeFilter {
4558
+ /**
4559
+ * bt: between
4560
+ */
4561
+ op: 'bt';
4562
+
4563
+ type: 'range';
4564
+
4565
+ /**
4566
+ * [lower_bound, upper_bound]
4567
+ */
4568
+ value: Array<number>;
4569
+ }
4570
+
4571
+ /**
4572
+ * Filter by tool call success status.
4573
+ */
4574
+ export interface Success {
4575
+ op: 'eq';
4576
+
4577
+ type: 'boolean';
4578
+
4579
+ value: boolean;
4580
+ }
4581
+ }
4582
+
4583
+ export interface UserSentiment {
4584
+ /**
4585
+ * in: value is one of the listed values
4586
+ */
4587
+ op: 'in';
4588
+
4589
+ type: 'enum';
2507
4590
 
2508
- upper_threshold?: number;
4591
+ value: Array<'Negative' | 'Positive' | 'Neutral' | 'Unknown'>;
2509
4592
  }
2510
4593
  }
2511
4594
  }
@@ -3124,12 +5207,14 @@ export namespace CallCreatePhoneCallParams {
3124
5207
  | 'eleven_v3'
3125
5208
  | 'sonic-3'
3126
5209
  | 'sonic-3-latest'
5210
+ | 'sonic-3.5'
3127
5211
  | 'tts-1'
3128
5212
  | 'gpt-4o-mini-tts'
3129
5213
  | 'speech-02-turbo'
3130
5214
  | 'speech-2.8-turbo'
3131
5215
  | 's1'
3132
5216
  | 's2-pro'
5217
+ | 's2.1-pro'
3133
5218
  | null;
3134
5219
 
3135
5220
  /**
@@ -3850,7 +5935,7 @@ export namespace CallCreatePhoneCallParams {
3850
5935
  * Select the underlying speech to speech model. Can only set this or model, not
3851
5936
  * both.
3852
5937
  */
3853
- s2s_model?: 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
5938
+ s2s_model?: 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
3854
5939
 
3855
5940
  /**
3856
5941
  * The speaker who starts the conversation. Required. Must be either 'user' or
@@ -4485,12 +6570,14 @@ export namespace CallCreateWebCallParams {
4485
6570
  | 'eleven_v3'
4486
6571
  | 'sonic-3'
4487
6572
  | 'sonic-3-latest'
6573
+ | 'sonic-3.5'
4488
6574
  | 'tts-1'
4489
6575
  | 'gpt-4o-mini-tts'
4490
6576
  | 'speech-02-turbo'
4491
6577
  | 'speech-2.8-turbo'
4492
6578
  | 's1'
4493
6579
  | 's2-pro'
6580
+ | 's2.1-pro'
4494
6581
  | null;
4495
6582
 
4496
6583
  /**
@@ -5211,7 +7298,7 @@ export namespace CallCreateWebCallParams {
5211
7298
  * Select the underlying speech to speech model. Can only set this or model, not
5212
7299
  * both.
5213
7300
  */
5214
- s2s_model?: 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
7301
+ s2s_model?: 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
5215
7302
 
5216
7303
  /**
5217
7304
  * The speaker who starts the conversation. Required. Must be either 'user' or
@@ -5846,12 +7933,14 @@ export namespace CallRegisterPhoneCallParams {
5846
7933
  | 'eleven_v3'
5847
7934
  | 'sonic-3'
5848
7935
  | 'sonic-3-latest'
7936
+ | 'sonic-3.5'
5849
7937
  | 'tts-1'
5850
7938
  | 'gpt-4o-mini-tts'
5851
7939
  | 'speech-02-turbo'
5852
7940
  | 'speech-2.8-turbo'
5853
7941
  | 's1'
5854
7942
  | 's2-pro'
7943
+ | 's2.1-pro'
5855
7944
  | null;
5856
7945
 
5857
7946
  /**
@@ -6572,7 +8661,7 @@ export namespace CallRegisterPhoneCallParams {
6572
8661
  * Select the underlying speech to speech model. Can only set this or model, not
6573
8662
  * both.
6574
8663
  */
6575
- s2s_model?: 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
8664
+ s2s_model?: 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null;
6576
8665
 
6577
8666
  /**
6578
8667
  * The speaker who starts the conversation. Required. Must be either 'user' or