pub struct VapiAdapter { /* private fields */ }Expand description
An outbound-only Vapi interop adapter.
Implementations§
Source§impl VapiAdapter
impl VapiAdapter
pub fn new(config: VapiConfig) -> Result<Arc<Self>>
pub fn subscribe_vapi_events(&self) -> Receiver<VapiEventEnvelope>
pub fn subscribe_call_events( &self, connection_id: &ConnectionId, ) -> RvoipResult<Receiver<VapiEvent>>
pub async fn say( &self, connection_id: &ConnectionId, content: impl Into<String>, end_call_after_spoken: bool, interrupt_assistant: bool, ) -> Result<()>
pub async fn add_message( &self, connection_id: &ConnectionId, role: impl Into<String>, content: impl Into<String>, trigger_response: bool, ) -> Result<()>
pub async fn mute_assistant(&self, connection_id: &ConnectionId) -> Result<()>
pub async fn unmute_assistant(&self, connection_id: &ConnectionId) -> Result<()>
Source§impl VapiAdapter
impl VapiAdapter
Sourcepub async fn attach_agent(
self: &Arc<Self>,
orchestrator: &Arc<Orchestrator>,
caller_connection_id: ConnectionId,
options: VapiCallOptions,
) -> RvoipResult<VapiAgentCall>
pub async fn attach_agent( self: &Arc<Self>, orchestrator: &Arc<Orchestrator>, caller_connection_id: ConnectionId, options: VapiCallOptions, ) -> RvoipResult<VapiAgentCall>
Originate a Vapi WebSocket call and bridge it to an existing caller.
The adapter registers itself when no Vapi adapter is registered. A different pre-existing Vapi adapter is rejected to keep route ownership exact.
Trait Implementations§
Source§impl ConnectionAdapter for VapiAdapter
impl ConnectionAdapter for VapiAdapter
fn transport(&self) -> Transport
fn kind(&self) -> AdapterKind
Source§fn lifecycle_capabilities(&self) -> AdapterLifecycleCapabilities
fn lifecycle_capabilities(&self) -> AdapterLifecycleCapabilities
Explicit lifecycle guarantees implemented by this adapter. Read more
Source§fn install_lifecycle_sink(
&self,
sink: Arc<dyn AdapterLifecycleSink>,
) -> RvoipResult<()>
fn install_lifecycle_sink( &self, sink: Arc<dyn AdapterLifecycleSink>, ) -> RvoipResult<()>
Install the Orchestrator’s terminal-event fallback. The default is a
no-op for adapters that cannot overrun their lifecycle event path.
Source§fn is_connection_live(&self, connection_id: &ConnectionId) -> bool
fn is_connection_live(&self, connection_id: &ConnectionId) -> bool
Whether the adapter still owns a live route for
conn. The
Orchestrator consults this before accepting queued inbound/principal
events, preventing an event that was queued before abrupt teardown
from resurrecting a cleaned connection.Source§fn originate<'life0, 'async_trait>(
&'life0 self,
request: OriginateRequest,
) -> Pin<Box<dyn Future<Output = RvoipResult<ConnectionHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn originate<'life0, 'async_trait>(
&'life0 self,
request: OriginateRequest,
) -> Pin<Box<dyn Future<Output = RvoipResult<ConnectionHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create an outbound route. Read more
Source§fn activate_outbound<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate_outbound<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish peer-visible signaling and release events for a successfully
claimed outbound route. Read more
Source§fn activate_outbound_with_receipt<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<OutboundActivation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate_outbound_with_receipt<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<OutboundActivation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Activate a claimed outbound route and return its opaque activation
receipt. Read more
fn accept<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reject<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
_reason: RejectReason,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn end<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
reason: EndReason,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn hold<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resume<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transfer<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
_target: TransferTarget,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn streams<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
) -> Pin<Box<dyn Future<Output = RvoipResult<Vec<Arc<dyn MediaStream>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_message<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
_message: Message,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_dtmf<'life0, 'life1, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
_digits: &'life1 str,
_duration_ms: u32,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn renegotiate_media<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
_capabilities: CapabilityDescriptor,
) -> Pin<Box<dyn Future<Output = RvoipResult<NegotiatedCodecs>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn mute<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
direction: MuteDirection,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mute<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
direction: MuteDirection,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
P2 — local mute/unmute on a per-direction basis. Default
NotImplemented so adapters opt in; the Orchestrator surfaces
the error verbatim when a caller invokes mute against a
transport that hasn’t wired it.fn unmute<'life0, 'async_trait>(
&'life0 self,
connection_id: ConnectionId,
direction: MuteDirection,
) -> Pin<Box<dyn Future<Output = RvoipResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe_events(&self) -> Receiver<AdapterEvent>
fn capabilities(&self) -> CapabilityDescriptor
fn verify_request_signature<'life0, 'async_trait>(
&'life0 self,
_connection_id: ConnectionId,
_signature: SignatureHeaders,
) -> Pin<Box<dyn Future<Output = RvoipResult<IdentityAssurance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn supports_inbound_admission_confirmation(&self) -> bool
fn supports_inbound_admission_confirmation(&self) -> bool
Whether this adapter consumes final inbound-admission confirmations. Read more
Source§fn notify_inbound_admission_outcome(
&self,
_connection_id: &ConnectionId,
_lifecycle_generation: u64,
_accepted: bool,
)
fn notify_inbound_admission_outcome( &self, _connection_id: &ConnectionId, _lifecycle_generation: u64, _accepted: bool, )
Report the final policy outcome for one exact inbound lifecycle. Read more
Source§fn take_inbound_context(
&self,
_conn: &ConnectionId,
) -> Option<InboundConnectionContext>
fn take_inbound_context( &self, _conn: &ConnectionId, ) -> Option<InboundConnectionContext>
Take adapter-owned context captured for one inbound connection. Read more
Source§fn subscribe_orchestrator_events(&self) -> Receiver<OrchestratorAdapterEvent>
fn subscribe_orchestrator_events(&self) -> Receiver<OrchestratorAdapterEvent>
Subscribe to the adapter’s atomic lifecycle stream for Orchestrator use. Read more
Source§fn start_inbound_early_media<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn start_inbound_early_media<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Start provisional inbound media without finally accepting the route. Read more
Source§fn transfer_with_attempt<'life0, 'async_trait>(
&'life0 self,
conn: ConnectionId,
_attempt_id: TransferAttemptId,
target: TransferTarget,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn transfer_with_attempt<'life0, 'async_trait>(
&'life0 self,
conn: ConnectionId,
_attempt_id: TransferAttemptId,
target: TransferTarget,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Submit a transfer with an application-owned correlation identifier. Read more
Source§fn allocate_subscriber_stream<'life0, 'async_trait>(
&'life0 self,
_subscriber: ConnectionId,
_kind: StreamKind,
_codec: CodecInfo,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn MediaStream>, RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn allocate_subscriber_stream<'life0, 'async_trait>(
&'life0 self,
_subscriber: ConnectionId,
_kind: StreamKind,
_codec: CodecInfo,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn MediaStream>, RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allocate a fresh per-
(subscriber, publisher_strm) MediaStream for
the multi-party fanout path (plan §12 MP3c / G4). Required so a
subscriber in an N-party room can demultiplex datagrams from
multiple upstream publishers via distinct stream_local_ids on
the wire — without this, all publishers land on the subscriber’s
default stream and the audio mixes at the jitter buffer. Read morefn send_data_message<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
_message: DataMessage,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn play_audio<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
_source: AudioSource,
) -> Pin<Box<dyn Future<Output = Result<PlaybackHandle, RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn play_audio<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
_source: AudioSource,
) -> Pin<Box<dyn Future<Output = Result<PlaybackHandle, RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
P2 — play
source toward the peer on conn. Adapters that
implement this construct a PlaybackHandle via
PlaybackHandle::new, spawn the playback task watching the
returned cancel_rx, and return the handle. Default
NotImplemented.Source§fn send_step_up_request<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
_required: IdentityAssuranceRequirement,
_allowed_methods: Vec<String>,
_reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn send_step_up_request<'life0, 'async_trait>(
&'life0 self,
_conn: ConnectionId,
_required: IdentityAssuranceRequirement,
_allowed_methods: Vec<String>,
_reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), RvoipError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
P12.6 — send an
identity.step-up-request envelope to the peer
asking them to present higher-assurance credentials. The peer’s
identity.step-up-response arrives as
AdapterEvent::StepUpResponse which the orchestrator
re-emits as crate::events::Event::IdentityStepUpResponseReceived.
UCTP-family adapters override this; SIP / WebRTC default to
NotImplemented since step-up is a UCTP-native flow per
CONVERSATION_PROTOCOL.md §5.8.Auto Trait Implementations§
impl !Freeze for VapiAdapter
impl !RefUnwindSafe for VapiAdapter
impl !UnwindSafe for VapiAdapter
impl Send for VapiAdapter
impl Sync for VapiAdapter
impl Unpin for VapiAdapter
impl UnsafeUnpin for VapiAdapter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more