pub struct CallRegistry { /* private fields */ }Expand description
Registry of active calls, keyed by call_sid.
Allows the inject endpoint to look up an active call and push TTS audio into it without going through the normal pipeline.
Implementations§
Source§impl CallRegistry
impl CallRegistry
pub fn new() -> Self
Sourcepub async fn register(
&self,
call_sid: String,
stream_sid: String,
transport: Transport,
response_tx: Sender<Message>,
speaking: Arc<AtomicBool>,
)
pub async fn register( &self, call_sid: String, stream_sid: String, transport: Transport, response_tx: Sender<Message>, speaking: Arc<AtomicBool>, )
Register a new active call.
Sourcepub async fn deregister(&self, call_sid: &str)
pub async fn deregister(&self, call_sid: &str)
Deregister a call when it ends.
Sourcepub async fn get(&self, call_sid: &str) -> Option<CallEntry>
pub async fn get(&self, call_sid: &str) -> Option<CallEntry>
Look up an active call by call_sid.
Sourcepub async fn send_audio(
entry: &CallEntry,
mulaw_bytes: &[u8],
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn send_audio( entry: &CallEntry, mulaw_bytes: &[u8], ) -> Result<(), Box<dyn Error + Send + Sync>>
Send mu-law audio frames into an active call.
Dispatches based on transport type:
- Twilio: wraps in JSON event envelope with base64 payload + mark event
- Discord: sends plain mu-law chunks as binary + JSON mark event
Trait Implementations§
Source§impl Clone for CallRegistry
impl Clone for CallRegistry
Source§fn clone(&self) -> CallRegistry
fn clone(&self) -> CallRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CallRegistry
impl !RefUnwindSafe for CallRegistry
impl Send for CallRegistry
impl Sync for CallRegistry
impl Unpin for CallRegistry
impl UnsafeUnpin for CallRegistry
impl !UnwindSafe for CallRegistry
Blanket Implementations§
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