Skip to main content

MockPhone

Struct MockPhone 

Source
pub struct MockPhone { /* private fields */ }

Implementations§

Source§

impl MockPhone

Source

pub fn new(cmd_tx: Sender<(String, String)>) -> Self

Trait Implementations§

Source§

impl Phone for MockPhone

Source§

fn register(&self, _aor: &str, regint: u32)

Source§

fn dial(&self, number: &str)

Source§

fn hangup(&self)

Source§

fn hangup_all(&self)

Source§

fn accept(&self)

Source§

fn hold(&self)

Source§

fn resume(&self)

Source§

fn mute(&self)

Source§

fn silence_alert(&self)

Stop the alert tone that is playing right now, without touching the call it belongs to. The caller keeps hearing ringback and the call can still be answered — this silences your side only, and only until the next alert. Default: no-op (mocks).
Source§

fn send_dtmf(&self, digit: char)

Source§

fn switch_line(&self, line: usize)

Source§

fn transfer(&self, uri: &str)

Source§

fn attended_transfer_start(&self, uri: &str)

Source§

fn attended_transfer_exec(&self)

Source§

fn attended_transfer_abort(&self)

Source§

fn add_header(&self, key: &str, value: &str)

Source§

fn rm_header(&self, key: &str)

Source§

fn set_audio_source(&self, spec: &str)

Switch the audio source at runtime, e.g. ausine,440 to send a tone, aufile,/path.wav to play a file, or aubridge,default to go silent. Applies to the active call.
Source§

fn arm_invite_response(&self, scode: u16, reason: &str, headers: Vec<String>)

Arm a custom SIP response for the next inbound INVITE(s): answer with scode/reason and the extra headers (each a full header line like Contact: <sip:…>, no trailing CRLF) instead of accepting the call. Sticky until Phone::disarm_invite_response. Arm it before the call arrives for deterministic behaviour.
Source§

fn disarm_invite_response(&self)

Clear any armed response — subsequent inbound INVITEs are accepted again.
Source§

fn select_call(&self, call_id: &str)

Make the call with SIP call_id the UA’s current call (baresip call_set_current), so subsequent hold/resume/hangup/mute target it. No-op if the id isn’t found. Default: no-op (mocks).
Source§

fn media_stats(&self) -> Option<MediaStats>

RTP media stats (jitter/loss/RTT + estimated MOS) for the active call, or the last finished call’s snapshot. None if unavailable (no call yet, or before the first RTCP report). Default: None (mocks).
Source§

fn audio_codec(&self) -> Option<CodecInfo>

The negotiated audio codec on the active call. None if there’s no call or it isn’t negotiated yet. Default: None (mocks).
Source§

fn received_dtmf(&self) -> String

DTMF digits received on the active/last call so far, in order (e.g. "1234#"). Default: empty (mocks).
Source§

fn inbound_headers(&self, call_id: &str) -> Vec<(String, String)>

All SIP headers received on the INVITE of the call with call_id, in order, consuming them from the store. Empty if none / unknown call. Default: empty (mocks).
Source§

fn deflect_incoming(&self, contact: &str, diversion: Option<&str>)

Deflect inbound calls to contact with a 302 Moved Temporarily (plus an RFC 5806 Diversion header when diversion is set). Thin wrapper over Phone::arm_invite_response.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.