#[non_exhaustive]pub enum EndCause {
LocalHangup,
RemoteBye,
RemoteCancel,
Rejected {
status: u16,
},
Timeout,
}Expand description
Why a call ended.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LocalHangup
This side hung up.
RemoteBye
The far end sent a BYE.
RemoteCancel
The far end gave up before this side answered, and sent a CANCEL (RFC 3261 §9.2).
The one cause that belongs to an invitation rather than to a Call, and it
is why Invitation has an event stream of its own: an application
that is ringing has to be told to stop, and polling
Invitation::is_cancelled is not being told.
Distinct from Self::RemoteBye on purpose, even though both are the far end ending
things. A BYE ends a call that was answered and may have carried media; a CANCEL ends one
that never was, so there is no call to report duration or quality for and nothing to send
a BYE of one’s own about. On the wire vocabulary of
docs/specs/app-contract.md §5.3 both are the
remote cause; the distinction is kept here because this enum is what a host in-process
matches on, and collapsing it would make “stop ringing” indistinguishable from “hang up”.
Rejected
The call was refused with a status, rather than answered and later ended.
The direction is worth being exact about: this is the contract’s reject instruction
(docs/specs/app-contract.md §5.3, call.ended with cause rejected{status}) — this
side refusing an invitation — not the far end refusing an attempt of ours. An outbound
attempt that is refused is call.dial.finished with outcome rejected, a different
event about a different leg.
Has no producer at this layer, and the reason is structural rather than unfinished work:
a Call does not exist until an INVITE has already succeeded (2xx and
ACK), so by the time there is a call to end, refusing it is no longer possible — what
ends an answered call is a BYE. Refusing happens before a Call is built, and the
refusal is a response rather than an event on a stream nobody is holding yet.
It stays in the enum because the app-visible call of C-4/A-2 exists from the incoming
INVITE onward and will produce it, and because adding a variant after the fact is exactly
the wire-breaking change §4 of the contract spec warns about.
Timeout
The far end stopped answering (the RFC 4028 session timer expired, RFC 3261 Timer B/F gave up, or the far end otherwise went silent) and this side gave up on it.
Trait Implementations§
impl Copy for EndCause
impl Eq for EndCause
impl StructuralPartialEq for EndCause
Auto Trait Implementations§
impl Freeze for EndCause
impl RefUnwindSafe for EndCause
impl Send for EndCause
impl Sync for EndCause
impl Unpin for EndCause
impl UnsafeUnpin for EndCause
impl UnwindSafe for EndCause
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more