Skip to main content

ringo_core/
account.rs

1/// A SIP account to register, independent of any ringo profile/config. Callers
2/// (the softphone or the scenario runner) build this from their own source.
3#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
4pub struct Account {
5    pub username: String,
6    pub domain: String,
7    pub password: String,
8    pub display_name: Option<String>,
9    pub transport: Option<String>,
10    pub auth_user: Option<String>,
11    pub outbound: Option<String>,
12    pub stun_server: Option<String>,
13    pub media_enc: Option<String>,
14    pub regint: Option<u32>,
15    pub mwi: bool,
16    /// DTMF transmission mode (`rtpevent` / `info` / `auto`). `info` sends DTMF as
17    /// SIP INFO, independent of the RTP audio stream — needed where the audio TX
18    /// may be idle (e.g. headless with no clocked source). `None` keeps the
19    /// backend's default.
20    pub dtmf_mode: Option<String>,
21    /// Mark this account as a baresip `catchall` UA: incoming INVITEs whose
22    /// request-URI user matches no registered contact-user fall back to this UA
23    /// instead of being rejected with `404 (UA not found)`. Needed when a
24    /// provider delivers calls addressed to identities other than the
25    /// registration username (the request-URI user is the called number/identity,
26    /// not the account login), which baresip's contact-user match would reject.
27    /// Only safe with a single registered UA per process — with several, baresip
28    /// routes the fallback to just one of them.
29    pub catchall: bool,
30    /// Restrict/order the audio codecs offered for this account, most-preferred
31    /// first (baresip account param `audio_codecs`). Names as baresip knows them,
32    /// e.g. `["opus", "PCMU", "PCMA"]`. Empty = baresip's default codec set/order.
33    #[serde(default)]
34    pub audio_codecs: Vec<String>,
35}
36
37/// Overrides for auto-detected backend settings. Any `None`/empty field
38/// is auto-detected at spawn time.
39#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
40pub struct BackendOptions {
41    pub audio_driver: Option<String>,
42    pub audio_player_device: Option<String>,
43    pub audio_source_device: Option<String>,
44    pub audio_alert_device: Option<String>,
45    pub sip_cafile: Option<String>,
46    /// `None` = auto-detect; `Some("")` = explicitly disable.
47    pub sip_capath: Option<String>,
48    /// Max simultaneous calls (`call_max_calls`). `None` = 4.
49    pub max_calls: Option<u32>,
50    /// Auto-hold the active call when another comes up / the user switches
51    /// (`call_hold_other_calls`). `None` = on. The scenario runner turns this
52    /// off so a test keeps explicit control over hold/resume.
53    pub hold_other_calls: Option<bool>,
54    /// Outgoing-call ring timeout in seconds (`call_local_timeout`). `None` = 120.
55    pub local_timeout_s: Option<u32>,
56    /// SIP `User-Agent` string passed to `ua_init` (e.g. `ringo-phone/0.11.0`).
57    /// `None` = bare `ringo`. Set by the binary so it carries its own version.
58    pub user_agent: Option<String>,
59    /// Arbitrary extra config lines appended at the end (key, value).
60    pub extra: Vec<(String, String)>,
61    /// Capture the full call's sent + received audio in-process (for the
62    /// scenario runner's `--save-audio`). When off, only a short rolling window
63    /// is retained for `verify-audio`. The softphone leaves this off.
64    pub record_audio: bool,
65}