2026-07-22 22:53:28 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
|
|
|
|
|
|
// lint-disable-file no-char-pointer
|
|
|
|
|
import std;
|
|
|
|
|
import Crafter.Build;
|
2026-10-06 16:45:44 +02:00
|
|
|
#pragma crafter dependency "https://forgejo.catcrafts.net/Catcrafts/Crafter.LintRules.git" commit "e906f797da2cd0b1776dd1b420f9b04d3cd24baf"
|
|
|
|
|
import Crafter.LintRules;
|
2026-07-22 22:53:28 +02:00
|
|
|
namespace fs = std::filesystem;
|
|
|
|
|
using namespace Crafter;
|
|
|
|
|
|
|
|
|
|
// pkg-config wrapper (std-only: no popen in import std). Returns the flags
|
|
|
|
|
// split on whitespace, or empty if pkg-config is unavailable — callers
|
|
|
|
|
// provide a fallback for that case.
|
|
|
|
|
static std::vector<std::string> PkgConfig(std::string_view args) {
|
|
|
|
|
fs::path tmp = fs::temp_directory_path() /
|
|
|
|
|
std::format("imsd-pkgconfig-{}.txt", std::hash<std::string_view>{}(args));
|
|
|
|
|
std::string cmd = std::format("pkg-config {} > {} 2>/dev/null", args, tmp.string());
|
|
|
|
|
std::vector<std::string> flags;
|
|
|
|
|
if (std::system(cmd.c_str()) == 0) {
|
|
|
|
|
std::ifstream f(tmp);
|
|
|
|
|
std::string flag;
|
|
|
|
|
while (f >> flag)
|
|
|
|
|
flags.push_back(flag);
|
|
|
|
|
}
|
|
|
|
|
std::error_code ec;
|
|
|
|
|
fs::remove(tmp, ec);
|
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GDBus (gio-2.0) — bus layer for the two daemons; chosen over sd-bus because
|
|
|
|
|
// the platform stack (ModemManager, libqmi for the future direct-AKA port) is
|
|
|
|
|
// GLib, so they want a GMainLoop regardless.
|
|
|
|
|
static void ApplyGioFlags(Configuration& cfg) {
|
|
|
|
|
if (!cfg.sysroot.empty()) {
|
|
|
|
|
// cross build (e.g. --target=aarch64-alpine-linux-musl
|
|
|
|
|
// --sysroot=<packaging/make-sysroot.sh output>): the host's
|
|
|
|
|
// pkg-config would answer for the wrong architecture. glib's
|
|
|
|
|
// include layout is stable across distros; the `-I=` form makes
|
|
|
|
|
// clang resolve the paths inside the sysroot.
|
|
|
|
|
cfg.compileFlags.push_back("-I=/usr/include/glib-2.0");
|
|
|
|
|
cfg.compileFlags.push_back("-I=/usr/lib/glib-2.0/include");
|
|
|
|
|
for (const char* l : { "-lgio-2.0", "-lgobject-2.0", "-lglib-2.0" })
|
|
|
|
|
cfg.linkFlags.push_back(l);
|
|
|
|
|
} else {
|
|
|
|
|
// native build: ask pkg-config. Only -I/-D flags pass through:
|
|
|
|
|
// pkg-config also emits -pthread, which would config-mismatch the
|
|
|
|
|
// shared prebuilt std.pcm (and pthread lives in libc on every
|
|
|
|
|
// platform we target).
|
|
|
|
|
for (std::string& f : PkgConfig("--cflags gio-2.0"))
|
|
|
|
|
if (f.starts_with("-I") || f.starts_with("-D")) cfg.compileFlags.push_back(std::move(f));
|
|
|
|
|
std::vector<std::string> libs;
|
|
|
|
|
for (std::string& f : PkgConfig("--libs gio-2.0"))
|
|
|
|
|
if (f.starts_with("-l") || f.starts_with("-L")) libs.push_back(std::move(f));
|
|
|
|
|
if (libs.empty()) libs = { "-lgio-2.0", "-lgobject-2.0", "-lglib-2.0" };
|
|
|
|
|
for (std::string& f : libs)
|
|
|
|
|
cfg.linkFlags.push_back(std::move(f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
imsd, imsd-ofonod: let polkit decide call control, not the account name
The system-bus policies granted net.catcrafts.IMS1 and org.ofono to root
and to the account `user`, postmarketOS's default name, so on a unit
whose account is called something else dbus denied every Dial from the
dialer — nothing in imsd's journal, nothing on screen. A field user
found it by trial (alyx report 14, 2026-09-20; ims ledger F14).
Let any local account reach both names and have the daemons decide:
placing, answering or ending a call needs polkit's
net.catcrafts.IMS1.Voice (the active local session; not an ssh login, an
inactive session or a system service account). imsd-ofonod asks about
its own callers, since its calls reach imsd as root. Reads such as the
status and the call list are not gated, and a refusal is logged with the
sender; a `--session` run, the development mode without root or polkit,
leaves the gate off. The check is ImsdBus, a small GLib module both
daemons link; the package depends on polkit.
An upgrade restarts both daemons (the previous commit), so the open
policy faces the old, ungated daemons only until the apk transaction
ends.
Tested on the dev phone (KPN) in builds of this series; not every path
has run there.
2026-10-03 20:44:58 +02:00
|
|
|
// ImsdBus — the polkit gate imsd and imsd-ofonod put in front of call
|
|
|
|
|
// control. A static library of its own: GLib, so outside imsd-core.
|
|
|
|
|
static std::unique_ptr<Configuration> BusLibrary(std::span<const std::string_view> args) {
|
|
|
|
|
auto bus = std::make_unique<Configuration>();
|
|
|
|
|
bus->path = "./";
|
|
|
|
|
bus->name = "imsd-bus";
|
|
|
|
|
bus->outputName = "imsd-bus";
|
|
|
|
|
ApplyStandardArgs(*bus, args);
|
|
|
|
|
bus->type = ConfigurationType::LibraryStatic;
|
|
|
|
|
{
|
|
|
|
|
std::array<fs::path, 1> ifaces = { "interfaces/ImsdBus" };
|
|
|
|
|
std::array<fs::path, 0> impls = {};
|
|
|
|
|
bus->GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
ApplyGioFlags(*bus);
|
|
|
|
|
return bus;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-22 22:53:28 +02:00
|
|
|
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
// Five executables come out of this repo; which one a build produces is
|
2026-07-22 22:53:28 +02:00
|
|
|
// chosen by `--product=`:
|
|
|
|
|
// daemon (default) — imsd, the control-plane daemon (GDBus + engine),
|
|
|
|
|
// and the unit tests, which link imsd-core.
|
|
|
|
|
// media — imsd-media, the standalone RTP/AMR-WB data plane
|
|
|
|
|
// the daemon spawns per call (pure std + POSIX, no
|
|
|
|
|
// core, no GLib). Built with `-- --product=media`.
|
|
|
|
|
// dialerd — imsd-dialerd, the session-bus Plasma Dialer
|
|
|
|
|
// backend (org.kde.telephony.*) bridging to imsd
|
|
|
|
|
// (pure GDBus translation, no core).
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
// ofonod — imsd-ofonod, the system-bus GNOME Calls backend
|
|
|
|
|
// (org.ofono.*) bridging to imsd, for Phosh and
|
imsd, imsd-ofonod: let polkit decide call control, not the account name
The system-bus policies granted net.catcrafts.IMS1 and org.ofono to root
and to the account `user`, postmarketOS's default name, so on a unit
whose account is called something else dbus denied every Dial from the
dialer — nothing in imsd's journal, nothing on screen. A field user
found it by trial (alyx report 14, 2026-09-20; ims ledger F14).
Let any local account reach both names and have the daemons decide:
placing, answering or ending a call needs polkit's
net.catcrafts.IMS1.Voice (the active local session; not an ssh login, an
inactive session or a system service account). imsd-ofonod asks about
its own callers, since its calls reach imsd as root. Reads such as the
status and the call list are not gated, and a refusal is logged with the
sender; a `--session` run, the development mode without root or polkit,
leaves the gate off. The check is ImsdBus, a small GLib module both
daemons link; the package depends on polkit.
An upgrade restarts both daemons (the previous commit), so the open
policy faces the old, ungated daemons only until the apk transaction
ends.
Tested on the dev phone (KPN) in builds of this series; not every path
has run there.
2026-10-03 20:44:58 +02:00
|
|
|
// GNOME Mobile (GDBus translation plus the imsd-bus
|
|
|
|
|
// polkit gate on its callers, no core).
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
// pcscf — imsd-pcscf, the P-CSCF reader for the bring-up: one
|
|
|
|
|
// QMI WDS client over a raw QRTR socket (pure std +
|
|
|
|
|
// POSIX, links the core for Imsd:Qmi, no GLib).
|
2026-07-22 22:53:28 +02:00
|
|
|
bool wantMedia = false;
|
|
|
|
|
bool wantDialerd = false;
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
bool wantOfonod = false;
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
bool wantPcscf = false;
|
2026-07-22 22:53:28 +02:00
|
|
|
for (std::string_view a : args) {
|
|
|
|
|
if (a == "--product=media") wantMedia = true;
|
|
|
|
|
if (a == "--product=dialerd") wantDialerd = true;
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
if (a == "--product=ofonod") wantOfonod = true;
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
if (a == "--product=pcscf") wantPcscf = true;
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
}
|
|
|
|
|
if (wantOfonod) {
|
|
|
|
|
Configuration ofonod;
|
|
|
|
|
ofonod.path = "./";
|
|
|
|
|
ofonod.name = "imsd-ofonod";
|
|
|
|
|
ofonod.outputName = "imsd-ofonod";
|
|
|
|
|
ApplyStandardArgs(ofonod, args);
|
|
|
|
|
ofonod.type = ConfigurationType::Executable;
|
imsd, imsd-ofonod: let polkit decide call control, not the account name
The system-bus policies granted net.catcrafts.IMS1 and org.ofono to root
and to the account `user`, postmarketOS's default name, so on a unit
whose account is called something else dbus denied every Dial from the
dialer — nothing in imsd's journal, nothing on screen. A field user
found it by trial (alyx report 14, 2026-09-20; ims ledger F14).
Let any local account reach both names and have the daemons decide:
placing, answering or ending a call needs polkit's
net.catcrafts.IMS1.Voice (the active local session; not an ssh login, an
inactive session or a system service account). imsd-ofonod asks about
its own callers, since its calls reach imsd as root. Reads such as the
status and the call list are not gated, and a refusal is logged with the
sender; a `--session` run, the development mode without root or polkit,
leaves the gate off. The check is ImsdBus, a small GLib module both
daemons link; the package depends on polkit.
An upgrade restarts both daemons (the previous commit), so the open
policy faces the old, ungated daemons only until the apk transaction
ends.
Tested on the dev phone (KPN) in builds of this series; not every path
has run there.
2026-10-03 20:44:58 +02:00
|
|
|
static auto Bus = BusLibrary(args);
|
|
|
|
|
ofonod.dependencies = { Bus.get() };
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
{
|
|
|
|
|
std::array<fs::path, 0> ifaces = {};
|
|
|
|
|
std::array<fs::path, 1> impls = { "implementations/ofonod" };
|
|
|
|
|
ofonod.GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
ApplyGioFlags(ofonod);
|
2026-10-06 16:45:44 +02:00
|
|
|
LintRules::AddRules(ofonod);
|
ofonod: GNOME Calls backend over org.ofono for Phosh and GNOME Mobile
imsd-ofonod presents imsd on the system bus as an oFono modem — Manager at
/, Modem + VoiceCallManager at /imsd, a VoiceCall object per call — which
is what GNOME Calls' bundled ofono provider drives; Calls, Phosh and GNOME
Shell run unmodified. org.gnome.Calls is not a seam a third party can
provide (Calls exports it, nothing feeds it), and Calls' provider plugins
link private headers, so org.ofono is the only D-Bus contract available.
Pure GDBus translation of net.catcrafts.IMS1, no core, like imsd-dialerd.
Packaged as the opt-in imsd-ofono subpackage: the daemon, its unit
(Conflicts=ofono.service), the system-bus policy and a gschema override
that points Calls at the ofono provider instead of mm (the ModemManager
origin would offer the modem's CS voice path, which carries no audio on
these phones). The policy grants root send_destination=org.ofono: under
dbus-broker a broadcast is checked against the sender's send policy for
every name the receiver owns, so without it imsd's call signals never
reach the daemon.
Verified on a Fairphone 6 with GNOME Calls 50.0: outgoing and incoming
calls with audio both ways, answered and hung up through
org.gnome.Calls.Call. Known Calls-side gap documented in the README: after
the VoiceCallManager interface is withdrawn and re-added, Calls keeps the
old origin's CallAdded handler and eventually crashes.
2026-09-20 16:07:46 +02:00
|
|
|
return ofonod;
|
2026-07-22 22:53:28 +02:00
|
|
|
}
|
|
|
|
|
if (wantDialerd) {
|
|
|
|
|
Configuration dialerd;
|
|
|
|
|
dialerd.path = "./";
|
|
|
|
|
dialerd.name = "imsd-dialerd";
|
|
|
|
|
dialerd.outputName = "imsd-dialerd";
|
|
|
|
|
ApplyStandardArgs(dialerd, args);
|
|
|
|
|
dialerd.type = ConfigurationType::Executable;
|
|
|
|
|
{
|
|
|
|
|
std::array<fs::path, 0> ifaces = {};
|
|
|
|
|
std::array<fs::path, 1> impls = { "implementations/dialerd" };
|
|
|
|
|
dialerd.GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
ApplyGioFlags(dialerd);
|
2026-10-06 16:45:44 +02:00
|
|
|
LintRules::AddRules(dialerd);
|
2026-07-22 22:53:28 +02:00
|
|
|
return dialerd;
|
|
|
|
|
}
|
|
|
|
|
if (wantMedia) {
|
|
|
|
|
Configuration media;
|
|
|
|
|
media.path = "./";
|
|
|
|
|
media.name = "imsd-media";
|
|
|
|
|
media.outputName = "imsd-media";
|
|
|
|
|
ApplyStandardArgs(media, args);
|
|
|
|
|
media.type = ConfigurationType::Executable;
|
|
|
|
|
{
|
|
|
|
|
std::array<fs::path, 0> ifaces = {};
|
|
|
|
|
std::array<fs::path, 1> impls = { "implementations/media" };
|
|
|
|
|
media.GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
media.linkFlags.push_back("-ldl"); // dlopen the AMR-WB codecs
|
|
|
|
|
media.linkFlags.push_back("-lpthread"); // std::jthread playout/mic
|
2026-10-06 16:45:44 +02:00
|
|
|
LintRules::AddRules(media);
|
2026-07-22 22:53:28 +02:00
|
|
|
return media;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// imsd-core — the engine as a static library of pure C++ modules (SIP,
|
|
|
|
|
// SDP, later AKA/IPsec/media/engine). Deliberately GLib-free so every
|
|
|
|
|
// piece is unit-testable without a bus or a phone.
|
|
|
|
|
static auto Core = std::make_unique<Configuration>();
|
|
|
|
|
Core->path = "./";
|
|
|
|
|
Core->name = "imsd-core";
|
|
|
|
|
Core->outputName = "imsd-core";
|
|
|
|
|
ApplyStandardArgs(*Core, args);
|
|
|
|
|
Core->type = ConfigurationType::LibraryStatic;
|
|
|
|
|
{
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
std::array<fs::path, 9> ifaces = {
|
2026-07-22 22:53:28 +02:00
|
|
|
"interfaces/Imsd",
|
|
|
|
|
"interfaces/Imsd-Util",
|
|
|
|
|
"interfaces/Imsd-Aka",
|
|
|
|
|
"interfaces/Imsd-Ipsec",
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
"interfaces/Imsd-Qmi",
|
2026-07-22 22:53:28 +02:00
|
|
|
"interfaces/Imsd-Sip",
|
|
|
|
|
"interfaces/Imsd-Sdp",
|
|
|
|
|
"interfaces/Imsd-Messages",
|
|
|
|
|
"interfaces/Imsd-Engine",
|
|
|
|
|
};
|
|
|
|
|
std::array<fs::path, 0> impls = {};
|
|
|
|
|
Core->GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
if (wantPcscf) {
|
|
|
|
|
Configuration pcscf;
|
|
|
|
|
pcscf.path = "./";
|
|
|
|
|
pcscf.name = "imsd-pcscf";
|
|
|
|
|
pcscf.outputName = "imsd-pcscf";
|
|
|
|
|
ApplyStandardArgs(pcscf, args);
|
|
|
|
|
pcscf.type = ConfigurationType::Executable;
|
|
|
|
|
pcscf.dependencies = { Core.get() };
|
|
|
|
|
{
|
|
|
|
|
std::array<fs::path, 0> ifaces = {};
|
|
|
|
|
std::array<fs::path, 1> impls = { "implementations/pcscf" };
|
|
|
|
|
pcscf.GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
LintRules::AddRules(pcscf);
|
|
|
|
|
return pcscf;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-22 22:53:28 +02:00
|
|
|
// imsd — the daemon executable: GLib main loop + GDBus service
|
|
|
|
|
// (net.catcrafts.IMS1, same ABI as the Python imsd.py) around the core.
|
|
|
|
|
Configuration cfg;
|
|
|
|
|
cfg.path = "./";
|
|
|
|
|
cfg.name = "imsd";
|
|
|
|
|
cfg.outputName = "imsd";
|
|
|
|
|
ApplyStandardArgs(cfg, args);
|
|
|
|
|
cfg.type = ConfigurationType::Executable;
|
imsd, imsd-ofonod: let polkit decide call control, not the account name
The system-bus policies granted net.catcrafts.IMS1 and org.ofono to root
and to the account `user`, postmarketOS's default name, so on a unit
whose account is called something else dbus denied every Dial from the
dialer — nothing in imsd's journal, nothing on screen. A field user
found it by trial (alyx report 14, 2026-09-20; ims ledger F14).
Let any local account reach both names and have the daemons decide:
placing, answering or ending a call needs polkit's
net.catcrafts.IMS1.Voice (the active local session; not an ssh login, an
inactive session or a system service account). imsd-ofonod asks about
its own callers, since its calls reach imsd as root. Reads such as the
status and the call list are not gated, and a refusal is logged with the
sender; a `--session` run, the development mode without root or polkit,
leaves the gate off. The check is ImsdBus, a small GLib module both
daemons link; the package depends on polkit.
An upgrade restarts both daemons (the previous commit), so the open
policy faces the old, ungated daemons only until the apk transaction
ends.
Tested on the dev phone (KPN) in builds of this series; not every path
has run there.
2026-10-03 20:44:58 +02:00
|
|
|
static auto Bus = BusLibrary(args);
|
|
|
|
|
cfg.dependencies = { Core.get(), Bus.get() };
|
2026-07-22 22:53:28 +02:00
|
|
|
{
|
|
|
|
|
std::array<fs::path, 0> ifaces = {};
|
|
|
|
|
std::array<fs::path, 1> impls = { "implementations/main" };
|
|
|
|
|
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApplyGioFlags(cfg);
|
|
|
|
|
cfg.linkFlags.push_back("-lpthread"); // std::thread engine loop
|
|
|
|
|
|
|
|
|
|
cfg.AddTest("Util").Dependencies({ Core.get() });
|
|
|
|
|
cfg.AddTest("Aka").Dependencies({ Core.get() });
|
|
|
|
|
cfg.AddTest("Ipsec").Dependencies({ Core.get() });
|
qmi, imsd-pcscf: read the ims PDN's P-CSCF list from the modem's runtime settings
The network hands the P-CSCF addresses to the modem in the PDN's Protocol
Configuration Options; ModemManager's bearer code does not ask the modem
for them, qmicli (libqmi 1.39) prints none of them, and libqmi has no TLV
for the IPv6 list (0x2E), which is why PCSCF= was a required setting. A
second QMI WDS client reads them once it is bound to the bearer's mux
data port (the binding ModemManager gives its own clients): Bind Mux
Data Port, Set IP Family 6, Get Current Settings, over one AF_QIPCRTR
socket. Imsd:Qmi holds the bytes and the readers (0x22 the flag, 0x23
IPv4, 0x24 FQDN, 0x2E IPv6 in Qualcomm's layout: a count, then 16 bytes
each); imsd-pcscf is the socket, the service lookup and the sequence, and
prints the list, one address per line; nothing runs it yet. It sends
no Start Network and no Stop Network; the bearer stayed connected and the
registration stood after its runs (the fp6 journal's probe capture 04,
benches 38 and 39). The
build, the CI cross-compile, the tarball and the apk gain the product;
linux-headers is named in the sysroot for <linux/qrtr.h>.
Tested: crafter-build test, 8 passed; the aarch64 build of this commit's
helper on the dev phone (KPN) against the live ims bearer.
2026-10-11 16:07:28 +02:00
|
|
|
cfg.AddTest("Qmi").Dependencies({ Core.get() });
|
2026-07-22 22:53:28 +02:00
|
|
|
cfg.AddTest("Messages").Dependencies({ Core.get() });
|
|
|
|
|
cfg.AddTest("Engine").Dependencies({ Core.get() });
|
|
|
|
|
cfg.AddTest("Sip").Dependencies({ Core.get() });
|
|
|
|
|
cfg.AddTest("Sdp").Dependencies({ Core.get() });
|
|
|
|
|
|
2026-10-06 16:45:44 +02:00
|
|
|
LintRules::AddRules(cfg);
|
2026-07-22 22:53:28 +02:00
|
|
|
|
|
|
|
|
return cfg;
|
|
|
|
|
}
|