pub struct MockPhone { /* private fields */ }Implementations§
Trait Implementations§
Source§impl Phone for MockPhone
impl Phone for MockPhone
fn register(&self, _aor: &str, regint: u32)
fn dial(&self, number: &str)
fn hangup(&self)
fn hangup_all(&self)
fn accept(&self)
fn hold(&self)
fn resume(&self)
fn mute(&self)
Source§fn silence_alert(&self)
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).
fn send_dtmf(&self, digit: char)
fn switch_line(&self, line: usize)
fn transfer(&self, uri: &str)
fn attended_transfer_start(&self, uri: &str)
fn attended_transfer_exec(&self)
fn attended_transfer_abort(&self)
fn add_header(&self, key: &str, value: &str)
fn rm_header(&self, key: &str)
Source§fn set_audio_source(&self, spec: &str)
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>)
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)
fn disarm_invite_response(&self)
Clear any armed response — subsequent inbound INVITEs are accepted again.
Source§fn select_call(&self, call_id: &str)
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>
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>
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
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)>
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>)
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§
impl Freeze for MockPhone
impl RefUnwindSafe for MockPhone
impl Send for MockPhone
impl Sync for MockPhone
impl Unpin for MockPhone
impl UnsafeUnpin for MockPhone
impl UnwindSafe for MockPhone
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