From a8363ff92b6a7ccb91867e34f44d5b6f89556150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Mon, 14 Oct 2024 09:54:39 +0200 Subject: [PATCH] bluez5: backend-native: Fix dialing call-setup management The call should be created if it is started from the phone, i.e. if it doesn't yet exist. --- spa/plugins/bluez5/backend-native.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c index b837900f3..3557a6c66 100644 --- a/spa/plugins/bluez5/backend-native.c +++ b/spa/plugins/bluez5/backend-native.c @@ -1894,6 +1894,23 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token) if (hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_INCOMING, NULL) == NULL) spa_log_warn(backend->log, "failed to create incoming call"); } + } else if (value == CIND_CALLSETUP_DIALING) { + struct spa_bt_telephony_call *call; + bool found = false; + + spa_list_for_each(call, &rfcomm->telephony_ag->call_list, link) { + if (call->state == CALL_STATE_DIALING || call->state == CALL_STATE_ALERTING) { + spa_log_info(backend->log, "dialing call already in progress (%d)", call->state); + found = true; + break; + } + } + + if (!found) { + spa_log_info(backend->log, "Dialing call"); + if (hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_DIALING, NULL) == NULL) + spa_log_warn(backend->log, "failed to create dialing call"); + } } else if (value == CIND_CALLSETUP_ALERTING) { struct spa_bt_telephony_call *call; spa_list_for_each(call, &rfcomm->telephony_ag->call_list, link) {