pub struct Realtime<'c, C: Config> { /* private fields */ }realtime only.Expand description
Realtime API for creating sessions, managing calls, and handling WebRTC connections. Related guide: Realtime API
Implementations§
Source§impl<'c, C: Config> Realtime<'c, C>
impl<'c, C: Config> Realtime<'c, C>
pub fn new(client: &'c Client<C>) -> Self
Sourcepub async fn create_call(
&self,
request: RealtimeCallCreateRequest,
) -> Result<RealtimeCallCreateResponse, OpenAIError>
pub async fn create_call( &self, request: RealtimeCallCreateRequest, ) -> Result<RealtimeCallCreateResponse, OpenAIError>
Create a new Realtime API call over WebRTC and receive the SDP answer needed to complete the peer connection.
Returns the SDP answer in the response body and the call ID in the Location header.
Sourcepub async fn accept_call(
&self,
call_id: &str,
request: RealtimeCallAcceptRequest,
) -> Result<(), OpenAIError>
pub async fn accept_call( &self, call_id: &str, request: RealtimeCallAcceptRequest, ) -> Result<(), OpenAIError>
Accept an incoming SIP call and configure the realtime session that will handle the call. Accept an incoming SIP call and configure the realtime session that will handle the call.
Sourcepub async fn accept_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>(
&self,
call_id: T0,
request: T1,
) -> Result<R, OpenAIError>
pub async fn accept_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>( &self, call_id: T0, request: T1, ) -> Result<R, OpenAIError>
Accept an incoming SIP call and configure the realtime session that will handle the call.
Sourcepub async fn hangup_call(&self, call_id: &str) -> Result<(), OpenAIError>
pub async fn hangup_call(&self, call_id: &str) -> Result<(), OpenAIError>
End an active Realtime API call, whether it was initiated over SIP or WebRTC. End an active Realtime API call, whether it was initiated over SIP or WebRTC.
Sourcepub async fn hangup_call_byot<T0: Display, R: DeserializeOwned>(
&self,
call_id: T0,
) -> Result<R, OpenAIError>
pub async fn hangup_call_byot<T0: Display, R: DeserializeOwned>( &self, call_id: T0, ) -> Result<R, OpenAIError>
End an active Realtime API call, whether it was initiated over SIP or WebRTC.
Sourcepub async fn refer_call(
&self,
call_id: &str,
request: RealtimeCallReferRequest,
) -> Result<(), OpenAIError>
pub async fn refer_call( &self, call_id: &str, request: RealtimeCallReferRequest, ) -> Result<(), OpenAIError>
Transfer a SIP call to a new destination using the Realtime API. Transfer a SIP call to a new destination using the Realtime API.
Sourcepub async fn refer_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>(
&self,
call_id: T0,
request: T1,
) -> Result<R, OpenAIError>
pub async fn refer_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>( &self, call_id: T0, request: T1, ) -> Result<R, OpenAIError>
Transfer a SIP call to a new destination using the Realtime API.
Sourcepub async fn reject_call(
&self,
call_id: &str,
request: RealtimeCallRejectRequest,
) -> Result<(), OpenAIError>
pub async fn reject_call( &self, call_id: &str, request: RealtimeCallRejectRequest, ) -> Result<(), OpenAIError>
Decline an incoming SIP call handled by the Realtime API. Decline an incoming SIP call handled by the Realtime API.
Sourcepub async fn reject_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>(
&self,
call_id: T0,
request: T1,
) -> Result<R, OpenAIError>
pub async fn reject_call_byot<T0: Display, T1: Serialize, R: DeserializeOwned>( &self, call_id: T0, request: T1, ) -> Result<R, OpenAIError>
Decline an incoming SIP call handled by the Realtime API.
Sourcepub async fn create_client_secret(
&self,
request: RealtimeCreateClientSecretRequest,
) -> Result<RealtimeCreateClientSecretResponse, OpenAIError>
pub async fn create_client_secret( &self, request: RealtimeCreateClientSecretRequest, ) -> Result<RealtimeCreateClientSecretResponse, OpenAIError>
Create a Realtime client secret with an associated session configuration. Create a Realtime client secret with an associated session configuration.
Sourcepub async fn create_client_secret_byot<T0: Serialize, R: DeserializeOwned>(
&self,
request: T0,
) -> Result<R, OpenAIError>
pub async fn create_client_secret_byot<T0: Serialize, R: DeserializeOwned>( &self, request: T0, ) -> Result<R, OpenAIError>
Create a Realtime client secret with an associated session configuration.
Trait Implementations§
Source§impl<'c, C: Config> RequestOptionsBuilder for Realtime<'c, C>
Available on crate feature _api only.
impl<'c, C: Config> RequestOptionsBuilder for Realtime<'c, C>
_api only.