No line: the modem started on its own, without a SIP account

A fifth line, "No line (the modem on its own)": the engine starts as on
a peer line (no SIP, no network needed) with nothing behind it. It
answers AT commands in the terminal and on the serial bridges; a dial
gets NO DIALTONE, as a modem with no phone cable plugged in (the
engine's new peer event NO LINE), an answer NO CARRIER.

Home offers "Start without a line" beside "Set up SIP" when there's no
account: the line set to none and the modem started in one tap. iOS has
the same line and button.

Tests: c_api_test (NO LINE: NO DIALTONE), DModemKitTests.testNoLine
(started without an account, a dial NO DIALTONE, commands still
answered), PeerShotsTest.noLine, DashboardShotsTest.firstRun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
This commit is contained in:
Claude committed 2026-10-18 23:57:13 +00:00
1 parent e999857e57
commit 06e4a41050
16 files changed
+148 -16

No files matched your search

@@ -19,6 +19,8 @@ public final class ModemSession: EngineListener, @unchecked Sendable {
private var dte: DTE?
/// the job the DTE is lent to (a fax call, a transfer, dial-up): its data goes there, not to [onData]
private var claimant: ((Data) -> Void)?
/// the settings' line is none: the engine's dials answered here
private var noLine = false
/// the most of the log and the console kept
public var logMax = 2000
@@ -63,6 +65,7 @@ public final class ModemSession: EngineListener, @unchecked Sendable {
let d = try engine.start(settings.engineConfig(dns: dns, dataFile: dataFile), listener: self)
lock.lock()
dte = d
noLine = settings.noLine
_run = .running
_status = ModemStatus()
_error = nil
@@ -181,6 +184,13 @@ public final class ModemSession: EngineListener, @unchecked Sendable {
}
public func engineLine(caller: Bool, dial: String, fd: Int32) {
lock.lock(); let none = noLine; lock.unlock()
if none {
// (nothing plugged in: a dial gets NO DIALTONE, an answer NO CARRIER)
engine.peerEvent(caller ? "NO LINE" : "FAILED 503")
close(fd)
return
}
if let h = onLine { h(caller, dial, fd) } else { close(fd) }
}
@@ -6,7 +6,8 @@ import Foundation
/// a SIP account, or another phone with the app on the same Wi-Fi).
public struct ModemSettings: Codable, Equatable, Sendable {
public enum Line: String, Codable, Sendable {
case sip, wifi
/// a SIP account; another phone with the app on Wi-Fi; nothing at all (the modem on its own)
case sip, wifi, none
}
/// the SIP account
@@ -54,9 +55,12 @@ public struct ModemSettings: Codable, Equatable, Sendable {
("sip-password", \.password), ("peer-pin", \.peerPin), ("isp-password", \.ispPassword),
]
/// the line another phone's, not SIP
/// the line another phone's (or none), not SIP
public var peer: Bool { line != .sip }
/// no line: the modem on its own (AT commands, the terminal); a dial gets NO DIALTONE
public var noLine: Bool { line == .none }
/// enough to start: an account (or the line another phone's)
public var complete: Bool { peer || (!user.isEmpty && !domain.isEmpty) }