Skip to main content

VapiAdapter

Struct VapiAdapter 

Source
pub struct VapiAdapter { /* private fields */ }
Expand description

An outbound-only Vapi interop adapter.

Implementations§

Source§

impl VapiAdapter

Source

pub fn new(config: VapiConfig) -> Result<Arc<Self>>

Source

pub fn subscribe_vapi_events(&self) -> Receiver<VapiEventEnvelope>

Source

pub fn subscribe_call_events( &self, connection_id: &ConnectionId, ) -> RvoipResult<Receiver<VapiEvent>>

Source

pub async fn say( &self, connection_id: &ConnectionId, content: impl Into<String>, end_call_after_spoken: bool, interrupt_assistant: bool, ) -> Result<()>

Source

pub async fn add_message( &self, connection_id: &ConnectionId, role: impl Into<String>, content: impl Into<String>, trigger_response: bool, ) -> Result<()>

Source

pub async fn mute_assistant(&self, connection_id: &ConnectionId) -> Result<()>

Source

pub async fn unmute_assistant(&self, connection_id: &ConnectionId) -> Result<()>

Source§

impl VapiAdapter

Source

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

Source§

fn transport(&self) -> Transport

Source§

fn kind(&self) -> AdapterKind

Source§

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<()>

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

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,

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,

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,

Activate a claimed outbound route and return its opaque activation receipt. Read more
Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

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.
Source§

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,

Source§

fn subscribe_events(&self) -> Receiver<AdapterEvent>

Source§

fn capabilities(&self) -> CapabilityDescriptor

Source§

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

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, )

Report the final policy outcome for one exact inbound lifecycle. Read more
Source§

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>

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,

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,

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,

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 more
Source§

fn 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,

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,

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more