--- v1->v2: - Use first available index of call for new call profiles/audio/hfp-hf.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/profiles/audio/hfp-hf.c b/profiles/audio/hfp-hf.c index 0fae3cd6f..ad759b8c3 100644 --- a/profiles/audio/hfp-hf.c +++ b/profiles/audio/hfp-hf.c @@ -565,10 +565,26 @@ static void ciev_call_cb(uint8_t val, void *user_data) dev->call = !!val; - if (dev->call == TRUE) - g_slist_foreach(dev->calls, activate_calls, dev); - else + if (dev->call == TRUE) { + if (dev->calls == NULL) { + /* Create already active call during SLC */ + struct call *call; + uint8_t idx = next_index(dev); + + call = telephony_new_call(dev->telephony, idx, + CALL_STATE_ACTIVE, + NULL); + if (telephony_call_register_interface(call)) { + telephony_free_call(call); + return; + } + dev->calls = g_slist_append(dev->calls, call); + } else { + g_slist_foreach(dev->calls, activate_calls, dev); + } + } else { g_slist_foreach(dev->calls, deactivate_active_calls, dev); + } } static void callsetup_deactivate(gpointer data, gpointer user_data) -- 2.43.0