Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR-0015: Calls: control over Tether, audio over PipeWire’s native HFP hands-free role

  • Status: accepted
  • Date: 2026-11-11
  • Deciders: maintainer, after the M3 research round
  • Tags: calls, bluetooth, audio, linux, android

Context

Phone Link handles calls by pairing the PC with the phone over Bluetooth: the PC becomes a hands-free unit (HFP HF) and the phone the audio gateway (AG), exactly like a car kit, while call control and caller information come over Phone Link’s own channel. Tether needs the same on Ubuntu 24.04-family desktops (PipeWire 1.0.5, WirePlumber 0.4.17) and newer (Debian 13, Ubuntu 26.04 with PipeWire 1.4–1.6, WirePlumber 0.5).

Research (November 2026, read-only on the target machine):

  • PipeWire’s native BlueZ backend has implemented HFP HF since 0.3.22 (2021); the 1.0.5 libspa-bluez5.so contains the HF AT command set and WirePlumber 0.4.17’s default bluez5.roles already include hfp_hf next to hfp_ag, so existing headsets keep working.
  • PipeWire 1.0.5 has no call-control API; PipeWire ≥ 1.4 adds an oFono-style org.ofono telephony D-Bus API, not available on 24.04.
  • Alternatives: oFono as bluez5.hfphsp-backend (replaces PipeWire’s native headset support, system service, fragile); hsphfpd (abandoned); our own HF implementation over a BlueZ Profile1 with SCO sockets and mSBC (4–6 weeks, adapter/kernel long tail).
  • Android: with the PC connected as HF and active, Telecom routes cellular call audio to it automatically. AudioManager.setCommunicationDevice affects only the app’s own VoIP audio, BluetoothHeadset.connectAudio() is privileged since API 33. A call-companion InCallService (CALL_COMPANION_APP, normal permission) can call setAudioRoute(ROUTE_BLUETOOTH); to be verified on One UI.
  • TelecomManager.acceptRingingCall/endCall (ANSWER_PHONE_CALLS), placeCall (CALL_PHONE), silenceRinger are available to normal apps; DTMF is not.

Decision

  • Call control and call log travel over the Tether protocol (calls.proto, docs/reference/protocol.md “Calls”). The phone uses Telecom/Telephony APIs for state and commands and the CallLog provider for history. Control works with or without Bluetooth.
  • Call audio uses PipeWire’s native HFP HF role. tetherd handles Bluetooth through BlueZ D-Bus (guided pairing with numeric comparison, trust, connect) and, during a call routed to the PC, selects the phone card’s headset-head-unit profile and links the phone’s HFP source to the default sink and the default source to the phone’s HFP sink (pipewire links via pw-link/wpctl or pipewire-rs), restoring the previous profile and links afterwards. The .deb depends on libspa-0.2-bluetooth; a WirePlumber drop-in that pins bluez5.roles (including hfp_hf) and enables mSBC is installed only when the user’s configuration overrides the roles.
  • Routing on the phone: Telecom’s automatic routing to the active HF device first; a call-companion InCallService for explicit ROUTE commands where One UI allows it; otherwise “transfer to phone/PC” is done from the desktop by connecting/disconnecting the SCO link (HFP AT+BCC / dropping the profile).
  • Fallback: if no HFP node appears or the phone does not open SCO within 3 s, the UI says “Audio on phone” and keeps control.
  • Out of scope: in-call DTMF keypad (documented gap, like Phone Link on many phones), conference merge/swap, video calls. The PipeWire ≥ 1.4 telephony API may later replace parts of the routing logic.

Amendment 2026-11-15: field findings on PipeWire 1.0.5 and Android 16

  • With the phone as audio gateway PipeWire creates the HFP nodes only while the phone holds the SCO link open, and as streams (Stream/Output/Audio, Stream/Input/Audio, role Communication) that WirePlumber links to the default devices. tetherd therefore treats “the nodes exist” as “audio is on the PC”, checks once a second during a call and only adds missing links.
  • The PC cannot open SCO (no node to start), so “transfer to the PC” always goes through the phone. “Transfer to the phone” works from the PC by switching the phone card off for a moment, which closes SCO.
  • Telecom binds our InCallService only with the app-op MANAGE_ONGOING_CALLS (adb, one-time, survives reboots); telecom add-or-remove-call-companion-app has no effect on One UI 8.5. With it, ROUTE to Bluetooth, earpiece and loudspeaker all work.

Consequences

Positive

  • No new system services or audio backends; earbuds and other headsets keep their behaviour.
  • Call control is available even without Bluetooth (e.g. Bluetooth off, desktop without an adapter).
  • Small daemon surface: BlueZ D-Bus plus a few PipeWire links.

Negative / risks

  • mSBC wideband depends on the adapter; otherwise CVSD narrowband.
  • The phone may prefer another active HF/headset (earbuds) for calls; the UI must explain “PC is the active call device”.
  • The phone will also see the PC as an A2DP sink; media may start playing on the PC. A WirePlumber rule can restrict the phone card to hfp_hf.
  • Echo: PipeWire’s echo-cancel module on the mic path is recommended and documented.
  • Bluetooth must be on; on this test machine it is rfkill-blocked by default.

Alternatives considered

oFono backend, hsphfpd and a custom HF stack (see Context), all rejected for M3; the custom stack remains the fallback if the native role proves unusable.