Skip to content

omamobile-mmd 0.1.3: wait for confirmed call release - #461

Merged
derekross merged 8 commits into
derekross:mainfrom
W4HO-ham:w4ho-mmd-confirm-call-release
Nov 11, 2026
Merged

derekross merged 8 commits into
derekross:mainfrom
W4HO-ham:w4ho-mmd-confirm-call-release

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Deleting a live call currently removes it and reports success even if the modem has not confirmed the hangup. Keep the call visible until sitd reports termination, return failures to the client, and avoid sending another hangup while release is pending.

The tests cover delayed replies, failed hangups, timeouts, disappearing calls, service loss, and GNOME Calls deleting an ended call immediately. They also wait for the private D-Bus socket to start listening, fixing an intermittent connection refusal found under load.

The package tests passed on the palmtop using a private bus and simulated modem; the ModemManager 1.24.2 API comparison passed against its upstream XML. The same call changes also passed simulated mmcli, GNOME Calls, and Chatty checks on the MMS stack. The updated bridge is running on the palmtop with the modem and sitd left online; a real carrier call has not yet been tested.

Both GitHub CI checks pass. A separate full package run on maclab found the D-Bus test race fixed here and an unrelated speaker-tuning import failure with Python 3.14's installed test package. The corrected modem package suite and a deliberately delayed D-Bus startup both pass on maclab.

What a hang-up that never completes meets today: omamobile-sitd answers the request as soon as it has sent the release, and when the call is still there 12 s later its own deadline turns the radio off and stops sitd for an attended reboot (unconfirmed_release() in omamobile-modem-sit). The bridge then withdraws the modem with its calls, so a second press within the bridge's 20 s window is InProgress, and after sitd has stopped there is no call object left to press on: the modem never gets a second hang-up. The 20 s window and the "a new press is a new attempt" behaviour apply to a sitd that stays up with the call still there; the tests cover both (a stand-in that stays up, and one that stops after the first hang-up).

Keep live calls visible until the modem reports termination, propagate hangup failures, and avoid duplicate release requests. Cover delayed replies and client deletion races.
Retry connection refusal while the test bus starts, and clean up the daemon when startup fails. Exercise delayed readiness and failure paths.
@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham. Keeping the call until sitd reports it terminated, and returning hangup failures to the client, is the right behaviour, and the tests cover the awkward cases well (a late reply, a confirmation before the reply, deleting after Hangup). The fix for the private bus starting under load is welcome too.

Since this is still a draft, a few notes for when you take it out:

  • Phone and Messages on my 7 Pro use omamobile-mmd as well, so this changes its hang-up path too. I agree with the reason, and from sitd's side the normal path completes the same way there. Still, a shared package that changes the 7 Pro gets a call on the 7 Pro before it merges, and I can't run that right now. So this waits for your real call on the 9a and then mine.
  • A question about a call that disappears from sitd while it's being released. The new test keeps it Active for good. On our sitd, a call leaves the list only through delete-call, which needs terminated, and a restart restores live calls. So a disappearance means the call has ended, and an object that stays Active would sit in the Phone app until mmd restarts. Is there a case I'm missing where sitd drops a call that's still up? If not, marking it terminated (and answering the delete with an error if you prefer) seems safer.
  • HangupAll now refuses with InProgress while a call is being placed. That's fine, but worth a line in the commit message.

Versions are mine at merge: the #371 stack also uses omamobile-mmd 0.1.3, so whichever lands second gets the next number.

…ete completes

sitd drops a call only after it has ended (delete-call needs terminated, and a restart restores live calls), so a call that disappears while a hangup is pending is over: mark it terminated and complete the client's Delete, instead of answering Failed and leaving the object Active until mmd restarts.
@W4HO-ham

W4HO-ham commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. On the call that disappears from sitd: you're right, sitd drops a call only after it has ended (delete-call needs terminated, and a restart restores live calls), so a call it no longer lists is over whatever our hangup did. fa87b08 marks it terminated, and the pending Delete then completes the normal way (the object is removed) instead of answering Failed and leaving an Active call in the Phone app until mmd restarts. The test now checks that: Delete completes with no error, the call is gone. The mmd tests pass (48).

HangupAll refusing with InProgress while a call is being placed: noted for the message; since the squash message is yours at merge, here is the line: "HangupAll refuses with InProgress while a call is still being placed, so a dial in flight is not torn down half-way."

The real call on the 9a is still owed; the palmtop is in a suspend series today, so it comes after.

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham. fa87b08 is exactly what I hoped for: a call sitd no
longer lists is over, so it's marked terminated and the pending Delete
completes, and the test now checks that the call is gone with no error. And
thanks for the line about HangupAll. I'll put it in the squash message.

One more question while this is a draft, before I try it on the 7 Pro.
After one hang-up fails, I don't think the user can hang up again.
releasing is set by the first Hangup, DeleteCall or HangupAll and
never cleared. So after sitd refuses a hang-up, or after the 20 s
confirmation timeout, a second Hangup answers InProgress for the rest of
the call, DeleteCall returns the cached error, and HangupAll skips the
call. The tests make this deliberate ("without retry"). Not sending a second
hang-up while the first is still outstanding is right. But once the first
has failed or timed out, pressing the red button again does nothing, and the
call goes on until the other side hangs up. Is there a reason sitd can't
take a new hang-up after it has answered the first with an error? If not,
I'd clear releasing when the reply is an error and when the confirmation
times out, so a new press from the user tries again, while the bridge still
never retries on its own.

A tiny one: fa87b08 dropped the blank line before
test_release_confirmation_can_arrive_before_hangup_reply.

The rest stands as before: your real call on the 9a, then mine on the 7 Pro,
and the version is mine at merge (0.1.3 is also #371's).

The releasing flag held for the rest of the call once a hang-up had failed or its confirmation had timed out, so a second press of the red button answered InProgress and the call ran on until the far end hung up. Now the flag clears when sitd answers the hang-up with an error and when the 20 s confirmation runs out, so each new Hangup, DeleteCall or HangupAll from the user is a new attempt, while the bridge still never retries on its own and still refuses a second hang-up while the first is outstanding. The cached error goes with it: the pending Delete gets its error directly. The tests say so, and the blank line before the confirmation-before-reply test is back.
@W4HO-ham

W4HO-ham commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, and done at c9619cc: releasing clears when sitd answers the hang-up with an error and when the 20 s confirmation runs out, so each new Hangup, DeleteCall or HangupAll from the user is a new attempt, while the bridge still never retries on its own and still answers InProgress to a second hang-up while the first is outstanding. The cached release_error went with it (nothing read it any more: the pending Delete gets its error directly). The tests now say so: a refused hang-up, then DeleteCall and HangupAll each send a new one and fail the same way, and a fourth press ends the call once sitd takes it; the timeout test ends with a new press that sends a second hang-up. The blank line is back. The real call on the 9a comes after today's sleep series on the palmtop, with the modem up from the boot unit.

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham, that was quick. A refused hang-up now leaves nothing
behind on any of the three paths, and the new test, which goes from a
refusal through a DeleteCall and a HangupAll to a press that works, shows it
well. The blank line is back too.

One more question while this is a draft, about the timeout half. Only
DeleteCall has the 20 s confirmation timer, but the Phone app hangs up with
Call.Hangup: omatel calls hangup() on the call and calls DeleteCall only
once the call reads terminated. In Call.Hangup, releasing clears only
when sitd answers with an error. sitd answers hangup as soon as it has
sent the release request, and its own 12 s deadline then turns the radio off
and keeps the call. So if a release is accepted but never completes, the
next press of the red button still answers InProgress and sends nothing. I
tried it with your harness: sitd's hangup returns {}, the call stays
active, and 22 s later a second Call.Hangup gets InProgress, while
HangupAll returns success without sending anything. The commit message
says the flag clears "when the 20 s confirmation runs out", but that's true
only after a DeleteCall.

Could Call.Hangup get the same 20 s timer? Or, if a second hang-up can't
help once sitd has gone radio-off, could the bridge keep the block and the
message say why? Either is fine with me, as long as the two agree. And a
smaller one: HangupAll reports success for a call it skipped because a
release is outstanding. Would InProgress there, as Call.Hangup gives,
be more honest?

A tiny test note: the refusal test's last step says "once sitd takes it, the
call ends", but it only counts the hang-ups. Pushing a terminated state and
checking that the call is gone would make it say what it means.

The rest stands: your real call on the 9a, then mine on the 7 Pro, and the
version is mine at merge (main has 0.1.3 since #371).

…All says when it skipped one

sitd answers a hang-up as soon as it has sent the release, and its own deadline then turns the radio off and keeps the call, so a release that was accepted but never completed left Call.Hangup blocked for the rest of the call. Now every hang-up, from Hangup, DeleteCall or HangupAll, holds the releasing flag for 20 s at most (one timer per call, ended by a reply, a terminated call or the call's deletion), after which a new press from the user is a new attempt; the bridge still never retries on its own. HangupAll answers InProgress instead of success for a call it skipped because its release is outstanding. The refusal test ends with the call terminated and gone, and a new test walks an accepted, unconfirmed hang-up through the window.
@W4HO-ham

W4HO-ham commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Done at 5359a66, the first way: every hang-up now opens the same 20 s window, whichever method sent it. start_release() sets the flag and one timer per call; a reply ends it (end_release()), so does the call's deletion, and when the window runs out the flag clears and the next press from the user is a new attempt, while the bridge still never retries on its own. DeleteCall's pending-delete timer stays as it was and now leans on the same window. HangupAll answers InProgress for a call it skipped because a release is outstanding, as Call.Hangup does (the old test that expected a silent success now expects that). The refusal test ends with sitd reporting the call terminated and the object gone, and a new test walks your case: hangup answered with {}, the call stays active, a second Call.Hangup and a HangupAll get InProgress, and after 21 s a press sends a second hang-up. The real call on the 9a is still ahead of me today (the palmtop is on a published-tip sleep run first).

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham. All three points are in, and I like how it came out:
one start_release and end_release for every caller is simpler than three
copies, HangupAll now says InProgress when it skipped a call, and the
refusal test ends with the call really gone. The new test follows the case I
tried step by step.

One thing I should have looked up myself last time, about what the second
attempt meets. In sitd the hang-up sets a 12 s deadline, and when it passes
with the call still there, unconfirmed_release() turns the radio off and
raises UnconfirmedRelease ("stopping sitd; attended reboot required"). So
in exactly the case this commit handles, sitd has already stopped by the
time the bridge's 20 s window opens, and the next press gets an error from a
closed socket rather than a second hang-up at the modem. I think the bridge
is still right as it is, since an error is more honest than InProgress
forever and the window does its job for a sitd that's alive. But the commit
message and the test, whose stand-in sitd stays up, read as if the modem
gets a second try. Could the message say what happens with today's sitd?
And when you do the real call on the 9a, I'd be glad to know what the Phone
app shows if you can provoke it safely; please don't force it if that means
risking a reset.

The rest stands: your real call on the 9a, then mine on the 7 Pro before it
merges. I'll set the version then (main has 0.1.3, and another open PR also
uses 0.1.4).

…nd test it

With today's sitd a hang-up whose call never ends doesn't reach the bridge's 20 s window: sitd's own 12 s deadline turns the radio off and stops it for an attended reboot, the bridge withdraws the modem with its calls, and the next press finds no call object, so the modem never gets a second hang-up. The window is for a sitd that stays up. The comment and the two tests whose stand-in sitd stays up now say so, and a new test stops the stand-in after the first hang-up.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

You're right, and it goes one step further than a closed socket. I read service.py (the 12 s hangup_deadline, then unconfirmed_release() and sitd stops) and tried it against the bridge: when sitd goes away the bridge withdraws the modem object with its calls, so the next press doesn't even reach the bridge's release window. It finds no call object (org.freedesktop.DBus.Error.UnknownMethod), and the modem never gets a second hang-up.

In 31be8e6e:

  • the commit message and the description say what happens with today's sitd, and that the 20 s window is for a sitd that stays up;
  • start_release's comment says the same, and the two tests whose stand-in sitd stays up are labelled as that;
  • a new test, test_unconfirmed_hangup_then_sitd_stops_takes_the_modem_and_the_call_away: one accepted hang-up, a second press is InProgress, the stand-in stops, the modem is withdrawn, a third press gets the error, and sitd saw one hang-up.

test/all passes. For the real call I'll note what the Phone app shows on an ordinary hang-up from each side; I won't try to provoke the unconfirmed release on the palmtop, since it ends in a radio-off and an attended reboot by design.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

The real call on the 9a (2026-11-09, 19:27 MST; omamobile-mmd 0.1.4 built from this branch before today's comment-and-test commit, omamobile-modem-sit 0.3.36, on 7.3.0-rc6-omamobile-push1-g773b4102f5ec with the modem on the in-tree drivers, #594). The owner called the palmtop from his own phone; a script on the palmtop drove the bridge over D-Bus and timed it:

19:27:09.040 call object /org/freedesktop/ModemManager1/Call/0, state 3 (ringing-in)
19:27:11.195 Accept
19:27:11.767 state 4 (active)
19:27:20.017 Hangup                      (returned without error)
19:27:20.029 second Hangup: Call failed: This call has ended
19:27:20.052 call object gone, 272 ms after the Hangup
19:27:20.066 DeleteCall: Call failed: No such call
19:27:21.084 ListCalls: empty

and the bridge's own log: incoming, ringing-in, ringing-in -> active, active -> terminated. So on an ordinary hang-up the modem's confirmation came well inside sitd's 12 s and the bridge's window: the first Hangup returned only once the call had ended (the second, 12 ms later, already got "This call has ended" rather than InProgress), the call went to terminated, and it had left the list before my DeleteCall, which got "No such call". The CP stayed ONLINE, sitd and the bridge stayed up, no UFS line.

What I can't give you tonight: the owner saw the palmtop's screen show the call being answered, but didn't listen or note what his phone showed at the end, and the hang-up was from the palmtop's side only. A hang-up from the far end, and the Phone app's own buttons instead of D-Bus calls, are still to do. I didn't try to provoke the unconfirmed release.

@W4HO-ham W4HO-ham mentioned this pull request Nov 10, 2026
10 of 14 tasks
@den-kloot

Copy link
Copy Markdown
Contributor

A second Pixel 9a, with real calls on a Luxembourg carrier (VoLTE), 2026-11-10.

Setup:

I (the owner) used the phone's own Phone app by hand. The agent read the journal afterwards.

1. Incoming call, hung up on the 9a:

12:43:17.564  Call/0: incoming, ringing-in
12:43:24.164  SIT AIMS_ANSWER: error=0
12:43:24.473  Call/0: ringing-in -> active          (309 ms after the answer)
12:43:43.228  SIT AIMS_HANGUP: error=0
12:43:43.454  Call/0: active -> terminated          (226 ms after the hangup)
12:43:43.462  omatel-agent: call logged

2. Outgoing call, the other side hung up:

12:44:06.504  Call/1: outgoing, unknown
12:44:07.098  SIT AIMS_DIAL: error=0
12:44:07.101  Call/1: unknown -> dialing
12:44:10.313  Call/1: dialing -> ringing-out
12:44:12.741  Call/1: ringing-out -> active
12:44:32.396  Call/1: active -> terminated
12:44:32.406  omatel-agent: call logged

Audio was fine both ways in both calls. The bridge and sitd logged no errors, no "went away" and no recovery. The call card closed on its own each time.

Not reproduced: an unconfirmed release. For the record, one happened on this phone earlier the same day with the packaged bridge, after a different failure: an incoming call at 11:00, 1 h 17 min into a boot, where the modem refused every AIMS_ANSWER (14 taps, all error=2) and the one AIMS_HANGUP (error=2). Then came "Call release not confirmed: hangup deadline expired", and the recovery turned the radio off and sitd stopped. It hasn't happened again since. I'm logging any repeat and will file it on its own if it does, since the answer refusal comes before anything this PR changes.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thank you, that covers the two cases I still owed here: a hang-up from the far end, and the Phone app's own buttons used by hand. Both on a second 9a and another carrier, with the call card closing by itself each time.

So the record for this branch is now: on my palmtop an incoming call answered and hung up locally, with a second Hangup answered "This call has ended"; on yours an incoming call hung up locally and an outgoing call ended by the other side, audio both ways. No unconfirmed release on either with this bridge.

The 11:00 call where the modem refused every AIMS_ANSWER with error=2 is worth its own issue when it repeats, as you say: the refusal comes before the bridge's release path, and this PR only changes what happens after it (the call object goes away with the modem instead of staying on the card). If you catch it again, sitd's lines from the incoming-call indication to the first refusal would show what state the modem thought the call was in.

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham, and thank you, @den-kloot, for the calls on a second
9a and another carrier. That covers what I still wanted to see from the 9a
side: a hang-up on the phone and one from the far end, through D-Bus and
through the Phone app's own buttons, with the call card closing by itself
and nothing left behind in the bridge or sitd.

The last commit says what I asked for. The docstring, the commit message and
the labels on the two stand-in tests now describe what today's sitd really
does, and the new test goes the step further that you found: when sitd stops,
the modem and its calls are withdrawn and the next press finds no call at
all. Thank you for reading service.py and trying it rather than taking my
word for it. Not provoking the unconfirmed release on the palmtop was the
right call.

The checks pass on this head and it merges cleanly onto today's main.

@den-kloot, the 11:00 call where the modem refused every AIMS_ANSWER with
error=2 does deserve its own issue if it comes back; as you both say, it
happens before anything this PR touches.

What's left is mine: one call each way on the Pixel 7 Pro, since the bridge
is shared and this changes its hang-up path there too. Could you mark the PR
ready for review in the meantime? I'll set the version when I merge (0.1.4
if this lands before #380, otherwise 0.1.5) and fix the title's number then.

@derekross

Copy link
Copy Markdown
Owner

My call on the Pixel 7 Pro is done, 2026-11-10: this head merged with today's main, omamobile-mmd 0.1.4 installed as a package, only omamobile-mmd restarted, modem and sitd up (7.3.0-rc6-omamobile-push1-gc7fb37460f84).

Call Hung up by The bridge's log On the phone
Outgoing, answered the 7 Pro dialing → ringing-out → active → terminated the call screen closed cleanly
Incoming, answered the far end ringing-in → active → terminated the same

No traceback, no unconfirmed release, no radio-off in the bridge's or sitd's log.

One thing I ran into, not caused by this PR: building the package on the phone, test/all failed in check(), and not the same way twice (once on a list of modem interfaces, once test_enable_goes_to_sitd_radio with an IndexError on named('StateChanged')[-1], a test that is on main since 0.1.2). Both pass here on x86 and in CI, so they look like waits that are too short for the phone; I installed with --nocheck. If you have a moment, a wait_until in that test would stop it biting the next person who builds on a phone, but it doesn't hold this up.

That was the last open point on my side. When you take it out of draft I'll merge it; the version is set at merge (0.1.4 if this lands before #380, otherwise 0.1.5), and I'll fix the title's number then.

@W4HO-ham
W4HO-ham marked this pull request as ready for review November 10, 2026 20:27
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thank you for the two calls. It is out of draft.

The check() failures on the phone: #638. Three tests in test_bridge.py wait for a property and then read the recorded signals at once, and a property read can return before the main loop has handed the client the signals sent with it. Pinned to one loaded core on the laptop every run failed in one of those three (yours were two of them: the interface list is test_sim_appears_later, the IndexError is test_enable_goes_to_sitd_radio; the third is test_sitd_going_away_and_coming_back). With a wait on the signal itself ten loaded runs in a row pass. It is tests only and separate from this change, so it doesn't touch the head you tested.

@derekross

Copy link
Copy Markdown
Owner

Thank you, @W4HO-ham, for taking it out of draft, and for #638. I've been
through that one: it covers both failures I had when building on the phone,
and it merges cleanly with this in either order.

Nothing is left here. The head is the one I tested on the Pixel 7 Pro this
afternoon (a call each way, each ending active -> terminated with the
call screen closing by itself), the checks pass, and main hasn't touched
omamobile-mmd since you merged it in, so what lands is what I ran.

Merging as omamobile-mmd 0.1.4 (main is at 0.1.3 and nothing else has
taken 0.1.4), with the title's number fixed in the squash subject. Thank
you for the patience over five rounds, and thank you again, @den-kloot, for
the calls on the second 9a.

@derekross
derekross merged commit 90ee7f3 into derekross:main Nov 11, 2026
2 checks passed
derekross pushed a commit that referenced this pull request Nov 11, 2026
Three tests in test_bridge.py waited for a property and then read the client's recorded signals at once. A property read can return before the main loop has delivered the signals sent with it, so on a slow machine (seen building the package on a Pixel 7 Pro, #461) test_sim_appears_later saw one InterfacesAdded of four and test_enable_goes_to_sitd_radio raised IndexError. Each now waits for the signal it checks, through one helper. Tests only, no version change.
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…kross#461)

A hang-up no longer removes the call object when sitd accepts the request: the call stays until sitd reports it terminated or stops listing it, each hang-up gets one 20 s release window, and Hangup and HangupAll answer InProgress while one is outstanding. A refused or unconfirmed hang-up lets the user try again, and when sitd goes away the modem and its calls are withdrawn.

Tested with real calls on two Pixel 9as and on a Pixel 7 Pro on 2026-11-10 (an outgoing call hung up locally, an incoming one hung up by the far end).
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…ross#638)

Three tests in test_bridge.py waited for a property and then read the client's recorded signals at once. A property read can return before the main loop has delivered the signals sent with it, so on a slow machine (seen building the package on a Pixel 7 Pro, derekross#461) test_sim_appears_later saw one InterfacesAdded of four and test_enable_goes_to_sitd_radio raised IndexError. Each now waits for the signal it checks, through one helper. Tests only, no version change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants