pub fn hang_up(&mut self) -> Result<(), CallError> {
        use CallState::*;
        let states = vec![IncomingRinging, OngoingActive, OngoingHeld, IncomingWaiting];
        let idx = self
            .oldest_by_state(states[0])
            .or_else(|| self.oldest_by_state(states[1]))
            .or_else(|| self.oldest_by_state(states[2]))
            .or_else(|| self.oldest_by_state(states[3]))
            .ok_or(CallError::None(states))?
            .0;
        self.request_terminate(idx)
    }
/// Terminate a call.
///
/// The AT+CHUP command does not specify a particular call to be terminated. When there are
/// multiple calls that could be terminated, the Audio Gateway must make a determination as to
/// which call to terminate. This prioritization is based on the perceived urgency of a call in
/// a given state.
///
/// Terminate a single call based on the following policy:
///
///   * The oldest Incoming Ringing call is terminated.
///   * If there are no Incoming Ringing calls, the oldest Ongoing Active call is terminated.
///   * If there are no Ongoing Active calls, the oldest Ongoing Held call is terminated.
///   * If there are no Ongoing Held calls, the oldest Incoming Waiting call is terminated.
///   * If there are no calls in any of the previously specified states, return an Error.
// If it becomes desirable for this policy to be configurable, it should be pulled out into the
// component's configuration data.
//
// Incoming Waiting is prioritized last because implementations should be using the AT+CHLD
// command to manage waiting calls instead of the AT+CHUP command.
Terminate a call.
The AT+CHUP command does not specify a particular call to be terminated. When there are
multiple calls that could be terminated, the Audio Gateway must make a determination as to
which call to terminate. This prioritization is based on the perceived urgency of a call in
a given state.

Terminate a single call based on the following policy.

The oldest Incoming Ringing call is terminated.
If there are no Incoming Ringing calls, the oldest Ongoing Active call is terminated.
If there are no Ongoing Active calls, the oldest Ongoing Held call is terminated.
If there are no Ongoing Held calls, the oldest Incoming Waiting call is terminated.
If there are no calls in any of the previously specified states, return an Error.
If it becomes desirable for this policy to be configurable, it should be pulled out into the
component's configuration data.

Incoming Waiting is prioritized last because implementations should be using the AT+CHLD
command to manage waiting calls instead of the AT+CHUP command.
Terminate a call . The AT + CHUP command does not specify a particular call to be terminated . When there are multiple calls that could be terminated the Audio Gateway must make a determination as to which call to terminate . This prioritization is based on the perceived urgency of a call in a given state . Terminate a single call based on the following policy . The oldest Incoming Ringing call is terminated . If there are no Incoming Ringing calls the oldest Ongoing Active call is terminated . If there are no Ongoing Active calls the oldest Ongoing Held call is terminated . If there are no Ongoing Held calls the oldest Incoming Waiting call is terminated . If there are no calls in any of the previously specified states return an Error . If it becomes desirable for this policy to be configurable it should be pulled out into the component ' s configuration data . Incoming Waiting is prioritized last because implementations should be using the AT + CHLD command to manage waiting calls instead of the AT + CHUP command .
pub fn hang_up(&mut self) -> Result<(), CallError> {
        use CallState::*;
        let states = vec![IncomingRinging, OngoingActive, OngoingHeld, IncomingWaiting];
        let idx = self
            .oldest_by_state(states[0])
            .or_else(|| self.oldest_by_state(states[1]))
            .or_else(|| self.oldest_by_state(states[2]))
            .or_else(|| self.oldest_by_state(states[3]))
            .ok_or(CallError::None(states))?
            .0;
        self.request_terminate(idx)
    }
pub fn hang_up ( & mut self ) -> Result < ( ) , CallError > { use CallState :: * ; let states = vec ! [ IncomingRinging OngoingActive OngoingHeld IncomingWaiting ] ; let idx = self . oldest_by_state ( states [ 0 ] ) . or_else ( | | self . oldest_by_state ( states [ 1 ] ) ) . or_else ( | | self . oldest_by_state ( states [ 2 ] ) ) . or_else ( | | self . oldest_by_state ( states [ 3 ] ) ) . ok_or ( CallError :: None ( states ) ) ? . 0 ; self . request_terminate ( idx ) }
Terminate a call.
Terminate a call .
&mut self
&mut self