1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
use serde::{Deserialize, Serialize};
use crate::spec::realtime::{RealtimeSessionConfiguration, Session};
/// Request to create a Realtime call.
#[derive(Debug, Serialize, Clone)]
pub struct RealtimeCallCreateRequest {
/// WebRTC Session Description Protocol (SDP) offer generated by the caller.
pub sdp: String,
/// Optional session configuration to apply before the realtime session is created.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<RealtimeSessionConfiguration>,
}
/// Response from creating a Realtime call.
#[derive(Debug, Clone)]
pub struct RealtimeCallCreateResponse {
/// SDP answer produced by OpenAI for the peer connection.
pub sdp: String,
/// Relative URL containing the call ID for subsequent control requests.
/// Location header value.
pub location: Option<String>,
}
/// Request to accept a Realtime call.
#[derive(Debug, Serialize, Clone)]
pub struct RealtimeCallAcceptRequest {
/// Realtime session configuration to apply before the caller is bridged to the model.
pub session: RealtimeSessionConfiguration,
}
/// Request to refer a Realtime call.
#[derive(Debug, Serialize, Clone)]
pub struct RealtimeCallReferRequest {
/// URI that should appear in the SIP Refer-To header.
/// Supports values like `tel:+14155550123` or `sip:agent@example.com`.
pub target_uri: String,
}
/// Request to reject a Realtime call.
#[derive(Debug, Serialize, Clone, Default)]
pub struct RealtimeCallRejectRequest {
/// SIP response code to send back to the caller.
/// Defaults to `603` (Decline) when omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub status_code: Option<u16>,
}
/// Request to create a Realtime client secret.
#[derive(Debug, Serialize, Clone)]
pub struct RealtimeCreateClientSecretRequest {
/// Session configuration to use for the client secret.
/// Choose either a realtime session or a transcription session.
pub session: Session,
/// Configuration for the client secret expiration.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after: Option<ClientSecretExpiration>,
}
/// Client secret expiration configuration.
#[derive(Debug, Serialize, Clone)]
pub struct ClientSecretExpiration {
/// The anchor point for the client secret expiration.
/// Only `created_at` is currently supported.
#[serde(skip_serializing_if = "Option::is_none")]
pub anchor: Option<String>,
/// The number of seconds from the anchor point to the expiration.
/// Select a value between `10` and `7200` (2 hours).
/// Defaults to 600 seconds (10 minutes) if not specified.
pub seconds: u32,
}
/// Response from creating a Realtime client secret.
#[derive(Debug, Deserialize, Clone)]
pub struct RealtimeCreateClientSecretResponse {
/// The generated client secret value.
pub value: String,
/// Expiration timestamp for the client secret, in seconds since epoch.
pub expires_at: u64,
/// The session configuration for either a realtime or transcription session.
pub session: Session,
}