callmanager: End calls when the radio is turned off
PATCH 1/1 callmanager: End calls when the radio is turned off
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).
--- src/callmanager.cpp | 6 ++++++ src/callmanager.h | 3 +++ src/phonesim.cpp | 11 +++++++++++ 3 files changed, 20 insertions(+)
src/callmanager.cpp +6 -0
@@ -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();
src/callmanager.h +3 -0
@@ -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 );
src/phonesim.cpp +11 -0
@@ -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(); + } }
Signature · 1 line
2.53.0