mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05: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_bt_telephony_ag *telephony_ag;
 | 
				
			||||||
	struct spa_list hfp_hf_commands;
 | 
						struct spa_list hfp_hf_commands;
 | 
				
			||||||
	struct spa_list updated_call_list;
 | 
						struct spa_list updated_call_list;
 | 
				
			||||||
 | 
						char *dialing_number;
 | 
				
			||||||
#endif
 | 
					#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);
 | 
						rfcomm_send_cmd(rfcomm, "ATD%s;", number);
 | 
				
			||||||
	res = hfp_hf_wait_for_reply(rfcomm, reply, sizeof(reply));
 | 
						res = hfp_hf_wait_for_reply(rfcomm, reply, sizeof(reply));
 | 
				
			||||||
	if (res && spa_strstartswith(reply, "OK")) {
 | 
						if (res && spa_strstartswith(reply, "OK")) {
 | 
				
			||||||
		struct spa_bt_telephony_call *call;
 | 
							if (rfcomm->dialing_number)
 | 
				
			||||||
		call = hfp_hf_add_call(rfcomm, rfcomm->telephony_ag, CALL_STATE_DIALING, number);
 | 
								free(rfcomm->dialing_number);
 | 
				
			||||||
		*err = call ? BT_TELEPHONY_ERROR_NONE : BT_TELEPHONY_ERROR_FAILED;
 | 
							rfcomm->dialing_number = strdup(number);
 | 
				
			||||||
 | 
							*err = BT_TELEPHONY_ERROR_NONE;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		spa_log_info(backend->log, "Failed to dial: \"%s\"", number);
 | 
							spa_log_info(backend->log, "Failed to dial: \"%s\"", number);
 | 
				
			||||||
		if (res)
 | 
							if (res)
 | 
				
			||||||
| 
						 | 
					@ -2260,8 +2262,12 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (!found && !rfcomm->hfp_hf_clcc) {
 | 
										if (!found && !rfcomm->hfp_hf_clcc) {
 | 
				
			||||||
						spa_log_info(backend->log, "Dialing call");
 | 
											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");
 | 
												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) {
 | 
									} else if (value == CIND_CALLSETUP_ALERTING) {
 | 
				
			||||||
					struct spa_bt_telephony_call *call;
 | 
										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");
 | 
										spa_log_warn(backend->log, "failed to create call");
 | 
				
			||||||
				else if (call->id != idx)
 | 
									else if (call->id != idx)
 | 
				
			||||||
					spa_log_warn(backend->log, "wrong call index: %d, expected: %d", 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 {
 | 
							} else {
 | 
				
			||||||
			spa_log_warn(backend->log, "malformed +CLCC command received from AG");
 | 
								spa_log_warn(backend->log, "malformed +CLCC command received from AG");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue