Enabling Hands-Free Profile on Raspberry Pi (Raspbian Stretch) by using PulseAudio

The purpose of this post is to enable Bluetooth Handsfree Profile (HFP) with PulseAudio on Raspbian Stretch so that Raspberry Pi can act like as a handsfree speaker phone or a handsfree car kit. This is an updated version of this post. When I wrote the previous post, I was using Raspbian Jessie and some steps needed to be updated to apply Raspbian Stretch.

There is one thing needs to be mentioned before start. The original plan was to use Raspberry Pi3’s on-board Bluetooth chip for this project. Unfortunately, it didn’t work. It seems that the problem is related with the chip. So, we have to use a Bluetooth dongle instead.


Here is the list of contents of this post.

– Prerequisites
– Steps
1. Preparations
2. oFono Installation
3. PulseAudio Installation & Settings
4. Connecting Your Phone
5. Making a Call
– Summary
– Reference



Below are the required application versions to enable Bluetooth HFP according to PulseAudio release note.

  • Bluez 5.0 or later (v5.43 is pre-installed in Stretch)
  • PulseAudio 6.0 or later (not pre-installed in Stretch, but it supports v10.0)
  • oFono 1.13 or later (not pre-installed in Stretch, but it supports v1.18)


1. Preparations
1-1. Connect Bluetooth dongle and USB sound card with Raspberry Pi.
1-2. Connect the microphone and speakers to 3.5 mm audio jacks on the USB sound card.
1-3. Boot up Raspberry Pi Board.
1-4. As described, we don’t use on-board Bluetooth chip. So we’ll disable it. To do that, open “/etc/modprobe.d/raspi-blacklist.conf”.

1-5. Add lines below and save.

1-6. According to a Raspberry Pi Foundation blog post, Bluetooth audio is handled by ALSA through bluez-alsa in Stretch. However, since in this post we are using PulseAudio, let’s uninstall bluez-alsa.

1-7. Then reboot the board.

1-8. After reboot, check dmesg and make sure there is no Bluetooth-related errors.

1-9. Also, make sure hci0 is UP.

The result should be like this:

If it’s DOWN for some reason, then turn it up.


2. oFono Installation
2-1. oFono is not installed by default, so let’s install it.

2-2. Make sure if it’s successfully installed.

2-2. Then, start the service.

You can check the service running like below.


3. PulseAudio Installation & Settings
3-1. In Raspbian Stretch, PulseAudio is not pre-installed. Install PulseAudio and its Bluetooth module:

3-2. Check the version. It should be v10.0 (or higher).

3-3. Open “/etc/pulse/default.pa”.

3-4. Add “headset=ofono” on the line of ‘module-bluetooth-discover’.

3-5. Restart Raspberry Pi.


4. Connecting Your Phone
4-1. Launch bluetoothctl.

4-2. Then, input below commands.

4-3. Start searching your phone. Make sure your phone is discoverable.

4-4. After detecting your phone, turn scan off.

devices command shows a list of found devices.

4-5. Then, pair, trust and connect to your phone by specifying the Bluetooth device address (in this case it’s “XX:XX:XX:XX:XX:XX”, please replace it wity your device’s address).

If everything is ok, you should see “successful” at the end of the result for each command like below.


5. Making a Call
To make a call, you can use oFono test scripts which is included in the source code.
5-1. First, download the source and extruct.

5-2. Then, you can make a call by:

If you want to end the call, then type:


Since Raspbian Stretch supports PulseAudio v10.0, the steps are now a little simpler than previous one. I confirmed both sending and receiving audio are fine during a hands free call. I confirmed Bluetooth audio streaming (A2DP) is working too.

Update (May 2, 2018):
The steps to enable equalizer on HFP sending audio is newly posted.



–¬†Raspbian Stretch has arrived for Raspberry Pi

– Connect Bluetooth Headset To Raspberry Pi 3 (A2DP & HSP)

– PulseAudio 6.0 Release Notes –freedesktop.org

– PulseAudio Documentation –freedesktop.org




    1. Hi Tony. It’s always assigned to index 1 and default without any additional configuration in my case. Maybe because it’s the only connected card (except the on-board sound card)?

    1. Hi Jack,
      What I did was after the BT connection is up (step 4-5), I just opened a music app on my phone (e.g. Pandora). Are you having a problem with A2DP streaming?

    1. I think it should be technically possible, but not sure. I believe Bluetooth earpieces support only HF role, so, Raspberry Pi needs to be configured as AG role. According to freedesktop.org, PulseAudio 11 supports HFP AG role. So, you need to figure out how to install Pulseaudio 11 and how to configure as AG. Also, I’m not sure how to control SCO connection (HFP Audio connection) using Bluez/Pulseaudio/Ofono.

  1. Hello,

    This setup worked for me. Now I’m trying to configure an equalizer, I’ve tried PulseAudio first, no luck, and now I’m trying Alsa Equal, based on LADSPA, its not working on raspberry either: the .asoundrc is being overwritten every reboot, I guess my configuration is not ok.
    Which one is the right (or better) one to setup? Alsa Equal or PulseAudio equalizer? (based on this tutorial).
    I need to know in which one of these I must spend more time to make it work.

      1. Hello Max!

        You are amazing! Thanks for sharing this! Your HSP / HFP tutorial worked very well.
        Unfortunately the equalizer post (which I’ve followed) didn’t worked for me. I’ll check later if its something related to my setup, or if just works with HFP, and not with A2DP. I’m trying to find a system-wide equalizer, which works for every sound. If it is not possible, then at least A2DP would be nice.

        1. I was basically focusing on HFP and the steps in yesterday’s post applies the equalizer only on HFP sending signal. For a system-wide equalizer, you need to modify the sound routing. But if you don’t need HFP, bluealsa (instead of pulseaudio) + alsa equal-plugin might be straightforward.

  2. Hi Max,

    Thank you for taking the time to figure all of this out. I wonder if you have some ideas about the following project I’m trying to suss out:

    I’m part of a motorcycle touring group and we are struggling with the limitations of the current batch of Bluetooth intercom headsets available on the market. To complicate matters, many of my group use HAM radios with HFP -> GMRS/HAM PTT adapters. The problem with most of our setups is that it relies on the bluetooth headset mounted on our helmets to prioritize the audio of the connected devices. Since our headsets can only connect to TWO devices in total, if one of them is a HFP/HSP (which is what the adapter that connects to the GMRS/HAM radio uses) this connection will never let go of the connection which in turn prevents the other device that is normally used to stream A2DP music from ever being heard.

    What we would like to happen: multiple HFP/HSP and A2DP connected audio sources being “mixed” at the same level (and maybe with adjustable volume levels so if nothing is coming in on say the GMRS/HAM adapter it could be set as a higher volume to “override” the music.

    We would obviously need to connect to the helmet’s Bluetooth headset for the Mic and audio to be heard.

    My thought (and why I landed here) was that we could leverage a RPI3 as some sort of “Bluetooth Mixer”. The nice thing about the RPI3 is that it has a stack of 4 USB ports…to connect multiple bluetooth dongles to.

    So…this is what this monstrosity might look like:

    Helmet Sena 20s RPI3 BT dongle 1
    Sena SR10 (can only connect using HFP/HSP) RPI3 BT dongle 2
    Garmin Zumo 595LM RPI3 BT dongle 3

    Is it even possible to take multiple BT connected A2DP / HFP / HSP streams and mix them all together and then hear them through a BT headset using the RPi3?


    Thanks again for taking the time.

    1. Hi Dan, sounds an interesting project!
      It’s possible to mix multiple BT sources on RPi (using ALSA/PulseAudio/etc). I think also possible to send it to another BT device through A2DP. (RPi –> Sena S20)
      However, if you want to use mic on Sena S20, the connection between Sena S20 and RPi must be HFP. So, the mixed signal (Sena SR10 + Garmin Zumo 595LM) should be sent over HFP, not A2DP. It can be tricky. Maybe I can do some experiment this weekend…

Leave a Reply

Your email address will not be published. Required fields are marked *