NorbertH
Posts: 9
Joined: Fri Jan 02, 2015 10:09 am
Location: Germany
Contact: Website

Bluetooth HFP

Sun Jan 18, 2015 3:23 pm

Hi there,

did someone ever had success in connecting a raspberry pi via Bluetooth (HFP - hands-free-profile) with a smartphone and has established incoming or outgoing phone calls?

I've installed Bluez and Ofono and finally had success in pairing my phone and the raspberry pi. But when I call ofono's enable-modem python script, the ofono daemon crashes with a segfault and the phone shows a 'voice connected' indication on the Bluetooth screen.

ofono: 1.6-2
bluez: 4.99-2

Cheers,
Norbert

Jawjan
Posts: 2
Joined: Thu Feb 26, 2015 7:47 pm

Re: Bluetooth HFP

Thu Feb 26, 2015 7:50 pm

Hi,
I'am trying since 2 days to communicate with the raspberry Pi using the protocol HFP without succes.
Please let us know if you found a solution

Best regards

nautiyal-ashish
Posts: 2
Joined: Wed Jul 15, 2015 5:25 pm

Re: Bluetooth HFP

Wed Jul 15, 2015 5:42 pm

Hi,
i was also trying the same with HFP nohands.
Please let us know if someone was successfully able to do.
Thanks in Advance.

NorbertH
Posts: 9
Joined: Fri Jan 02, 2015 10:09 am
Location: Germany
Contact: Website

Re: Bluetooth HFP

Sun Nov 15, 2015 3:56 pm

Finally I made it work!

The solution was: Ofono and Bluez from Rasbian Jessie and Pulseaudio Version 6 or 7 compiled from the sources. The Pulseaudio package that is bundled within Jessie does NOT work!

It plays nicely in my Raspberry Pi telephone project. You can see the sources and give it a try here:
https://github.com/long-exposure/potsbliz-src

Cheers,
Norbert

User avatar
Douglas6
Posts: 4994
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth HFP

Sun Nov 15, 2015 4:20 pm

Nice job. I appreciate the success report.

Irvaan Sid
Posts: 10
Joined: Tue Jun 06, 2017 11:43 am

Re: Bluetooth HFP

Wed Jun 07, 2017 6:56 pm

I want to implement bluetooth headset profile and Hands-free profile in raspberry pi 3. I had successfully connected(via bluetooth) my raspberry pi3 with a bluetooth headset(with built-in microphone). And also a USB microphone is attached to pi. Is it possible to transfer audio to and from raspberry pi?? I want to hear audio (in live) from headset microphone at pi's audio out and also hear audio from USB microphone at headset out. Same for the Handsfree profile. In handsfree profile I want to speak and hear sound from pi(not from phone). Is there any way to stream live audio between pi and mobile phone??Currently I'm using Bluez,Pulseaudio and Ofono. I had already implemented A2DP profile with pulseaudio. and also basic phone operations are perfectly working with ofono. The main problem is with the audio flow to and from pi. Googled and tried a lot, nothing works as expected.
Please help..

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: Bluetooth HFP

Wed Jun 07, 2017 7:56 pm

Based on my experience and what I've read from other people testing, HFP does not work with the onboard Bluetooth interface on the Pi3B. You will likely need a separate USB Bluetooth adapter.

Irvaan Sid
Posts: 10
Joined: Tue Jun 06, 2017 11:43 am

Re: Bluetooth HFP

Thu Jun 08, 2017 3:54 am

Is there any way to implement HSP profile with built-in bluetooth in raspberry pi 3??

I also tried that, but failed.

Irvaan Sid
Posts: 10
Joined: Tue Jun 06, 2017 11:43 am

Re: Bluetooth HFP

Thu Jun 08, 2017 6:09 am

I connect pi to my phone and made a call using some ofono scripts ... But no audio is coming from pi's out. From pulseaudio -vvv, I got the following:

D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 68.57 ms + 0.00 ms + 25.00 ms = 93.57 ms
D: [pulseaudio] module-loopback.c: Should buffer 23376 bytes, buffered at minimum 0 bytes
I: [pulseaudio] module-loopback.c: New rate of 43516 Hz not within 2‰ of 43834 Hz, forcing smaller adjustment
D: [pulseaudio] module-loopback.c: [alsa_output.0.analog-stereo] Updated sampling rate to 43746 Hz.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 34.00 ms + 19960.08 ms + 0.00 ms = 19994.08 ms
D: [pulseaudio] module-loopback.c: Should buffer 100 bytes, buffered at minimum 161122 bytes
W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (8000 vs. 16051).
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.

D: [pulseaudio] device-port.c: Setting port phone-output to status unknown
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio] device-port.c: Setting port phone-input to status unknown
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
I: [pulseaudio] module.c: Unloading "module-loopback" (index: #24).
I: [pulseaudio] module.c: Unloaded "module-loopback" (index: #24).
I: [pulseaudio] module.c: Unloading "module-loopback" (index: #27).
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)
D: [pulseaudio] flist.c: pulsecore/memblockq.c: list_items flist is full (don't worry)

I: [pulseaudio] module.c: Loaded "module-loopback" (index: #29; argument: "source="bluez_source.C4_78_88_C7_05_AC" source_dont_move="true" sink_input_properties="media.role=phone"").
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
I: [pulseaudio] card.c: Changed profile of card 1 "bluez_card.C4_78_88_C7_05_AC" to headset_audio_gateway
D: [pulseaudio] device-port.c: Setting port phone-output to status yes
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio] device-port.c: Setting port phone-input to status yes
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
D: [pulseaudio] module-bluez5-device.c: Resuming source bluez_source.C4_78_88_C7_05_AC because its transport state changed to playing
D: [pulseaudio] module-bluez5-device.c: Resuming sink bluez_sink.C4_78_88_C7_05_AC because its transport state changed to playing
D: [pulseaudio] module-loopback.c: Loopback overall latency is 28.00 ms + 0.00 ms + 0.00 ms = 28.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 0 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 28.00 ms + 0.00 ms + 25.00 ms = 53.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 0 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
I: [bluetooth] module-loopback.c: Could not peek into queue
I: [bluetooth] module-loopback.c: Could not peek into queue
I: [bluetooth] module-loopback.c: Could not peek into queue
I: [bluetooth] module-loopback.c: Could not peek into queue
D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_C8_25_E1_D2_80_22
D: [pulseaudio] module-loopback.c: Loopback overall latency is 34.00 ms + 0.00 ms + 25.00 ms = 59.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 0 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 34.00 ms + 6.00 ms + 0.00 ms = 40.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 48 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 34.00 ms + 0.00 ms + 25.00 ms = 59.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 0 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
D: [pulseaudio] module-loopback.c: Loopback overall latency is 34.00 ms + 6.00 ms + 0.00 ms = 40.00 ms
D: [pulseaudio] module-loopback.c: Should buffer 96 bytes, buffered at minimum 96 bytes
D: [pulseaudio] module-loopback.c: [bluez_sink.C4_78_88_C7_05_AC] Updated sampling rate to 8000 Hz.
I: [bluetooth] module-bluez5-device.c: FD error: POLLERR POLLHUP
D: [bluetooth] module-bluez5-device.c: Audio stream torn down
D: [pulseaudio] bluez5-util.c: Transport /card_1 state changed from playing to idle
D: [pulseaudio] card.c: Setting card bluez_card.C4_78_88_C7_05_AC profile headset_audio_gateway to availability status unknown
D: [pulseaudio] module-bluetooth-policy.c: Setting card 'bluez_card.C4_78_88_C7_05_AC' to profile 'off'
D: [pulseaudio] module-rescue-streams.c: No evacuation sink found.


No idea what these lines really means!!!!

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: Bluetooth HFP

Thu Jun 08, 2017 8:00 am

Irvaan Sid wrote:Is there any way to implement HSP profile with built-in bluetooth in raspberry pi 3??

I also tried that, but failed.
HSP should work. I've tested a basic Bluetooth headset. That seemed to work well enough.

Irvaan Sid
Posts: 10
Joined: Tue Jun 06, 2017 11:43 am

Re: Bluetooth HFP

Thu Jun 08, 2017 11:53 am

ktb wrote:
Irvaan Sid wrote:Is there any way to implement HSP profile with built-in bluetooth in raspberry pi 3??

I also tried that, but failed.
HSP should work. I've tested a basic Bluetooth headset. That seemed to work well enough.
Could you please share the steps and required commands?? Thanks in advance

dchang0
Posts: 6
Joined: Fri Sep 08, 2017 6:59 am

Re: Bluetooth HFP

Fri Sep 08, 2017 7:04 am

I'm having the same problem. I can stream audio from my iPhone's iTunes app without trouble, and when I start a phone call I can hear the beeps of the dialing, and I can choose the RPi as the handsfree unit while the call is ringing, but as soon as the call connects, the audio is lost and lots of these errors show up in the syslog:

D: [bluetooth] module-loopback.c: Requesting rewind due to end of underrun.
I: [alsa-sink-bcm2835 ALSA] module-loopback.c: Could not peek into queue

Any help or tips are appreciated!

dchang0
Posts: 6
Joined: Fri Sep 08, 2017 6:59 am

Re: Bluetooth HFP

Sun Nov 12, 2017 8:41 am

FYI, I was able to solve my problem by building only PulseAudio 11 from source code (did not have to build Bluez 5.x or Ofono from source--I kept the distro-packaged versions in place).

Rooneyy259
Posts: 4
Joined: Fri Nov 03, 2017 9:19 am

Re: Bluetooth HFP

Mon Nov 13, 2017 8:20 am

Please let us know if someone was successfully able to do.
Thanks.

500E
Posts: 3
Joined: Wed Jun 17, 2020 2:26 pm

Re: Bluetooth HFP

Thu Jun 18, 2020 4:57 pm

dchang0 wrote:
Sun Nov 12, 2017 8:41 am
FYI, I was able to solve my problem by building only PulseAudio 11 from source code (did not have to build Bluez 5.x or Ofono from source--I kept the distro-packaged versions in place).
May I ask what changes did you do when building PA 11 from source to get it to work?
I rebuilt PA 12.2 and 10.0 from source and changed imtu from 48 to 60 everywhere inside these two files ---- but it only KIND OF works....

▪ ~/pulseaudio/src/modules/bluetooth/backend-native.c
▪ ~/pulseaudio/src/modules/bluetooth/backend-ofono.c

:(

Return to “General discussion”