diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index 88b88484a..6357ae1d7 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -1740,6 +1740,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con case HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE: case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE: + case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: hfp_gsm_handler(HFP_AG_TERMINATE_CALL_BY_AG, 0, 0, NULL); hfp_ag_set_callsetup_indicator(); hfp_ag_trigger_reject_call(); diff --git a/src/classic/hfp_gsm_model.c b/src/classic/hfp_gsm_model.c index dc60b38a1..2ce686904 100644 --- a/src/classic/hfp_gsm_model.c +++ b/src/classic/hfp_gsm_model.c @@ -496,7 +496,13 @@ void hfp_gsm_handler(hfp_ag_call_event_t event, uint8_t index, uint8_t type, con case HFP_AG_TERMINATE_CALL_BY_AG: set_callsetup_status(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS); - delete_call(current_call_index); + if (current_call_index != -1){ + delete_call(current_call_index); + break; + } + if (initiated_call_index != -1){ + delete_call(initiated_call_index); + } break; case HFP_AG_CALL_DROPPED: