mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
bluez5: backend-native: Fix incorrect dial number management
When dialing an incorrect phone number some phones (e.g. iOS 18.5) replies with OK but never send +CIEV updates, so there's no way to know that the dial is not in progress and the call object should be removed. This change waits for +CIEV event to create the call object.
This commit is contained in:
parent
2581575bd1
commit
80d44e8f39
1 changed files with 15 additions and 4 deletions
|
|
@ -222,6 +222,7 @@ struct rfcomm {
|
|||
struct spa_bt_telephony_ag *telephony_ag;
|
||||
struct spa_list hfp_hf_commands;
|
||||
struct spa_list updated_call_list;
|
||||
char *dialing_number;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -1623,9 +1624,10 @@ static void hfp_hf_dial(void *data, const char *number, enum spa_bt_telephony_er
|
|||
rfcomm_send_cmd(rfcomm, "ATD%s;", number);
|
||||
res = hfp_hf_wait_for_reply(rfcomm, reply, sizeof(reply));
|
||||
if (res && spa_strstartswith(reply, "OK")) {
|
||||
struct spa_bt_telephony_call *call;
|
||||
call = hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_DIALING, number);
|
||||
*err = call ? BT_TELEPHONY_ERROR_NONE : BT_TELEPHONY_ERROR_FAILED;
|
||||
if (rfcomm->dialing_number)
|
||||
free(rfcomm->dialing_number);
|
||||
rfcomm->dialing_number = strdup(number);
|
||||
*err = BT_TELEPHONY_ERROR_NONE;
|
||||
} else {
|
||||
spa_log_info(backend->log, "Failed to dial: \"%s\"", number);
|
||||
if (res)
|
||||
|
|
@ -2260,8 +2262,12 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
|
|||
|
||||
if (!found && !rfcomm->hfp_hf_clcc) {
|
||||
spa_log_info(backend->log, "Dialing call");
|
||||
if (hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_DIALING, NULL) == NULL)
|
||||
if (hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_DIALING, rfcomm->dialing_number) == NULL)
|
||||
spa_log_warn(backend->log, "failed to create dialing call");
|
||||
if (rfcomm->dialing_number) {
|
||||
free(rfcomm->dialing_number);
|
||||
rfcomm->dialing_number = NULL;
|
||||
}
|
||||
}
|
||||
} else if (value == CIND_CALLSETUP_ALERTING) {
|
||||
struct spa_bt_telephony_call *call;
|
||||
|
|
@ -2478,6 +2484,11 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
|
|||
spa_log_warn(backend->log, "failed to create call");
|
||||
else if (call->id != idx)
|
||||
spa_log_warn(backend->log, "wrong call index: %d, expected: %d", call->id, idx);
|
||||
|
||||
if (spa_streq(number, rfcomm->dialing_number)) {
|
||||
free(rfcomm->dialing_number);
|
||||
rfcomm->dialing_number = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
spa_log_warn(backend->log, "malformed +CLCC command received from AG");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue