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.
This commit is contained in:
Jorijn van der Graaf 2026-09-20 16:07:46 +02:00
commit b986eb3750
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
11 changed files with 1037 additions and 13 deletions

View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# GNOME Calls autoloads ["mm", "sip"] by default. imsd is reached through the
# `ofono` provider (imsd-ofonod), so point Calls at that one instead.
#
# "mm" is dropped on purpose rather than appended: it would add the real
# ModemManager modem as a second, competing origin, and on a phone whose voice
# path is imsd the modem's own CS/voice route carries no audio — a dial that
# picks that origin fails silently. Re-add it if your device has a working
# ModemManager voice path and you want both.
#
# Install: /usr/share/glib-2.0/schemas/90_imsd-ofono.gschema.override
# then run glib-compile-schemas /usr/share/glib-2.0/schemas (the distro's
# package trigger normally does this for you).
[org.gnome.Calls]
autoload-plugins=['ofono']

View file

@ -19,6 +19,11 @@ makedepends="clang lld libc++-dev llvm-libunwind-dev llvm-runtimes glib-dev pkgc
# requests, which races imsd for the PDN and flaps it with a new prefix every
# ~2.5 min — the two IMS stacks cannot share one PDN
provides="81voltd=$pkgver-r$pkgrel"
# imsd-ofono is opt-in: it carries the org.ofono shim that lets GNOME Calls
# (Phosh, GNOME Mobile) drive imsd, plus the gschema override that repoints
# Calls at the ofono provider. A Plasma Mobile phone wants imsd-dialerd, which
# is in the main package, and must NOT get that override.
subpackages="$pkgname-ofono:ofono"
source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname"
@ -33,3 +38,12 @@ check() {
package() {
make install DESTDIR="$pkgdir"
}
ofono() {
pkgdesc="GNOME Calls (Phosh, GNOME Mobile) backend for imsd"
depends="$pkgname=$pkgver-r$pkgrel calls"
amove usr/bin/imsd-ofonod
amove usr/lib/systemd/system/imsd-ofonod.service
amove usr/share/dbus-1/system.d/imsd-ofono.conf
amove usr/share/glib-2.0/schemas/90_imsd-ofono.gschema.override
}

View file

@ -24,8 +24,11 @@ depends="modemmanager libc++ opencore-amr vo-amrwbenc pipewire-tools"
# (fp6 journal/ims.md s57) — the two IMS stacks cannot share one PDN
provides="81voltd=$pkgver-r$pkgrel"
# no OpenRC service yet: the unit's PDN-bring-up/env-file sequencing is only
# tested under systemd; an initd is welcome once someone can verify one
subpackages="$pkgname-systemd"
# tested under systemd; an initd is welcome once someone can verify one.
# see packaging/APKBUILD: the org.ofono shim for GNOME Calls is opt-in
# (ofono before systemd: systemd() amoves all of usr/lib/systemd/system,
# so ofono() must take imsd-ofonod.service first)
subpackages="$pkgname-ofono:ofono $pkgname-systemd"
options="!check !tracedeps"
source="
imsd-$pkgver.tar.gz
@ -60,6 +63,22 @@ package() {
mkdir -p "$pkgdir"/usr/lib/systemd/system/imsd.service.d
printf '[Unit]\nConditionPathExists=/etc/imsd.env\n' \
> "$pkgdir"/usr/lib/systemd/system/imsd.service.d/10-require-config.conf
install -Dm755 imsd-ofonod "$pkgdir"/usr/bin/imsd-ofonod
install -Dm644 imsd-ofonod.service \
"$pkgdir"/usr/lib/systemd/system/imsd-ofonod.service
install -Dm644 org.ofono.conf \
"$pkgdir"/usr/share/dbus-1/system.d/imsd-ofono.conf
install -Dm644 90_imsd-ofono.gschema.override \
"$pkgdir"/usr/share/glib-2.0/schemas/90_imsd-ofono.gschema.override
}
ofono() {
pkgdesc="GNOME Calls (Phosh, GNOME Mobile) backend for imsd"
depends="$pkgname=$pkgver-r$pkgrel calls"
amove usr/bin/imsd-ofonod
amove usr/lib/systemd/system/imsd-ofonod.service
amove usr/share/dbus-1/system.d/imsd-ofono.conf
amove usr/share/glib-2.0/schemas/90_imsd-ofono.gschema.override
}
systemd() {

View file

@ -83,6 +83,7 @@ XTARGET="--target=aarch64-alpine-linux-musl --sysroot=$SYSROOT --march=armv8.6-a
crafter-build -- $XTARGET
crafter-build -- --product=media $XTARGET
crafter-build -- --product=dialerd $XTARGET
crafter-build -- --product=ofonod $XTARGET
crafter-build test
# --- bundle + package

View file

@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
[Unit]
Description=oFono-compatible GNOME Calls backend for imsd
Documentation=https://forgejo.catcrafts.net/Catcrafts/imsd
# org.ofono is a system-bus name, so this is a system service; it needs no
# privileges beyond owning that name. Only enable it on a GNOME/Phosh session
# — Plasma Mobile uses imsd-dialerd instead. Both may run at once (different
# buses, different consumers), but a real ofonod must not.
Conflicts=ofono.service
After=imsd.service
Wants=imsd.service
[Service]
Type=simple
# EMERGENCY_NUMBERS only, and only so the oFono EmergencyNumbers property
# matches imsd's configuration; imsd itself owns emergency classification.
EnvironmentFile=-/etc/imsd.env
ExecStart=/usr/bin/imsd-ofonod
# it holds no call state of its own — imsd is re-queried on every reconnect
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target

View file

@ -11,9 +11,11 @@ VER="${1:-$(sed -n 's/.*char\* Version = "\(.*\)".*/\1/p' implementations/main.c
BIN=$(ls -t bin/imsd-aarch64-*/imsd 2>/dev/null | head -n1)
MEDIA=$(ls -t bin/imsd-media-aarch64-*/imsd-media 2>/dev/null | head -n1)
DIALERD=$(ls -t bin/imsd-dialerd-aarch64-*/imsd-dialerd 2>/dev/null | head -n1)
OFONOD=$(ls -t bin/imsd-ofonod-aarch64-*/imsd-ofonod 2>/dev/null | head -n1)
[ -n "$BIN" ] || { echo "no aarch64 imsd build found — cross-compile first" >&2; exit 1; }
[ -n "$MEDIA" ] || { echo "no aarch64 imsd-media build — cross-compile with --product=media" >&2; exit 1; }
[ -n "$DIALERD" ] || { echo "no aarch64 imsd-dialerd build — cross-compile with --product=dialerd" >&2; exit 1; }
[ -n "$OFONOD" ] || { echo "no aarch64 imsd-ofonod build — cross-compile with --product=ofonod" >&2; exit 1; }
stage=$(mktemp -d)
trap 'rm -rf "$stage"' EXIT
@ -21,8 +23,10 @@ mkdir "$stage/imsd-$VER"
cp "$BIN" "$stage/imsd-$VER/imsd"
cp "$MEDIA" "$stage/imsd-$VER/imsd-media"
cp "$DIALERD" "$stage/imsd-$VER/imsd-dialerd"
cp "$OFONOD" "$stage/imsd-$VER/imsd-ofonod"
cp packaging/ims-pdn-up.sh packaging/imsd.service \
packaging/imsd-dialerd.desktop \
packaging/imsd-dialerd.desktop packaging/imsd-ofonod.service \
packaging/org.ofono.conf packaging/90_imsd-ofono.gschema.override \
packaging/net.catcrafts.IMS1.conf "$stage/imsd-$VER/"
tar -C "$stage" -czf "imsd-$VER.tar.gz" "imsd-$VER"
echo "wrote imsd-$VER.tar.gz ($(du -h "imsd-$VER.tar.gz" | cut -f1))"

34
packaging/org.ofono.conf Normal file
View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?> <!--*-nxml-*-->
<!-- SPDX-License-Identifier: GPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<!-- imsd-ofonod system-bus policy: imsd presented as an oFono modem, which is
the seam GNOME Calls' bundled `ofono` provider plugin drives.
Install: /usr/share/dbus-1/system.d/imsd-ofono.conf
Deliberately NOT named org.ofono.conf on disk: the real oFono package
ships that filename, and the two must not silently overwrite each other.
They cannot run together in any case — one org.ofono name, one owner. -->
<busconfig>
<policy user="root">
<allow own="org.ofono"/>
<!-- imsd (root) reaches this daemon only by broadcast signals, and
dbus-broker checks a broadcast against the sender's send policy for
every name the receiver owns (dbus-daemon does not): without this
line the default deny below silently drops every CallAdded /
CallStateChanged from imsd on the way to imsd-ofonod (found on the
FP6, 2026-09-20). -->
<allow send_destination="org.ofono"/>
</policy>
<!-- the session user's GNOME Calls drives the modem; call control is
exactly what net.catcrafts.IMS1 already grants it through the dialerd -->
<policy user="user">
<allow send_destination="org.ofono"/>
<allow receive_sender="org.ofono"/>
</policy>
<policy context="default">
<deny own="org.ofono"/>
<deny send_destination="org.ofono"/>
</policy>
</busconfig>