pub struct Call {
pub channel: String,
pub unique_id: String,
/* private fields */
}Expand description
a live call being tracked by the PBX
wraps a channel name and unique_id with the AMI client for issuing commands and tracking events
Fields§
§channel: Stringchannel name (e.g. “PJSIP/100-00000001”)
unique_id: Stringper-channel unique identifier
Implementations§
Source§impl Call
impl Call
Sourcepub async fn hangup(&self) -> Result<AmiResponse>
pub async fn hangup(&self) -> Result<AmiResponse>
hang up this call
Sourcepub async fn wait_for_answer(&self, timeout: Duration) -> Result<(), PbxError>
pub async fn wait_for_answer(&self, timeout: Duration) -> Result<(), PbxError>
wait for this channel to reach “Up” state (answered)
listens for Newstate events with channel_state_desc “Up”. returns Err if the channel hangs up before answering.
the inner subscription is protected by a tokio Mutex so that
Call can remain Clone. if multiple clones call this
concurrently, only one acquires the lock at a time — the
winner consumes events while the others block on the mutex.
callers that need concurrent waiting should create separate
subscriptions via Pbx::client.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Call
impl !RefUnwindSafe for Call
impl Send for Call
impl Sync for Call
impl Unpin for Call
impl UnsafeUnpin for Call
impl !UnwindSafe for Call
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