> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perform Bluetooth HFP client functions

> You can perform HFP client functions using the ``bluetoothctl`` menu and ``ofono/test`` tools. Bluetooth HFP client functions include connecting or disconnecting to a remote device and managing phone calls over Bluetooth. You can dial a phone number, answer or reject incoming calls, and list active calls using HFP client functions.

## Prerequisites

Before you begin, <a href="verify-hfp-functions#set-up-the-device-for-hfp-functions" target="_self">set up your device</a> and <a href="verify-hfp-functions#configure-the-dut-for-hfp-client-functions" target="_self">configure the DUT for HFP client functions</a>.

## Connect a remote device

To connect a remote device, run the following command from the `bluetoothctl` menu:

```text theme={null}
connect <bt_address>
```

**Parameters**

`<bt_address>` is the Bluetooth address of the remote device.

**Example**

To connect to a paired remote device with `<bt_address>` `F8:7D:76:9D:9B:6B`, run the following command:

```text theme={null}
connect F8:7D:76:9D:9B:6B
```

**Sample output**

```text theme={null}
[bluetooth]# connect F8:7D:76:9D:9B:6B
Attempting to connect to F8:7D:76:9D:9B:6B
(CHG) Device F8:7D:76:9D:9B:6B Connected: yes
[NEW] Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep3
[NEW] Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep4
[NEW] Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep5
[NEW] Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep6
(NEW) Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep1
(NEW) Endpoint /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep2
[NEW] Transport /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/sep1/fd0
Connection successful
[NEW] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 [default]
[NEW] Item /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0/Filesystem /Filesystem
[NEW) Item /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0/NowPlaying /NowPlaying
[CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Type: Audio
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Subtype: None
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Status: stopped
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Browsable: yes
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Searchable: yes
[CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Playlist: /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0/NowPlaying
(CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Name: Music
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Repeat: off
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Shuffle: off
[NEW] Folder /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0
[CHG] Device F8:7D:76:9D:9B:6B ServicesResolved: yes
(CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Duration: 0x00000000 (0)
(CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Genre:
[CHG] Player /org/blwez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Title:
[CHG] Player /org/blwez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Item: /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player@/NowPlaying/item18446749073709551615
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 TrackNumber: 0x00000000 (0)
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Artist:
(CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 NumberOfTracks: 0x00000000 (0)
[CHG) Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Album:
[NEW] Item /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0/NowPlaying/item18446744073709551615 <unknown>
[CHG] Player /org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/player0 Position: 0x00000000 (0)
[MyDeviceA]#
```

## Dial a phone number

To dial a phone number, run the following command from the `ofono/test` menu:

```text theme={null}
./dial-number <phone_number>
```

**Parameters**

`<phone_number>` is the phone number that you want to dial.

**Sample output**

```text theme={null}
sh-5.1# ./dial-number 7123456789
Using modem /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B
/hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/voicecall01
sh-5.1#
```

## Answer an incoming call

To answer an incoming call, run the following command from the `ofono/test` menu:

```text theme={null}
./answer-calls
```

**Sample output**

```text theme={null}
sh-5.1# ./answer-calls
[ /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B ]
[ /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/voicecall01 ] incoming
sh-5.1# |
```

<Note>
  If you are on a call, an echo is audible. This is a known behavior in software with a BlueZ stack.
</Note>

## List active calls

To list the active calls, run the following command from the `ofono/test` menu:

```text theme={null}
./list-calls
```

**Sample output**

```text theme={null}
sh-5.1# ./list-calls
[ /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B ]
[ /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/voicecall01 ]
      State = incoming
      LineIdentification = +917123456789
      Name =
      Multiparty = 0
      RemoteHeld = 0
      RemoteMultiparty = 0
      Emergency = 0
```

## Reject or disconnect a call

To reject or disconnect a call, run the following command from the `ofono/test` menu:

```text theme={null}
./hangup-call <call_path>
```

**Parameters**

`<call_path>` is the call path of the active call.

**Example**

To hang up a call with the path `/hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/voicecall01`, run the following command:

```text theme={null}
./hangup-call /hfp/org/bluez/hci0/dev_F8_7D_76_9D_9B_6B/voicecall01
```

## Disconnect a remote device

To disconnect a remote device, run the following command from the `bluetoothctl` menu:

```text theme={null}
disconnect <bt_address>
```

**Parameters**

`<bt_address>` is the Bluetooth address of the remote device.

**Example**

To disconnect a paired remote device with `<bt_address>` `F8:7D:76:9D:9B:6B`, run the following command:

```text theme={null}
disconnect F8:7D:76:9D:9B:6B
```

**Sample output**

```text theme={null}
[MyDeviceA]# disconnect
Attempting to disconnect from F8:7D:76:9D:9B:6B
[CHG] Device F8:7D:76:9D:9B:6B ServicesResolved: no
Successful disconnected
[CHG] Device F8:7D:76:9D:9B:6B Connected: no
[bluetooth]#
```
