Skip to main content

FlowEffects

Trait FlowEffects 

Source
pub trait FlowEffects: Send {
    // Required methods
    fn speak<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        prompt: &'life1 Prompt,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn collect_digit<'life0, 'async_trait>(
        &'life0 mut self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Digit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn ring_human<'life0, 'async_trait>(
        &'life0 mut self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<RingOutcome>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn record_message<'life0, 'async_trait>(
        &'life0 mut self,
        tone: MessageTone,
        max: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn transfer<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        target: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn hangup<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        prompt: Option<&'life1 Prompt>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn now(&self) -> OffsetDateTime;
}
Expand description

The side effects the components need. The engine calls these; the impl performs the telephony/audio. &mut self because a real impl holds the live call. Methods return anyhow::Result so the daemon impl can surface call-dropped / device errors uniformly; the engine treats any Err as “the call is gone” and aborts with a trace.

Required Methods§

Source

fn speak<'life0, 'life1, 'async_trait>( &'life0 mut self, prompt: &'life1 Prompt, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Play a prompt (TTS text or an audio asset) to the caller, returning when playback finishes.

Source

fn collect_digit<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Option<Digit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait up to timeout for one DTMF digit. Ok(None) means the window elapsed with no press (distinct from an error).

Source

fn ring_human<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<RingOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ring the human for up to timeout.

Source

fn record_message<'life0, 'async_trait>( &'life0 mut self, tone: MessageTone, max: Duration, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record a voicemail: play tone (the caller’s record-start cue), then capture up to max. The node’s prompt has already been spoken via FlowEffects::speak — the engine traces it as its own step. Returns the seconds actually captured (for the trace).

Source

fn transfer<'life0, 'life1, 'async_trait>( &'life0 mut self, target: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Blind-transfer the call to target.

Source

fn hangup<'life0, 'life1, 'async_trait>( &'life0 mut self, prompt: Option<&'life1 Prompt>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Speak an optional goodbye and end the call.

Source

fn now(&self) -> OffsetDateTime

The current instant, for hours evaluation. Injectable so tests pin a fixed time and the schedule is deterministic.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§