hfp: Synchronize call state in case of +CHUP error
authorKuba Pawlak <kubax.t.pawlak@intel.com>
Wed, 5 Aug 2015 12:36:09 +0000 (14:36 +0200)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 5 Aug 2015 16:15:33 +0000 (11:15 -0500)
It is possible for the phone to accept Dial request
but not actually dial. This leaves a voicecall object
in state 'dialling' that cannot be removed.
Proposed workaround is to trigger AT+CLCC when an error
is returned for Hangup. As the call is not on the list,
this would remove this hanging object and signal CallRemoved.

Windows Phone trace with this fix:
ofonod[273]: > ATD1;\r
ofonod[273]: < \r\nOK\r\n
ofonod[273]: src/voicecall.c:dial_handle_result() Registering new call: 1
ofonod[273]: < \r\n+CIEV: 5,4\r\n
ofonod[273]: src/network.c:ofono_netreg_strength_notify() strength 80
ofonod[273]: > AT+CHUP\r
ofonod[273]: < \r\nERROR\r\n
ofonod[273]: src/voicecall.c:generic_callback() command failed with error: Unknown error type
ofonod[273]: > AT+CLCC\r
ofonod[273]: < \r\nOK\r\n
ofonod[273]: src/voicecall.c:ofono_voicecall_disconnected() Got disconnection event for id: 1, reason: 2

drivers/hfpmodem/voicecall.c

index e3e6e0f5eccbbd61972c4b823c8093dd227e4bb9..f1e9096940328f05415cf5a6f3bed9ceaf447fe3 100644 (file)
@@ -333,6 +333,10 @@ static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
                }
        }
 
+       if (!ok && vd->calls)
+               g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
+                                       clcc_poll_cb, req->vc, NULL);
+
        req->cb(&error, req->data);
 }