From: Herman van Hazendonk <github.com@herrie.org>
To: ofono@lists.linux.dev
Cc: Marcel Holtmann <marcel@holtmann.org>, Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH phonesim] callmanager: End calls when the radio is turned off
Date: Sat, 14 Nov 2026 07:05:54 +0100 [thread overview]
Message-ID: <20261114060554.4104107-1-github.com@herrie.org> (raw)
AT+CFUN=4 only switched off registration, so calls that were up stayed
up with the radio off. A real modem ends them, and oFono does not end
them on its own: it waits for the modem to report it, so it went on
showing calls that could no longer exist.
Once a rule has answered an AT+CFUN=<fun> with <fun> other than 1, hang
up every call from the network side, the way the GUI's remote hangup
does: *ECAV with the call ended and NO CARRIER for each, after which
oFono queries AT+CLCC and drops them. The rule's response has been
written by then, so the NO CARRIERs follow the OK and are not taken
for the final response to AT+CFUN. AT+CFUN? and AT+CFUN=? are left
alone, and so is a CFUN no rule accepts (default.xml has none for
CFUN=0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
src/callmanager.cpp | 6 ++++++
src/callmanager.h | 3 +++
src/phonesim.cpp | 11 +++++++++++
3 files changed, 20 insertions(+)
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 40f9b3b..f1c0385 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -478,6 +478,12 @@ void CallManager::hangupRemote( int id )
}
}
+void CallManager::hangupAllRemote()
+{
+ while ( !callList.isEmpty() )
+ hangupRemote( callList.constFirst().id );
+}
+
bool CallManager::acceptCall()
{
int id = idForIncoming();
diff --git a/src/callmanager.h b/src/callmanager.h
index a39f484..93381db 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -109,6 +109,9 @@ public slots:
// Simulate a remote hangup.
void hangupRemote( int id );
+ // Simulate a remote hangup of every call, as when the radio goes off.
+ void hangupAllRemote();
+
signals:
// Send a response to a command.
void send( const QString& line );
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 89d5e9d..994031c 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -1182,6 +1182,17 @@ void SimRules::command( const QString& cmd )
respond( "ERROR" );
}
+ } else if ( cmd.startsWith( "AT+CFUN=" ) ) {
+
+ // A real modem ends every call when its radio is turned off, and
+ // oFono waits for it to do so. The rule has answered by now, so
+ // the NO CARRIERs cannot be taken as the final response to AT+CFUN.
+ bool ok;
+ int fun = cmd.mid( 8 ).section( ',', 0, 0 ).toInt( &ok );
+
+ if ( ok && fun != 1 )
+ _callManager->hangupAllRemote();
+
}
}
--
2.53.0
reply other threads:[~2026-11-14 6:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261114060554.4104107-1-github.com@herrie.org \
--to=github.com@herrie.org \
--cc=denkenz@gmail.com \
--cc=marcel@holtmann.org \
--cc=ofono@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.