imsd/packaging/imsd.service
Jorijn van der Graaf e5911c09c2 ims-pdn-up: log mmcli errors, gate on registration, configurable ip-type
Three hardenings, each of which cost a field-debugging round-trip:

- Every mmcli failure now lands in the journal verbatim (create-bearer
  and connect stderr were swallowed, making 'connect attempt N failed'
  undecodable — no-service and interface-in-use looked identical).
- Connect attempts are gated on network registration (up to
  IMS_REG_TIMEOUT, default 300 s): the 10x10 s window is shorter than
  some carriers' post-boot attach (~2 min measured), so every attempt
  could burn out before the network was even attached. The settled
  modem/packet-service state is logged either way.
- Bearer ip-type is configurable via IMS_IP_TYPE in /etc/imsd.env
  (default ipv6); the bearer find/reuse now matches ip-type too, so a
  config change cannot silently reuse a stale bearer of the old type.

TimeoutStartSec grows 600->900 to cover the registration gate.

Tested on the FP6 dev phone (KPN): clean-state bring-up in 4 s;
gate + timeout path with modem disabled; per-attempt error lines on a
real contested-PDN failure (second ims PDN while one is connected);
idempotent reuse + REGISTERED (fresh) via systemd.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-01 18:10:04 +02:00

35 lines
1.4 KiB
Desktop File

# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
[Unit]
Description=Userspace IMS/VoLTE daemon (SIP register + calls over the ims PDN)
# needs the ims PDN (multiplexed netdev + global v6) — ims-pdn-up.sh
# creates/connects the bearer through ModemManager and configures the netdev
After=ModemManager.service network.target
Wants=ModemManager.service
[Service]
Type=simple
# bring up the ims PDN first; waits for modem + network registration,
# idempotent. worst case ~14 min (2 min modem wait + 5 min registration
# gate + connect retries), hence TimeoutStartSec
ExecStartPre=/usr/libexec/ims-pdn-up.sh
TimeoutStartSec=900
# /run/imsd.env: written by ims-pdn-up.sh (DEV= the connected ims netdev).
# /etc/imsd.env: admin configuration — PCSCF= is REQUIRED (the carrier's
# P-CSCF address; see the README's Configuration section) and wins over the
# runtime-derived values.
EnvironmentFile=-/run/imsd.env
EnvironmentFile=-/etc/imsd.env
# registration state (imsreg.state) + media stats live here
StateDirectory=imsd
ExecStart=/usr/bin/imsd
# registration: resume an existing SA when possible (avoids fresh-SA
# throttles); a failed bring-up exits nonzero and systemd retries
Restart=on-failure
RestartSec=120
# SIGTERM: engine keeps the SA + registration state for the next resume
KillMode=mixed
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target