pub struct Engine<I: AsyncRead + Unpin, O: AsyncWrite + Unpin> { /* private fields */ }Expand description
The main connector to the Yate Telephone Engine.
Implementations§
Source§impl Engine<AllowStdIo<Stdin>, AllowStdIo<Stdout>>
impl Engine<AllowStdIo<Stdin>, AllowStdIo<Stdout>>
Source§impl<I: AsyncRead + Send + Unpin, O: AsyncWrite + Send + Unpin> Engine<I, O>
impl<I: AsyncRead + Send + Unpin, O: AsyncWrite + Send + Unpin> Engine<I, O>
Sourcepub fn from_io(rx: I, tx: O) -> Self
pub fn from_io(rx: I, tx: O) -> Self
Initialize a connection to the engine with the provided I/O.
If the I/O is a socket or a TCP stream, the module must register itself
with a Self::connect before doing anything.
Sourcepub async fn install(
&self,
priority: impl Into<Option<u64>>,
name: impl Into<String>,
filter: impl Into<Option<(String, Option<String>)>>,
) -> Result<bool, Error>
pub async fn install( &self, priority: impl Into<Option<u64>>, name: impl Into<String>, filter: impl Into<Option<(String, Option<String>)>>, ) -> Result<bool, Error>
Request the engine to install a message handler with the provided priority.
Sourcepub async fn uninstall(&self, name: impl Into<String>) -> Result<bool, Error>
pub async fn uninstall(&self, name: impl Into<String>) -> Result<bool, Error>
Request the engine to remove a previously installed handler.
Sourcepub async fn watch(&self, name: impl Into<String>) -> Result<bool, Error>
pub async fn watch(&self, name: impl Into<String>) -> Result<bool, Error>
Request the engine to install a message watcher.
Sourcepub async fn unwatch(&self, name: impl Into<String>) -> Result<bool, Error>
pub async fn unwatch(&self, name: impl Into<String>) -> Result<bool, Error>
Request the engine to remove a previously installed watcher.
Sourcepub async fn setlocal(
&self,
name: impl Into<String>,
value: impl Into<String>,
) -> Result<bool, Error>
pub async fn setlocal( &self, name: impl Into<String>, value: impl Into<String>, ) -> Result<bool, Error>
Request the engine to set a local variable.
Sourcepub async fn getlocal(&self, name: impl Into<String>) -> Result<String, Error>
pub async fn getlocal(&self, name: impl Into<String>) -> Result<String, Error>
Request the value of a local variable.
Sourcepub async fn message(
&self,
name: impl Into<String>,
retvalue: impl Into<String>,
kv: BTreeMap<String, String>,
) -> Result<(bool, String, BTreeMap<String, String>), Error>
pub async fn message( &self, name: impl Into<String>, retvalue: impl Into<String>, kv: BTreeMap<String, String>, ) -> Result<(bool, String, BTreeMap<String, String>), Error>
Send a Message to the telephony engine for processing.
Sourcepub fn messages(&self) -> impl TryStream<Ok = Req, Error = Error>
pub fn messages(&self) -> impl TryStream<Ok = Req, Error = Error>
Receive messages from the telephony engine for processing.
Sourcepub async fn ack(&self, req: Req, processed: bool) -> Result<(), Error>
pub async fn ack(&self, req: Req, processed: bool) -> Result<(), Error>
Acknowledge the message from the engine,
letting it forward it to the next handler if !processed.
Sourcepub async fn connect(
&self,
role: ConnectRole,
channel: impl Into<Option<(String, Option<String>)>>,
) -> Result<(), Error>
pub async fn connect( &self, role: ConnectRole, channel: impl Into<Option<(String, Option<String>)>>, ) -> Result<(), Error>
Send a connect message to the engine for socket-based modules.
Sourcepub async fn output(&self, text: impl Into<String>) -> Result<(), Error>
pub async fn output(&self, text: impl Into<String>) -> Result<(), Error>
Output some arbitrary text to engine’s log, this is especially useful on socket-based modules.